Click to See Complete Forum and Search --> : Newbie questions, how to get a specific element ...


BlackSun
November 24th, 2003, 05:20 PM
Ok, don't know if this has been asked but I need some help

I have some xml like this

<vehicles>
<car type="Ford" id="1"
.... attributes for the car
</car>
<car type="chevrolet" id="1"
.... attributes for the car
</car>

</vehicles>

now if I in my xsl want only cars of type Ford written out how do I do that ?
something like <for-each "All cars of type "Ford">
do what should be done .....

Hope someone can answer me ....
TIA

khp
November 24th, 2003, 10:06 PM
In the template that matches your vehicles element you could write something like

<xsl:apply-templates select="car[@type='Ford']"/>

This would select the cars of type ford and apply the templates that matchs these elements to them.