Altova Mailing List Archives

[xsl] Re: No Subject [variable timing problem]

From: Peter Davis <pdavis152@--------->
Date: 1/31/2002 4:18:00 PM
Although this looks like a bug in your processor, assuming it is not caused 
by something else such as a bug in the encode template, you might try nesting 
the <xsl:call-template> calls:

<xsl:variable name="value1">
  <xsl:call-template name="encode">
    <xsl:with-param name="inString">
      <xsl:call-template name="encode">
        <xsl:with-param name="inString" select="string(.)"/>
        <xsl:with-param name="oldChars" select="'%'"/>
        <xsl:with-param name="newChars" select="'%25'"/>
    <xsl:with-param name="oldChars" select="' '"/>
    <xsl:with-param name="newChars" select="'%20'"/>

This should eliminate the need for having 2 different variables.  You could 
also replace the <xsl:value-of select="$value2"/> call below with the first 
<xsl:call-template> and eliminate the need for all the variables.

On Wednesday 30 January 2002 06:59, Jay Burgess wrote:
> (Since my previous post didn't get any responses, I'm trying again, but
> this time stating my problem purely in terms of XSL.)
> Below is a simple encode template for name/value pairs in the query string
> of a URL.  Is there a better way to do this?  The reason I'm asking is that
> it doesn't always work, and in the cases it fails, it appears like the
> "value2" variable is trying to initialize before "value1" is fully defined
> (timing problem?).
> <xsl:template name="param">
>      <xsl:variable name="value1">
>          <xsl:call-template name="encode">
>              <xsl:with-param name="inString" select="string(.)"/>
>              <xsl:with-param name="oldChars" select="'%'"/>
>              <xsl:with-param name="newChars" select="'%25'"/>
>          </xsl:call-template>
>      </xsl:variable>
>      <xsl:variable name="value2">
>          <xsl:call-template name="encode">
>              <xsl:with-param name="inString" select="string($value1)"/>
>              <xsl:with-param name="oldChars" select="' '"/>
>              <xsl:with-param name="newChars" select="'%20'"/>
>          </xsl:call-template>
>      </xsl:variable>
>      <xsl:text>"&#38;</xsl:text><xsl:value-of
> select="@name"/><xsl:text>="</xsl:text><xsl:value-of select="$value2"/>
> </xsl:template>
> Thanks.
> Jay
>  XSL-List info and archive:

Peter Davis
Show business is just like high school, except you get paid.
		-- Martin Mull

 XSL-List info and archive:


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.