Identity Transform with preservation of entities

C

cawoodm

I need an identity XSLT that does not change the incoming XML document.
The trick is that I need the entities to be preserved. My current
transform converts   to the copyright symbol in the output
document.
----------------------
TEST.XML
<?xml version="1.0" encoding="windows-1252"?>
<component>
<content>
<small>© Copyright</small>
</content>
</component>
----------------------

----------------------
TEST.XSL
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput indent="yes" method="xml" encoding="windows-1252"/>
<xsl:template match="/component">
<xsl:copy-of select="content/*"/>
</xsl:template>
</xsl:stylesheet>
 
R

Richard Tobin

I need an identity XSLT that does not change the incoming XML document.
The trick is that I need the entities to be preserved.

Why? they are equivalent as XML documents.
My current
transform converts   to the copyright symbol in the output
document.

That's not technically an entity, it's a character reference.

There's no way to make XSLT not expand character and entity references
when it reads the file. However, if you specify an output encoding of
"ascii", then it will have to output references for all the characters
above 127.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top