Re: [xsl] save elments to an array and use later

Subject: Re: [xsl] save elments to an array and use later
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Tue, 03 Dec 2013 11:32:02 +0100
henry human wrote:
thanks Martin
Now what if the conditon to save those elements is a little different:
Example:
<root>
.....
  <child>
     <transfer>N</transfer>
     <station>I</station>
     <test>A</test>
  <test1>A</test1>
<test2>O</test2>
  <lement1>F</element1>
<lement2>W</element1>
<lement3>W</element3>
</child>
  <child>
     <transfer>F</transfer>
     <station>B</station>
     <test>M</test>
   <test1>A</test1>
<test2>P</test2>
  <lement1>P</element1>
  <lement2>F</element2>
<lement3>F</element3>
</child>
........
</root>

if test = 'A' and element1 = 'F' or test1 = 'A' and element2 = 'F' or test3 = 'A' and element3 = 'F' .....

Assuming XSLT 2.0 you could use


<xsl:variable name="v1" select="root/child[test = 'A' and (element1, element2, element3) = 'F']"/>

But if you are happy to spell out your condition then of course you nearly literally write what you have above

<xsl:variable name="v1" select="root/child[(test = 'A' and element1 = 'F') or (test1 = 'A' and element2 = 'F') or (test3 = 'A' and element3 = 'F')]"/>

Current Thread