[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
(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>"&</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: http://www.mulberrytech.com/xsl/xsl-list
From: Jay Burgess <jburgess@xxxxxxxxxxxxxx> Date: Wed, 30 Jan 2002 08:59:52 -0600 |
(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>"&</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: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Pattern: Processing Unwrapped, W. Eliot Kimber | Thread | [xsl] RE: supposed timing problem, Michael Kay |
RE: [xsl] Output , Michael Kay | Date | [xsl] insert an attribute value thr, 林 子芯 |
Month |