Subject: Re: xsl: descendent count?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 16 Sep 1999 11:28:53 +0100 (BST)
|
> <xsl:if test='["cout(*)>5"]'>
> The above condition is not working, can you help me out.
Well it's not working because almost every bit of it is syntactically
incorrect:-)
[ ] are essentially filters that you apply to a node list you have
constructed eg
select = "para" gives you all the para children
select = "para[position() > 3]"
gives you all but the first three, but you have to have something before
the [ to apply to.
Here though you are not filtering a node list at all so you don't want
[ ]
Then "cout(*)>5" is inside " so is just the string cout(*)>5 and
XSLT doesn't see it as a greater than expression, it is just a string.
So you don't want to quote this with "
and finally you misspelled count (this would be an unknown function
error if you hadn't quoted the whole expression into a string)
<xsl:if test="count(*) > 5">
<xsl:if>
I changed > to > although > is legal. (I find it confusing to use >
as < is not legal you have to use < so I prefer to use entities for
both.)
I changed your top level quotes from ' to " just because I try to always
use " for the XML attribute quotes and then ' for xslt (xpath) string
quotes, but this is just a matter of personal style, some people do it
the other way round.
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|