Hi,
The following is the XML that I need to transform (Input):
Code:
<Anal Type="PGRP">
<Seg No="1" Code="1">FEED</Seg>
<Seg No="2" Code="1D">ANIMAL</Seg>
<Seg No="3" Code="DC">FIN</Seg>
</Anal>
The following format is my required Output:
Code:
<Reference Type="Class Code" AssignedBy="Manufacturer" Explanation="Feed">1</Reference>
I have coded the following lines which retrieves the value '1', but how do I retrieve the value 'Feed' (See **** in code below)?
Code:
<xsl:template name="Anal" match="*[@Type='PGRP']">
<xsl:for-each select=".//*[@Type='PGRP']/Seg/@No">
<xsl:if test="position() =1">
<xsl:element name="Reference">
<xsl:attribute name="Type">Major Class Code</xsl:attribute>
<xsl:attribute name="AssignedBy">Manufacturer</xsl:attribute>
<xsl:attribute name="Explanation">****</xsl:attribute>
<xsl:value-of select="current()"/>
</xsl:element>
</xsl:if>
</xsl:for-each>
</xsl:template>
The above code produces the following (current) Output:
Code:
<Reference Type="Major Class Code" AssignedBy="Manufacturer" Explanation="">1</Reference>
Question
How do I retreive the 'Feed' value in my code (to be positioned after 'Explanation=')?
Thanks in advance,
Neal
A Northern Soul