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

Re: count() problem

Subject: Re: count() problem
From: Mukul Gandhi <mukulgandhi2003@xxxxxxxxxxx>
Date: Sun, 18 Apr 2004 06:21:25 +0100 (BST)
xsl count
Here is another solution using the node-set function. 

<xsl:template match="/root/nodes">
  <xsl:variable name="rtf">
    <xsl:for-each select="*">
	<xsl:if test="text() != ''">
	  <a/>
	</xsl:if>
    </xsl:for-each>
  </xsl:variable>
		
  <xsl:value-of
select="count(vendor:node-set($rtf)/a)" />
</xsl:template>

Regards,
Mukul

 --- Sam Saha <sam_saha1975@xxxxxxxx> wrote: > Hi,
>   How do I use the count() function to count the
> number of nodes that do NOT have a blank value. I
> have
> the following xml. In this case the count should be
> 6.
> 
> <root>
>   <nodes>
>      <tele1>abc</tele1>
>      <tele2></tele2>
>      <tele3>abc</tele3>
>      <tele4></tele4>
>      <tele5>abc</tele5>
>      <tele6>abc</tele6>
>      <node1></node1>
>      <node2>abc</node2>
>      <node3>abc</node3>
>   </nodes>
> </root>
> 
> I am doing something like this:
> <xsl:variable name="num"
>
select="count(root/nodes/*[starts-with(local-name(),'tele')!=''
> or starts-with(local-name(),'node')!=''])" />
> 
> But this counts even the nodes that have a blank
> value.
> 
> Thanks
> Sam.
> 
> 
> 
>
______________________________________________________________________
> 
> Post your free ad now! http://personals.yahoo.ca
>  

________________________________________________________________________
Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/

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.