Page 1 of 1

Help with Transformation

Posted: Tue Jun 05, 2007 12:56 pm
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

Posted: Tue Jun 05, 2007 5:36 pm
by jkmyoung
<xsl:value-of select="count(//Flow[@From = $From])"/>

where $From is a parameter.