Help with Transformation

Here should go questions about transforming XML with XSLT and FOP.
viki.gandhi
Posts: 1
Joined: Tue Jun 05, 2007 12:54 pm
Location: Pune

Help with Transformation

Post by viki.gandhi »

I am having XML file containing some data as follows:

<Flow From='a' To='b'>
<Flow From='a' To='d'>
<Flow From='b' To='d'>
<Flow From='a' To='c'>
<Flow From='c' To='d'>

Now I wanted to write a template in which if I pass 'From' parameter,I should be able to get the number of flows from that element to other. For example,if I pass 'a' as a parameter,it should return 3,as in case of above example.


Regards,
Viki Gandhi
jkmyoung
Posts: 89
Joined: Mon Mar 06, 2006 10:13 pm

Post by jkmyoung »

<xsl:value-of select="count(//Flow[@From = $From])"/>

where $From is a parameter.
Post Reply