retain unicode characters such as - in xml to xml tra
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 269
- Joined: Sat Jul 10, 2010 4:03 pm
retain unicode characters such as - in xml to xml tra
I have some xml files that I need to run a xsl script on. The xml file has numerous(thousands) of unicode caracters specified. Some in that are in standard ascii and some not.
I added <xsl:output encoding="US-ASCII"/>
to my script which kept all but x002d, that being in the US ascii set.
How can i retain the thousand or so - declarations when I run the script?
Also, when teh script runs the retained unicode charaters are output as decimal instead of hex. Anyway of not having it do that too as I have to go in and search and replace the 15 odd numbers it is munging. Not as important as the first request to retain the - charcter but would be nice.
Scott
I added <xsl:output encoding="US-ASCII"/>
to my script which kept all but x002d, that being in the US ascii set.
How can i retain the thousand or so - declarations when I run the script?
Also, when teh script runs the retained unicode charaters are output as decimal instead of hex. Anyway of not having it do that too as I have to go in and search and replace the 15 odd numbers it is munging. Not as important as the first request to retain the - charcter but would be nice.
Scott
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: retain unicode characters such as - in xml to xml tra
With XSLT 2,0 you can use character maps:
Best Regards,
George
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:character-map name="minus">
<xsl:output-character character="-" string="-"/>
</xsl:character-map>
<xsl:output use-character-maps="minus"/>
<xsl:template match="/">
<result>-</result>
</xsl:template>
</xsl:stylesheet>
George
George Cristian Bina
-
- Posts: 269
- Joined: Sat Jul 10, 2010 4:03 pm
Re: retain unicode characters such as - in xml to xml tra
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:character-map name="minus">
<xsl:output-character character="-" string="-"/>
</xsl:character-map>
<xsl:output use-character-maps="minus"/>
<xsl:template match="/">
<result>-</result>
</xsl:template>
</xsl:stylesheet>
Thats a much better solution George. I will use it! thanks..
Scott
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:character-map name="minus">
<xsl:output-character character="-" string="-"/>
</xsl:character-map>
<xsl:output use-character-maps="minus"/>
<xsl:template match="/">
<result>-</result>
</xsl:template>
</xsl:stylesheet>
Thats a much better solution George. I will use it! thanks..
Scott
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service