Below is my xml sample. Here's what I want
- Loop through all cars
- If a car has a "Sport" style then display them, otherwise, ignore it
So in the example below, I will display Ferrari and 2 values of Convertible and Sport
I have <for-each>Car</end-for-each>
. I want to check if a car has a style of "Sport" or not. How do I do that? Do I have to have another <for-each>Style</end-for-each>
inside the <for-each>Car</end-for-each>
? If I found a sport style then I'm initializing a variable and assign it such as
<?xdoxslt:set_variable($_XDOCTX, ’car’, 1)?> --- initialize to 1 if Sport style found
<?xdoxslt:get_variable($_XDOCTX, ’car’)?> --- retrieve
<Car>
<Brand>Honda</Brand>
<Style>Coupe</Style>
<Style>Sedan</Style>
</Car>
<Car>
<Brand>Ferrari</Brand>
<Style>Convertible</Style>
<Style>Sport</Style>
</Car>