Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

& not & !!!

Status
Not open for further replies.

relisys

Programmer
Joined
Mar 6, 2003
Messages
65
Location
GB
Hey guys!

I am processing an xsl file to HTML output. Within this file I hava a call to a servlet through an image tag (takes parameters, produces a graph and outputs it to a jpeg image).

The problem is with the parameter delimiters.

<xsl:element name="input">
<xsl:attribute name="src">
<xsl:text>
TITLECHART=Costs analysis&
LEGEND=TRUE&
SERIE_1=Product A&
SERIE_2=Product B& ............
</xsl:text>
</xsl:attribute>
</xsl:element>

Obviously XSL doesnt like &, so I converted these all to &

The problem now is that the outputted HTML now coverts the & to &, but I need just the single character "&".

Does anyone know a stronger xsl fuction than <xsl:text> to force the output direct into the HTML?


Cheers!


Relisys
 
Having unescaped ampersands in your file means that it's not valid XML. They would need to be sent as escaped entities: [ignore]&[/ignore]. Your XML processor (MSXML 4.0 or similar) will convert it back to a regular "&" when you access the .text property of the node. This is a sure sign that whoever sent it to you built the file up via string concatenation, and not using an XML processor.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
URL encode the ampersands: substitute %26 for them in the URL. XML won't have a problem with that, and whatever reads the URL will be capable of decoding the hex substitution at the appropriate time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top