This discussion is archived
1 Reply Latest reply: Nov 1, 2012 10:04 AM by SRAY01 RSS

How to import an XML element into a loop parameter is XSL

SRAY01 Newbie
Currently Being Moderated
We are using XSL template to generate output in a pdf format. The input in an XML file. In the XSL we have a loop. Currently the initial and final value of the loop counter is hardcoded in the xsl file.

<xsl:call-template name="forloop">
     <xsl:with-param name="i">1</xsl:with-param>
     <xsl:with-param name="count">6</xsl:with-param>

Down below we are using
     <xsl:template name="forloop">
          <xsl:param name="i"/>
          <xsl:param name="count"/>
          <xsl:if test="$i &lt;=$count">
               <xsl:call-template name="forloop">
                    <xsl:with-param name="i">
                         <xsl:value-of select="$i + 1"/>
etc, etc.

Query :
Currently the final value of the loop is hardcoded to 6. I want to set its value based of an element BAR_CODE_PRINT_NUM value (which can be either 0 or 6) of the XML File.

Can anyone please tell me how this is to be done. I have tried the following but it did not work.
Approach 1 :
     <xsl:with-param name="count">6</xsl:with-param>
     <xsl:with-param name="count">0</xsl:with-param>
Approach 2 :
<xsl:with-param name="count"><xsl:value-of disable-output-escaping="no" select="LIST_G_BAR_CODE_PRINT/G_BAR_CODE_PRINT/BAR_CODE_PRINT_NUM"/>



  • Correct Answers - 10 points
  • Helpful Answers - 5 points