The only thing wrong with your code (as far as I can see from here) is that you can't use the $currentPage parameter (or any other variable for that matter) in the string. You'll need to construct your XPath from the root ("/") - you should be able do this to get the equivalent of $currentPage:
Create a XPath from string
Hi,
I have a multinode picker where I can pick several pages in Umbraco. Every page has a date datatype.
I need to list all of these pages in order of the date data type.
I thought i could be something like this:
<xsl:variable name="myXPath">
<xsl:text>$currentPage/descendant-or-self::Show [@id = 1000 </xsl:text>
<xsl:for-each select="$currentPage/shows/MultiNodePicker/nodeId">
<xsl:text> or @id = </xsl:text><xsl:value-of select="nodeId"/>
</xsl:for-each>
</xsl:variable>
<xsl:for-each select="umbraco.library:GetXmlNodeByXPath($myXPath)">
....
Yeah you get the idea... I thought that was what the GetXmlNodeByXPath() was for, but I cant make it work.. not even if I make a very simple example.
Is there a way to create a XPath string and use it in a for-each ? :-)
Regards
Peter
Hi Peter,
The only thing wrong with your code (as far as I can see from here) is that you can't use the $currentPage parameter (or any other variable for that matter) in the string. You'll need to construct your XPath from the root ("/") - you should be able do this to get the equivalent of $currentPage:
/Chriztian
Aarh.. I thought you could string a variablename aswell :-)
Well... I'll try that and let you know.. By the way. How do you box the code? :-)
You create a code block like this :-):
/Chriztian
Arh.. did'nt see that :-) Cool.. i will use that next time.
Well the solution worked like a charm... Or well.. I had some problems to make it work, but that was just the original Xpath :-)
Thanks :-)
is working on a reply...