Questions about elements and functions in xsl

Discussion in 'XML' started by Mikael Petterson, Sep 20, 2003.

  1. Hi,

    Question 1:

    When I call the template from within the template will the params
    str and u-str values be overridden? That is

    str equal to select="substring($str,2)" and
    u-str equal to select="substring($u-str,2)"

    ---------------------------------------------------

    <xsl:template name="Camel2Underscore">
    <xsl:param name="str"/>
    <xsl:param name="u-str"
    select="translate($str,$ucase,'||||||||||||||||||||||||||')"/>
    <xsl:choose>
    <xsl:when test="substring($u-str,1,1) = '|'">
    <xsl:text>_</xsl:text>
    <xsl:value-of select="substring($str,1,1)"/>
    <xsl:call-template name="Camel2Underscore">
    <xsl:with-param name="str" select="substring($str,2)"/>
    <xsl:with-param name="u-str" select="substring($u-str,2)"/>
    </xsl:call-template>
    ..............

    </xsl:template>

    Question 2:

    substring($str,2) is this the same as substring starting at 2 and the rest?

    I appreciate this forum very much :)

    //Mikael
    Mikael Petterson, Sep 20, 2003
    #1
    1. Advertising

  2. Yes to both questions.

    =====
    Cheers,

    Dimitre Novatchev.
    http://fxsl.sourceforge.net/ -- the home of FXSL



    "Mikael Petterson" <> wrote in message
    news:aY_ab.5434$P51.8232@amstwist00...
    > Hi,
    >
    > Question 1:
    >
    > When I call the template from within the template will the params
    > str and u-str values be overridden? That is
    >
    > str equal to select="substring($str,2)" and
    > u-str equal to select="substring($u-str,2)"
    >
    > ---------------------------------------------------
    >
    > <xsl:template name="Camel2Underscore">
    > <xsl:param name="str"/>
    > <xsl:param name="u-str"
    > select="translate($str,$ucase,'||||||||||||||||||||||||||')"/>
    > <xsl:choose>
    > <xsl:when test="substring($u-str,1,1) = '|'">
    > <xsl:text>_</xsl:text>
    > <xsl:value-of select="substring($str,1,1)"/>
    > <xsl:call-template name="Camel2Underscore">
    > <xsl:with-param name="str" select="substring($str,2)"/>
    > <xsl:with-param name="u-str" select="substring($u-str,2)"/>
    > </xsl:call-template>
    > .............
    >
    > </xsl:template>
    >
    > Question 2:
    >
    > substring($str,2) is this the same as substring starting at 2 and the

    rest?
    >
    > I appreciate this forum very much :)
    >
    > //Mikael
    >
    Dimitre Novatchev, Sep 20, 2003
    #2
    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. Karsten Weinert
    Replies:
    3
    Views:
    984
    Karsten Weinert
    Jul 5, 2004
  2. Vijay singh
    Replies:
    1
    Views:
    425
    Martin Honnen
    Nov 4, 2004
  3. Replies:
    1
    Views:
    3,568
    A. Bolmarcich
    May 27, 2005
  4. Rob Smegma
    Replies:
    1
    Views:
    1,788
    shaun
    Sep 26, 2005
  5. Xiangliang Meng
    Replies:
    1
    Views:
    1,570
    Victor Bazarov
    Jun 21, 2004
Loading...

Share This Page