C
Collin VanDyck
I have a basic understanding of this, so forgive me if I am overly
simplistic in my explanation of my problem..
I am trying to get a Java/Xalan transform to pass through a numeric
character reference (i.e. ) and it seems to be converting the
character to its UNICODE representation.
Take this source XML document:
<?xml version="1.0" encoding="UTF-8"?>
<sourcexml>
some space separated text
</sourcexml>
And this stylesheet:
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" indent="yes"/>
<xsl:template match="@*|*|text()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I am trying to get it to regurgitate the original document, with the
's intact. Instead I am getting bizarre characters (copied from
windows CMD window):
<?xml version="1.0" encoding="UTF-8"?>
<sourcexml>
someáspaceáseparatedátext
</sourcexml>
Here is how I am doing my transform (java code):
SAXSource in = new SAXSource(new InputSource(new
StringReader(this.xmlDocument)));
// build the out result
StringWriter writer = new StringWriter();
StreamResult out = new StreamResult(writer);
// build the transformer
SAXSource stylesheetIn = new SAXSource(new InputSource(new
StringReader(this.xslStylesheet)));
Transformer transformer =
TransformerFactory.newInstance().newTransformer(stylesheetIn);
// transform the string.
transformer.transform(in,out);
// return the transformation result.
return writer.toString();
Any ideas? Any help would be very appreciated. Thanks
simplistic in my explanation of my problem..
I am trying to get a Java/Xalan transform to pass through a numeric
character reference (i.e. ) and it seems to be converting the
character to its UNICODE representation.
Take this source XML document:
<?xml version="1.0" encoding="UTF-8"?>
<sourcexml>
some space separated text
</sourcexml>
And this stylesheet:
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" indent="yes"/>
<xsl:template match="@*|*|text()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I am trying to get it to regurgitate the original document, with the
's intact. Instead I am getting bizarre characters (copied from
windows CMD window):
<?xml version="1.0" encoding="UTF-8"?>
<sourcexml>
someáspaceáseparatedátext
</sourcexml>
Here is how I am doing my transform (java code):
SAXSource in = new SAXSource(new InputSource(new
StringReader(this.xmlDocument)));
// build the out result
StringWriter writer = new StringWriter();
StreamResult out = new StreamResult(writer);
// build the transformer
SAXSource stylesheetIn = new SAXSource(new InputSource(new
StringReader(this.xslStylesheet)));
Transformer transformer =
TransformerFactory.newInstance().newTransformer(stylesheetIn);
// transform the string.
transformer.transform(in,out);
// return the transformation result.
return writer.toString();
Any ideas? Any help would be very appreciated. Thanks