Subject: Re: save elments to an array and use later
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Tue, 03 Dec 2013 11:04:44 +0100
|
henry human wrote:
I want to save specific child elements from the xml below to an array element and later loop over the array.
For example the element I am interested in is those with <test>A</test>
Any suggestion?
Thanks
<root>
<child>
<transfer>J</transfer>
<station>B</station>
<test>C</test>
</child>
<child>
<transfer>N</transfer>
<station>I</station>
<test>A</test>
</child>
<child>
<transfer>F</transfer>
<station>B</station>
<test>M</test>
</child>
<child>
<transfer>F</transfer>
<station>B</station>
<test>P</test>
</child>
<child>
<transfer>H</transfer>
<station>G</station>
<test>A</test>
</child>
</root>
/root/child[test = 'A'] gives you the elements, if you want to store
them use
<xsl:variable name="v1" select="/root/child[test = 'A']"/>
in XSLT. The value of the variable is a node set (XSLT 1.0) or sequence
(XSLT 2.0) of `child` elements. XSLT does not have arrays.
|