Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Escape caracters

From: "SMITH Neil" <neil.smith@-------->
To:
Date: 6/1/2004 2:49:00 PM
> > From: Passin, Tom [mailto:tpassin@xxxxxxxxxxxx] 
>  
> > 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

Hi guys!
Hope you had a nice week-end!!!
I tried to take the meta stuff out and only put an xsl:output element, and I now have something like this in my xsl:

<?xml version="1.0" encoding=" ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output 
                      method="html"
                      encoding="ISO-8859-1"/>
                      
<xsl:template match="/">

<html>
<body>

<xsl:apply-templates select=".//RR_row"/>

</body>
</html>	
</xsl:template>

Which generates this HTML file

<html><body><p><i><b>AEBI PHILIPP, Assoziierte(r) Professor(in)</b></i></p><p>Festk&#xF6;rperphysik</p>		<p />
		<p style="margin-left:36.0pt"><i>Publications</i></p><p style="margin-left:72.0pt">A. Z&#xFC;ttel, Ch. N&#xFC;tzenadel, P. Sudan, Ph. Mauron, Ch. Emmenegger, S. Rentsch, L. Schlapbach, A. Weidenkaff and T. Kiyobayashi, "Hydrogen sorption by carbon nanotubes and other carbon nanostructures",
J. Alloys and Comp. 330-332, 676 (2002)</p><p style="margin-left:72.0pt">L.O. Nilsson, O. Gr&#xF6;ning, P. Gr&#xF6;ning and L. Schlapbach
Collective emission degradation behavior of carbon nanotube thin film electron emitters, Appl. Phys. Lett. 79, 1036 (2001)</p><p style="margin-left:72.0pt">O. Gr&#xF6;ning, L.O. Nilsson, P. Gr&#xF6;ning and L. Schlapbach
Properties and characterization of CVD diamond field emitters
Solid State Electronics 45, 929(2001)</p>


Does this look better?

And about the double escaping, the problem is that these are saved as is (&#8220;) in the database (via a web application). So the problem seems not to be with the transformation... But I still don't understand why these 'caracters' are displayed correctly while querying the data directly from the web application, and not while displaying the html generated from xml in a browser.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent