HTML parameters and Ampersands

Subject: HTML parameters and Ampersands
From: David_Benua@xxxxxxxxxxxxxx
Date: Tue, 3 Oct 2000 23:22:02 -0400
I'm generating HTML on the server with XT, and I've run into what I think should
be a common situation.

I want to build a link in my HTML page that passes multiple parameters: <a
href="baseurl.htm?param1=1&param2=2">Label Text</a>

My XML (much simplified) looks like this:

<LinkList>
     <Link param1="1" param2="2">Label</Link>
     <Link param1="10" param2="20">Label2</Link>
</LinkList>

The problem is getting the Ampersands to come out without escaping. If the XSL
is like this: (ignoring the whitespacing issues for clarity)

<xsl:for-each select="/*/Link">
     <a>
     <xsl:attribute name="href">
          baseurl.htm?param1=
          <xsl:value-of select="@param1"/>
          &amp;param2=
          <xsl:value-of select="@param2"/>
                </xsl:attribute>
     <xsl:value-of select=".">
     </a>
</xsl:for-each>

leads to output like this:

<a href="baseurl.htm?param1=1&amp;param2=2">Label</a>

which is close, but not quite what I need.  I've also tried:

<xsl:for-each select="/*/Link">
     <a>
     <xsl:attribute name="href">
          baseurl.htm?param1=
          <xsl:value-of select="@param1"/>
          <text disable-output-escaping="yes">&amp;param2=</text>
          <xsl:value-of select="@param2"/>
                </xsl:attribute>
     <xsl:value-of select=".">
     </a>
</xsl:for-each>

but this gets an error message about "illegal use of disable-output-escaping"

Do any of you gurus out there have any other suggestions?

Thanks

Dave




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread