[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem in XSL transformation

Subject: Problem in XSL transformation
From: <Ambika.Das@xxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Sep 2006 14:05:05 +0530
 Problem in XSL transformation
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[@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
 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.