<!-- The nodes which will be displayed. Sorted in the correct order. -->
<xsl:variable name="temp_nodes">
<xsl:for-each select="$currentPage/NewsItem [@isDoc]">
<xsl:sort order="descending" select="currentDate" data-type="text"/>
<xsl:copy-of select="." />
</xsl:for-each>
</xsl:variable>
<!-- Convert the nodes to a value which is easier to work with. -->
<xsl:variable name="nodes" select="msxml:node-set($temp_nodes)/*[self::NewsItem [@isDoc]]" />
<!-- The total amount of items -->
<xsl:variable name="totalItems" select="count($nodes)" />
If you're using Umbraco 4.5 this won't work:
msxsl:node-set($currentPageCopy)/node)
If you try /* or /* [@isDoc] what does the count return?
The /node is the name of the element. In Umbraco 4.0.x all the nodes are of the element of "node". You can see this if you look at the umbraco.config file.
How can one use use xml for variables? (currentPage and GetXmlNodeById)
I wonder how one can make variables use xml. Some experiments:
That won't give me a copy of the magic $currentPage. If I try to use
I'll get an error - "need to use node-set." But with this:
I always get the result 0.
Why am I trying to achieve?
Yes, I need a variable that can contain either currentPage or another node xml:
...so that I can use it with standard xslt instead of $currentPage.
Thanks alot!
Here is a sample I'm using:
If you're using Umbraco 4.5 this won't work:
If you try /* or /* [@isDoc] what does the count return?
Jeroen
Thanks
I'm using 4.03 here forgot to say.
I missed a $:
... ang adding /node to it seems to do the trick this time. But ... I'm trying to understand what happens...
The /node is the name of the element. In Umbraco 4.0.x all the nodes are of the element of "node". You can see this if you look at the umbraco.config file.
Jeroen
Yes, indeed, but I thought I was at the right node to begin with.
I guess I'm just one level up because of the variable, and that's why omitting the "/node" won't work as expected.
Since this works:
But this don't:
I'll have to use:
is working on a reply...