xsl-list
[Top] [All Lists]

[xsl] Problem in XSL transformation

2006-09-06 01:31:32
Hi All,

We want to transform a particular XML file which contains elements in a loop. 
We want to append a symbol as the header for each iteration. The symbol list is 
a string which contains individual symbols separated by pipeline (|).

For example, if the symbol list is abc|def, in first iteration we want abc as 
the header and in the second iteration, we want def as the header. The code 
which we are using is as follows.


<xsl:template name="add_symbol_to_output">
    
     <xsl:param name="str"/>      
      <xsl:choose>
        <xsl:when test="contains($str,'|')">
          <xsl:value-of
                select="substring-before($str,'|')"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$str"/> 
        </xsl:otherwise>
      </xsl:choose>
            
    </xsl:template>

<xsl:for-each select="root/firstChild">   
 
        <xsl:variable name="inputParam" select="$inputSymbol"/>

        <xsl:call-template name="add_symbol_to_output">
                <xsl:with-param name="str" select="$inputParam"/>
        </xsl:call-template>
        
        <xsl:variable name="inputSymbol" 
select="substring-after($inputSymbol,'|')"/>
  
                                                <xsl:text>,</xsl:text>
                                                <xsl:value-of 
select="fid[(_at_)id='SAMPLEID_1']"/>
                                                <xsl:text>,</xsl:text>

We are getting the same header, i.e. abc for all iterations.

Any clues?



Thanks & Regards,
Ambika Prasad Das
 


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--