Confusing incrementation

Discussion in 'XML' started by Petterson Mikael, Sep 6, 2006.

  1. Hi,

    I am generating code using xsl. I have two templates for that. One for
    the name and one for the value ( these are pairs). I have checked that
    maxCount is the same for both ( e.g. 4) but I get something like:

    from template for names:

    <sequencename>_name0
    <sequencename>_name1
    <sequencename>_name2
    <sequencename>_name3

    from template for values:

    <sequencename>_value[0]
    <sequencename>_value[1]
    <sequencename>_value[2]
    <sequencename>_value[3]
    <sequencename>_value[4]

    Anyone that can see why?

    cheers,

    //mikael

    Template for names:
    ===================

    > <!-- Template that create "<sequencename>_name0", "<sequencename>_name1"..:
    > super(new String[] {
    > "scramblingCode", "noOfEAgchCodes", "eAgchCodes_name_0",
    > "eAgchCodes_name_1", "eAgchCodes_name_2",
    > "eAgchCodes_name_3", "noOfEHichERgchCodes",
    > "eHichERgchCodes_name_0", "eHichERgchCodes_name_1",
    > "eHichERgchCodes_name_2", "eHichERgchCodes_name_3",
    > "eulMaxTargetRtwp"
    > }-->
    > <xsl:template name="sequenceNameString">
    > <xsl:param name="sequenceName"/>
    > <xsl:param name="maxCount"/>
    > <xsl:param name="value"/>
    > <!--<xsl:param name="arrayMax" select="$maxCount"/>-->
    > <!--<xsl:if test="$value &lt;= $arrayMax">-->
    > <xsl:if test="$value &lt;= $maxCount">
    > <xsl:text>"</xsl:text>
    > <xsl:value-of select="concat(concat($sequenceName,'_name_'),$value)"/>
    > <xsl:text>"</xsl:text>
    > <!--<xsl:if test="$value != $arrayMax">-->
    > <xsl:if test="$value != $maxCount">
    > <xsl:text>,</xsl:text>
    > </xsl:if>
    > <xsl:call-template name="sequenceNameString">
    > <xsl:with-param name="value" select="$value + 1"/>
    > <xsl:with-param name="sequenceName" select="$sequenceName"/>
    > <xsl:with-param name="maxCount" select="$maxCount"/>
    > </xsl:call-template>
    > </xsl:if>
    > </xsl:template>


    Template for value:
    ===================

    > <xsl:template name="sequenceValueObject">
    > <xsl:param name="sequenceName"/>
    > <xsl:param name="maxCount"/>
    > <xsl:param name="dataType"/>
    > <xsl:param name="value"/>
    > <xsl:if test="$value &lt;= $maxCount">
    > <xsl:choose>
    > <xsl:when test="$dataType = 'long'">
    > <xsl:text>new Integer</xsl:text>
    > </xsl:when>
    > <xsl:when test="$dataType = 'boolean'">
    > <xsl:text>new Boolean</xsl:text>
    > </xsl:when>
    > <xsl:when test="$dataType = 'string'">
    > <xsl:text>new String</xsl:text>
    > </xsl:when>
    > <xsl:when test="$dataType = 'longlong'">
    > <xsl:text>new Long</xsl:text>
    > </xsl:when>
    > <xsl:eek:therwise><xsl:call-template name="notImplemented">
    > <xsl:with-param name="sequnceName" select="$sequenceName"/>
    > <xsl:with-param name="error" select="$dataType"/>
    > </xsl:call-template></xsl:eek:therwise>
    >
    > </xsl:choose>
    > <xsl:text>(</xsl:text>
    > <xsl:value-of select="concat($sequenceName,concat('_value [',$value))"/>
    > <xsl:text>])</xsl:text>
    > <xsl:if test="$value != $maxCount">
    > <xsl:text>,</xsl:text>
    > </xsl:if>
    > <xsl:call-template name="sequenceValueObject">
    > <xsl:with-param name="sequenceName" select="$sequenceName"/>
    > <xsl:with-param name="value" select="$value + 1"/>
    > <xsl:with-param name="maxCount" select="$maxCount"/>
    > <xsl:with-param name="dataType" select="$dataType"/>
    > </xsl:call-template>
    > </xsl:if>
    > </xsl:template>
     
    Petterson Mikael, Sep 6, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralf Hildebrandt

    Re: Nested For Loop incrementation

    Ralf Hildebrandt, Jul 2, 2003, in forum: VHDL
    Replies:
    3
    Views:
    3,527
    Aaron McFarland
    Jul 3, 2003
  2. everett

    Variable name incrementation

    everett, Feb 13, 2004, in forum: C++
    Replies:
    3
    Views:
    438
    Jon Bell
    Feb 13, 2004
  3. Max

    Incrementation

    Max, Mar 23, 2007, in forum: Java
    Replies:
    3
    Views:
    396
  4. sam
    Replies:
    4
    Views:
    332
    Andre Kostur
    Jun 26, 2007
  5. Replies:
    4
    Views:
    320
    santosh
    Apr 26, 2008
Loading...

Share This Page