Project

Profile

Help

character map ignored if external Emitter

Added by Anonymous over 19 years ago

Legacy ID: #2953858 Legacy Poster: Daniel Chaffiol (vonc)

Hello, It seems to be impossible to define a character map for an output already using its own Emitter: Something like <xsl:output method="xyz:MyOwnEmitter" indent="yes" encoding="ISO-8859-1" use-character-maps="mydoe" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" /> <xsl:character-map name="mydoe"> <xsl:output-character character="&#60;" string="&lt;" /> <xsl:output-character character="&#62;" string="&gt;" /> </xsl:character-map> The character-map will be ignored(in saxon 8.0 as well as 8.2): The net.sf.saxon.event.ResultWrapper utility class wich delivers an Receiver does set up a characterMapExpander (ProxyReceiver) to various other Receiver (UncommittedEmitter, HTMLEmitter, XMLEmitter, XHTMLEmitter)... but when it comes to an external-defined Emitter, it only calls Emitter.makeEmitter()... and that's it! Why ? How can we set up the characterMapExpander (ProxyReceiver) with the proper map ? That map is only available at an early stage of the Transform process, when the Controller builds it through the Executable object. That 'Executable' is no longer available to Receiver when they are activated, meaning a hand-made Emitter can no longer access (and auto-setup) its own characterMapExpander. Is there any other way than to modify the getReceiver() method of ResultWrapper ? Best regards


Replies (2)

RE: character map ignored if external Emitter - Added by Anonymous over 19 years ago

Legacy ID: #2962190 Legacy Poster: Michael Kay (mhkay)

The design is like this deliberately (which doesn't necessarily mean it's right for everyone). If you supply your own Emitter, the assumption is that you want to do serialization yourself, and that means the whole of serialization. Character maps are part of serialization, so they don't happen automatically if you supply your own Emitter. (They also don't happen if you direct the transformation output to a SAXResult or DOMResult, for the same reasons). I agree that the character map should be available to a user-written serializer, just as the other output properties are. I'll have a think about how best to achieve this. Probably the simplest and most versatile solution is for the PipelineConfiguration object to contain a reference to the Controller, and for the code to instantiate a CharacterMapExpander to become a method offered by the Controller. Michael Kay

RE: character map ignored if external Emitter - Added by Anonymous over 19 years ago

Legacy ID: #2962449 Legacy Poster: Daniel Chaffiol (vonc)

Hi Michael, Thank you for your answer. I have no problem with the current design of ResultWrapper. I will wait for a future version of saxon with a way to get the character map for an Emitter. In the meantime, I will go on with my very own version of saxon ;)

    (1-2/2)

    Please register to reply