Subject: Re: [xsl] construct query string From: Joerg Heinicke <joerg.heinicke@xxxxxx> Date: Tue, 07 May 2002 22:20:51 +0200 |
<root> <param1>blah</param1> <param2>blah</param2> <param3>blah</param3> </root>
<xsl:template match="root"> <xsl:variable name="query-string"> <xsl:text>?</xsl:text> <xsl:for-each select="*"> <xsl:value-of select="name()"/> <xsl:text>=</xsl:text> <xsl:value-of select="."/> <xsl:if test="position()!=last()"> <xsl:text>&</xsl:text> </xsl:if> </xsl:for-each> </xsl:variable>
<xsl:text>variable $query-string: </xsl:text> <xsl:value-of select="$query-string"/> </xsl:template>
I'm attempting to construct a query string ("?param1=blah¶m2=blah2", for example) using the values of a series of tags in an XML document. My first intuition was to create an XSL variable, and then send the transformer into a loop which concats each param tag onto that variable. However, after reading the W3C doc, it doesn't seem like that's feasible because you can't "shadow" a XSLT variable in the same template context, and you can't reference the variable you're trying to declare in the variable definition. TIA.
-Zack
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] construct query string, Greg Faron | Thread | RE: [xsl] construct query string, Michael Kay |
Re: [xsl] How to do a subscript fro, J.Pietschmann | Date | Re: [xsl] question about javascript, Thomas B. Passin |
Month |