Getting & to convert to %26 in URI

Subject: Getting & to convert to %26 in URI
From: drcambron <drcambron@xxxxxxxxxx>
Date: Tue, 21 Nov 2000 12:21:53 -0700
I've been following this list and learning.  I'm now stuck on something.  I
have some XML data I am using with the production released MSXML3 in IE5 to
build a URI in HTML. An ID element in the XML may have '&' chars in it and I
can't seem to find the way to get it properly escaped.  For example the
actual data may look like:

MARK & SCAN

and the XML for the ID element that I send to the browser looks like:

<ID>MARK&#x20;&#x26;&#x20;SCAN</ID>

In the XSL code, I simply try to build the URI as follows (not everything is
here...)

<a>
  <xsl:attribute name="href">
    <xsl:value-of select="$Server"/>?ID=<xsl:value-of select="ID"/>&amp;APP=
etc...
  </xsl:attribute>                  
  <xsl:value-of select="ID"/>
</a> 

I have <xsl:output method="html"/> set, and when I copy the link into the
address field on the browser, I see that the spaces have converted, but not
the & char.  The URI will look like:

http://server?ID=A%20&%20B&APP= etc... with the & still explicity there
hosing my URI.  I'm sure I'm missing something simple.

Thank you in advance for any help.

dan cambron



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


Current Thread