[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl: descendent count?

Subject: Re: xsl: descendent count?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 16 Sep 1999 11:28:53 +0100 (BST)
xsl count unknown function
>  <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() &gt; 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(*) &gt; 5">
<xsl:if>

I changed > to &gt; although > is legal. (I find it confusing to use >
as < is not legal you have to use &lt; 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.