B
Bill Sneddon
I am using the for-each below to build a table where the header is
a unique nonblank EQUIP_TYPE. This works well.
What I would like to do is not execute the for loop on on EQUIP_TYPE
unless one of the AUTOMATED tags equals YES.
I can change the data so that each row whould contain a tag that
shows if the EQUIP_TYPE has an AUTOMATED member but that seems wasteful.
<xsl:key name="tools-by-type" match="row" use="EQUIP_TYPE"/>
<xsl:template match="document">
<xsl:for-each select="row[count(. | key('tools-by-type', EQUIP_TYPE)[1])
= 1 and EQUIP_TYPE[string-length()>0 ] ">
sample of the XML
<document>
<row rowNumber="1">
<EQUIP_TYPE>ASH</EQUIP_TYPE>
<TOOL_NAME>ASHZ01ED</TOOL_NAME>
<AUTOMATED>YES</AUTOMATED>
</row>
<row rowNumber="2">
<EQUIP_TYPE>ASH</EQUIP_TYPE>
<TOOL_NAME>ASHZ02ED</TOOL_NAME>
<AUTOMATED>YES</AUTOMATED>
</row>
</document>
a unique nonblank EQUIP_TYPE. This works well.
What I would like to do is not execute the for loop on on EQUIP_TYPE
unless one of the AUTOMATED tags equals YES.
I can change the data so that each row whould contain a tag that
shows if the EQUIP_TYPE has an AUTOMATED member but that seems wasteful.
<xsl:key name="tools-by-type" match="row" use="EQUIP_TYPE"/>
<xsl:template match="document">
<xsl:for-each select="row[count(. | key('tools-by-type', EQUIP_TYPE)[1])
= 1 and EQUIP_TYPE[string-length()>0 ] ">
sample of the XML
<document>
<row rowNumber="1">
<EQUIP_TYPE>ASH</EQUIP_TYPE>
<TOOL_NAME>ASHZ01ED</TOOL_NAME>
<AUTOMATED>YES</AUTOMATED>
</row>
<row rowNumber="2">
<EQUIP_TYPE>ASH</EQUIP_TYPE>
<TOOL_NAME>ASHZ02ED</TOOL_NAME>
<AUTOMATED>YES</AUTOMATED>
</row>
</document>