Thread: Element
View Single Post
  #1 (permalink)  
Old June 13th, 2006, 03:38 AM
Neal Neal is offline
Friend of Wrox
Points: 718, Level: 10
Points: 718, Level: 10 Points: 718, Level: 10 Points: 718, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2006
Location: Ennis, Clare, Ireland.
Posts: 131
Thanks: 10
Thanked 0 Times in 0 Posts
Default Element


The following is the XML that I need to transform (Input):

<Anal Type="PGRP">
 <Seg No="1" Code="1">FEED</Seg>
 <Seg No="2" Code="1D">ANIMAL</Seg>
 <Seg No="3" Code="DC">FIN</Seg>
The following format is my required Output:

<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)?

<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()"/>    
The above code produces the following (current) Output:

<Reference Type="Major Class Code" AssignedBy="Manufacturer" Explanation="">1</Reference>
How do I retreive the 'Feed' value in my code (to be positioned after 'Explanation=')?

Thanks in advance,


A Northern Soul

A Northern Soul
Reply With Quote