saxon:character-representation="hex" doesn't work?

Here should go questions about transforming XML with XSLT and FOP.
sderrick
Posts: 269
Joined: Sat Jul 10, 2010 4:03 pm

saxon:character-representation="hex" doesn't work?

Post by sderrick »

I'm using Saxon PE 9.3, the version that comes with Oxygen 12.1

I have this near the top of my stylesheet

<xsl:output method="xml"
encoding="us-ascii"
saxon:character-representation="hex"/>

every place where I have a unicode char defined using hex like so

<lb n="0"/><seg>&#x00ae;</seg>

it is transmorgrified into this after running the stylesheet

<lb n="0"/><seg>&#174;</seg>

while yes, that is the same character, I use hex values in all my documents and want to keep them that way.

Is Saxon broke?

Scott
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: saxon:character-representation="hex" doesn't work?

Post by george »

I cannot reproduce this, probably you have a wrong namespace for the saxom prefix. Please try the following stylesheet:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
exclude-result-prefixes="xd saxon"
version="2.0" xmlns:saxon="http://saxon.sf.net/">
<xsl:output method="xml"
encoding="us-ascii"
saxon:character-representation="hex"/>
<xsl:template match="/">
<x>
<lb n="0"/><seg>&#x00ae;</seg>
</x>
</xsl:template>
</xsl:stylesheet>
If this works also for you then check that the saxon prefix is bound to the same namespace as in the above sample, that is make sure you have xmlns:saxon="http://saxon.sf.net/".

If you still have problems please post a sample similar with the above that we can use to reproduce the results you get.

Best Regards,
George
George Cristian Bina
sderrick
Posts: 269
Joined: Sat Jul 10, 2010 4:03 pm

Re: saxon:character-representation="hex" doesn't work?

Post by sderrick »

George,

Excellent!

using xmlns:saxon="http://saxon.sf.net/" for the saxon namespace fixed it!

I don't know where I got the address I was using but it was not correct.

thanks,

Scott

george wrote:I cannot reproduce this, probably you have a wrong namespace for the saxom prefix. Please try the following stylesheet:

If this works also for you then check that the saxon prefix is bound to the same namespace as in the above sample, that is make sure you have xmlns:saxon="http://saxon.sf.net/".

Best Regards,
George
Post Reply