Hi, I am trying to get some logic in place based on: 1. a node's position in the tree, and 2. the total number of nodes. However my COUNT() keeps returning 0.
THANK YOU TOM! That was exactly what I was looking for. I wish there were better documentation to train people on the 4.5 schema assuming no prior experience.
Now a question. I am trying to divide my content nodes into two columns. I am using the following syntax:
Confusion using COUNT with XPath syntax
Hi, I am trying to get some logic in place based on: 1. a node's position in the tree, and 2. the total number of nodes. However my COUNT() keeps returning 0.
I have tried the following:
<xsl:value-of select="count($currentPage/node [@nodeTypeAlias = 'Bio'])" />
<xsl:value-of select="count($currentPage/nodes [@nodeTypeAlias = 'Bio'])" />
I am consistently getting a 0 for all of these expressions and am starting to get very confused. Any help is greatly appreciated!
FYI this is a site built on 4.7.0 so it uses the 4.5 schema.
Hi Alex,
If you are using the new schema you should be using:
<xsl:value-ofselect="count($currentPage/Bio [@isDoc])"/>
In the new schema there is no more <node>, each node's element is named by their Document Type Alias instead.
See this wiki for more info: http://our.umbraco.org/wiki/reference/xslt/45-xml-schema
Note this will find direct children of the type Bio, if you want all children (deep) you can use $currentPage//Bio [@isDoc]
Hope this helps,
Tom
THANK YOU TOM! That was exactly what I was looking for. I wish there were better documentation to train people on the 4.5 schema assuming no prior experience.
Now a question. I am trying to divide my content nodes into two columns. I am using the following syntax:
But the "firstColumn" is empty and everything is coming out into "secondColumn".
Is my for-each not right?
Try this instead:
Thanks for the suggestion Tom. My for-each seems to be working which leads me to suspect a caching issue.
is working on a reply...