xsl-list
[Top] [All Lists]

RE: help with recursive counter in xsl

2006-02-09 06:19:26
Thanks,

That was the case.

Have a nice day!

//mikael 

-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: den 9 februari 2006 14:00
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] help with recursive counter in xsl 

Your recursive call only passes one parameter; so on the second call
$maxCount will be "", $arrayMax will be NaN, and $value < $arrayMax
will be false. 

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Mikael Petterson (KI/EAB)
[mailto:mikael(_dot_)petterson(_at_)ericsson(_dot_)com]
Sent: 09 February 2006 12:44
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] help with recursive counter in xsl

Hi,

I call the sequenceNameString template with:

  <xsl:when test="child::*[name() = 'sequence']">
    <xsl:call-template name="sequenceNameString">
    <xsl:with-param name="sequenceName" select="@name"/>   
    <xsl:with-param name="maxCount" select="sequence/maxLength"/>
    <xsl:with-param name="value" select="0"/>               
  </xsl:call-template></xsl:when>

I can check that the parameter values are sent to the template.
However the incrementation of value does not happen.

I get the following only once( example):

eAgchCodes_name0

but want:

 eAgchCodes_name0
 eAgchCodes_name1
 eAgchCodes_name2
......

Any ideas why?

cheers,

//Mikael

!-- Template that create "<sequencename>_name0", 
"<sequencename>_name1"..--> <xsl:template name="sequenceNameString">
    <xsl:param name="sequenceName"/>
        <xsl:param name="maxCount"/>
        <xsl:param name="value"/>
    <xsl:param name="arrayMax" select="$maxCount - 1"/>
    <xsl:if test="$value &lt; $arrayMax">
        <xsl:value-of
select="concat(concat($sequenceName,'_name'),$value)"/>
        <xsl:call-template name="sequenceNameString">
            <xsl:with-param name="value" select="$value + 1"/>
        </xsl:call-template>
    </xsl:if>
</xsl:template>

--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>