I was trying to see if the input attribute name and value exists in the Points/Point and check the Atn condition and use the sibling attripute name value of the points/point in the output xml. Here is the input xml
<Input>
<Att1>
<attribute name="test1">11</attribute>
<attribute name="test2">N/A</attribute>
<attribute name="test3">2</attribute>
<attribute name="test4">455</attribute>
<attribute name="test5">16</attribute>
</<Att1>
<points>
<point>
<Atn>test1=11 | test1=12</Atn>
<newName>test6</newName>
<newValue>46</newValue>
</point>
<point>
<Atn>test4!=16 | test4!=12</Atn>
<newName>test8</newName>
<newValue>7</newValue>
</point>
<point>
<Atn>test4!=null</Atn>
<newName>test9</newName>
<newValue>6</newValue>
</point>
<point>
<Atn>!test1</Atn>
<newName>test5</newName>
<newValue>6</newValue>
</point>
<point>
<Atn>test3=4</Atn>
<newName>test4</newName>
<newValue>6</newValue>
</point>
<point>
<Atn>test3!=40</Atn>
<newName>test4</newName>
<newValue>46</newValue>
</point>
</points>
</Input>
Here is the xsl
<xsl:variable name="testCondition"
select="Atn" />
message1:<xsl:value-of select="$testCondition"/>
<xsl:variable name="conditionRules"
select="str:tokenize($testCondition,'|,!,!=')" />
the expected output
<output>
<Att1>
<attribute name="test1">11</attribute>
<attribute name="test2">N/A</attribute>
<attribute name="test3">2</attribute>
<attribute name="test4">455</attribute>
<attribute name="test5">16</attribute>
<attribute name="test6">46</attribute>
<attribute name="test8">7</attribute>
</<Att1>
</output>
No comments:
Post a Comment