Re: Query Regarding XSL

Subject: Re: Query Regarding XSL
From: Steve Tinney <stinney@xxxxxxxxxxxxx>
Date: Thu, 20 Jan 2000 07:14:22 -0500
You need the count() function, which takes a node-set as its argument. 
Something like count(Emp[@id='1']/*) will be what you want. For more
information see the XPath specification. 

Nilay.Shah@xxxxxxxxxxxxxxxxxxx wrote:
> 
> Hello,
> 
> I have created XML and want to apply XSL on that.  I want to is there a way
> to find the number of child a particular node has?
> For example suppose my XML looks like as follows:
> 
> <company>
> <Emp id='1'>
>      <NAME>nilay</name>
>      <PSNO>1234</PSNO>
>      <SALARY>1000</SALARY>
>      <knowledge>C</knowledge>
>      <knowledge>C++</knowledge>
>      <knowledge>VB</knowledge>
>      <knowledge>Cobol</knowledge>
> </Emp>
> <Emp id = '2'>
>      <NAME>xyz</NAME>
>      <PSNO>3454</PSNO>
>      <SALARY>2121</SALARY>
>      <knowledge>C</knowledge>
>      <knowledge>C++</knowledge>
> </Emp>
> </company>
> 
> Is there a way to find the count of nodes for Emp=1 and number of nodes for
> Emp=2?
>  The answer in first case should result in 7 while in second case should
> result in 5.
> 
> Or is there a way to find the number of Employees?
> 
> How should I do it in XSL?
> 
> Please Reply,
> 
> Thanks and Regards,
> Nilay.( XSL-List member)
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
----------------------------------------------------------------------
Steve Tinney                                        Babylonian Section
                                 *   University of Pennsylvania Museum
stinney@xxxxxxxxxxxxx                          Phila, PA. 215-898-4047


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread