RE: [xsl] Escape caracters

Subject: RE: [xsl] Escape caracters
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Fri, 28 May 2004 11:55:38 -0400
> From: SMITH Neil [mailto:neil.smith@xxxxxxxx] 
> This is the XSL
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> 
> <xsl:template match="/">
> 
> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; 
> charset=UTF-8"/> <html> <body>
> 
> <xsl:apply-templates select=".//RR_row"/>
> 
> </body>
> </html>	
> </xsl:template>
> 
> etc...
> 

As David Carlisle has just posted, this produces invalid HTML.  Also, do
you intend to be producing *XHTML* or *HTML*?  You are doing neither
right now.

To expand on what David said about doubled escaping, he means that the
ampersand in the character references is itself escaped with & a m p ;.
Thus the things that look like character references are only text, and
the browser shows them just as the output file specifies.

Assuming that you want to generate real HTML, you do not have to put
your own meta element in, the processor will do it if you simply use an
xsl:output element to say what the encoding is and that you want html
output.  Normally, the processor wouuld create html by default when it
notices the html element, but in this case, you start with a meta
element, and that apparently has prevented the processor from realizing
what you want.  

The only reason you are getting anything viewable in the browser is
because browsers are so very tolerant of junk.

Cheers,

Tom P

Current Thread