[jdom-interest]   not getting converted to
Jason Hunter
jhunter at xquery.com
Thu Apr 22 14:18:04 PDT 2004
The output you see contains the direct UTF-8 character for a
non-breaking space. It shows up like a funny character because the
environment in which you're viewing the file probably isn't UTF-8 aware.
Semantically though the files are identical. The JDOM one uses one
char where the others use six. If you want ASCII encoding, set the
outputter to use ASCII. It'll then automatically encode chars that
can't be represented within ASCII. You can also just set an escape
strategy on the outputter directly if you want UTF-8 but want to encode
characters that wouldn't ordinarily need to be encoded.
-jh-
Robert Taylor wrote:
> Greetings, I'm using JDOMBeta10 and am trying to transform an XML document into an HTML document.
> I've chosen Xalan-Java v2.6.0 for transformation and have set the system property
> javax.xml.transform.TransformerFactory with org.apache.xalan.processor.TransformerFactoryImpl as
> discussed here:
>
> http://www.jdom.org/docs/apidocs/org/jdom/transform/XSLTransformer.html
>
> based on this documentation:
>
> http://www.dpawson.co.uk/xsl/sect2/nbsp.html#d6353e246
>
> it appears that there is an encoding issue.
>
> I can use the same xml document and style sheet with "pure" Xalan classes
> and the document is transformed as expected.
>
> XML:
> <?xml version="1.0"?>
> <data>123456</data>
>
> XSL:
>
> <?xml version="1.0" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="html" indent="yes"/>
>
> <xsl:template match="/">
> <html>
> <head></head>
> <body>
> <xsl:apply-templates/>
> </body>
> </html>
> </xsl:template>
>
> <xsl:template match="data">
> This is some text  <xsl:value-of select="."/>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> JDOM output:
> <?xml version="1.0" encoding="UTF-8"?>
> <html><head /><body>
> This is some text 123456</body></html>
>
> Xalan output:
> <html>
> <head>
> <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
> </head>
> <body>
> This is some text 123456</body>
> </html>
>
> Any ideas?
>
> robert
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
>
More information about the jdom-interest
mailing list