Here is a lookup file get the values for Table attributes that match in the actual xml files
<?xml version="1.0"?>
<Templates>
<Template>
<Obj>1</Ob>
<Att>1</Att>
<Ingest>0</Ingest>
<Name>FNC</Name>
<Category>ALL</Category>
<Class>TestTwo</Class>
<Table>CNDB0</Table>
<Attribute>cod</_Attribute>
<Value>-22</Value>
</Template>
</Templates>
Here is the actual xml file
<?xml version="1.0" encoding="UTF-8"?><p:transformOutput xmlns:p="http://cfpe/export/objects">
<p:objectSet>
<p:objectSetType>DNC</p:objectSetType>
<p:objects>
<p:object>
<p:objectType>FNC</p:objectType>
<p:objectAttributes>
<p:attribute name="ssc">10</p:attribute>
<p:attribute name="btc">0</p:attribute>
<p:attribute name="ccc">27</p:attribute>
<p:attribute name="nam">C</p:attribute>
<p:attribute name="Code">0001</p:attribute>
</p:objectAttributes>
</p:object>
</p:objects>
</p:objectSet>
</p:transformOutput>
Here is my xsl
<xsl:variable name="statClass" select="$objectPath/Template/Class" />
<xsl:variable name="matchObject" select="$valuePath/p:obje/p:objectType"/>
<xsl:choose>
<xsl:when test="$statClass =$matchObject">
<xsl:value-of select="$objectPath/Template/text()"/>
I couldn't get to select all the attributes in the template once one of the attributes matches
It is best to use a key to lookup values. Here is a minimized example:
Given this input XML:
and a second file named templates.xml:
the following stylesheet:
XSLT 1.0
will return:
In XSLT 2.0 you'll be able use the lookup file as an argument of the key() function, thus avoiding the need to switch context.