As you may know, ancestor-or-self:: returns all the ancestors that match the specified node name (in this case the wildcard "*") - here's a sample in the Axes Visualizer ...
The normalize-space() function collapses all whitespace in a text node (leaving it blank if it consists of only whitespace), so the immediately following predicate [normalize-space(footerLinks)] makes sure that out of the nodes returned from the axis, we only want the ones that actually have a value in the footerLinks property. The last predicate ([1]) returns only the first node in the resulting set, which will be $currentPage itself, its parent, the parent's parent etc.
Having arrived at a single node guaranteed to have a value in the footerLinks property, we finally end the XPath by selecting that property.
Getting the values from an Ultimate Picker recursively
Hello I have an ultimate picker control pointing to a node so that I can select items to display. This work fine.
However when I load a page that is a subordinate of the root the XSLT throws an error:
Presumably because the variable:
Returns nothing.
My question is how can I mod the syntax to look at the current node or look at the node above? I think this can be done but can't fanthom the syntax.
Hi Streety,
This is how you pick recursively in XSLT:
/Chriztian
Woah! That worked. You the man!
I get:
<xsl:variablename="footerLinks"select="$currentPage/ancestor-or-self::
But
*[normalize-space(footerLinks)][1]/footerLinks"/>
Ehh! What the [1] doing and normalize-space?
Thank you.
Hi Streety,
As you may know, ancestor-or-self:: returns all the ancestors that match the specified node name (in this case the wildcard "*") - here's a sample in the Axes Visualizer ...
The normalize-space() function collapses all whitespace in a text node (leaving it blank if it consists of only whitespace), so the immediately following predicate [normalize-space(footerLinks)] makes sure that out of the nodes returned from the axis, we only want the ones that actually have a value in the footerLinks property. The last predicate ([1]) returns only the first node in the resulting set, which will be $currentPage itself, its parent, the parent's parent etc.
Having arrived at a single node guaranteed to have a value in the footerLinks property, we finally end the XPath by selecting that property.
/Chriztian
Thank you again for responding. The Axes Simulator is a wonderul learning tool.
is working on a reply...