|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Query Regarding XSL
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








