I am new to XSLT and need some help to optimize my code. I need to find 2 nodes on the same level as the page I am in. those 2 nodes has a Generic property (Type) so I can tell the different between them.
I have found a solution but I don’t think it is the best way to do it, could someone please show me some best practices?
I think I'd do something like the following. (typed in the forum so there might be a small typo)
[code]
[/code]
The idea here is that the select statement can find the items directly, without needing a for-each loop. Basically, each of these select statements do the same thing, which might be described in pseudo-logic as:
Starting at the $currentPage, go up one level in the hierarchy and then look at all the nodes below that parent node (that's the "..//node" portion).
If you're familiar with SQL, then the use of square brackets in xslt is a lot like the 'where' clause in SQL. Therefore, we are looking for all the nodes below the current page's parent "where" the level of the node is the same as the current page and the type is what we're looking for.
Having found that node, we get it's id.
Hope that makes sense. But remember, your solution also works and unless you've got a massive site the performance will not be significantly different because xslt is extremely fast.
Thanks very much !!
If you got the time i would like you to look on this thread http://forum.umbraco.org/yafpostst8990How-to-initialize-a-xslparam-on-behalf-of-the-querystring.aspx
Need help to optimize my XSLT
I am new to XSLT and need some help to optimize my code. I need to find 2 nodes on the same level as the page I am in. those 2 nodes has a Generic property (Type) so I can tell the different between them.
I have found a solution but I don’t think it is the best way to do it, could someone please show me some best practices?
[code]
Search
Thread
[/code]
I think I'd do something like the following. (typed in the forum so there might be a small typo)
[code]
[/code]
The idea here is that the select statement can find the items directly, without needing a for-each loop. Basically, each of these select statements do the same thing, which might be described in pseudo-logic as:
Starting at the $currentPage, go up one level in the hierarchy and then look at all the nodes below that parent node (that's the "..//node" portion).
If you're familiar with SQL, then the use of square brackets in xslt is a lot like the 'where' clause in SQL. Therefore, we are looking for all the nodes below the current page's parent "where" the level of the node is the same as the current page and the type is what we're looking for.
Having found that node, we get it's id.
Hope that makes sense. But remember, your solution also works and unless you've got a massive site the performance will not be significantly different because xslt is extremely fast.
cheers,
doug.
Thanks very much !!
If you got the time i would like you to look on this thread http://forum.umbraco.org/yafpostst8990How-to-initialize-a-xslparam-on-behalf-of-the-querystring.aspx
Thanks in advance!
is working on a reply...