Subject: Re: [xsl] Problem with ampersands From: "andrew welch" <andrew.j.welch@xxxxxxxxx> Date: Tue, 26 Sep 2006 09:09:37 +0100 |
Hi,
I have this requirement from a client to retain all the entity references in their xml files after transformation so what i did was collect all the entities in the DTD and then created a character-map for single-character entities. For multi-character ones, i created a used a function to search and replace all occurrences in a text node. My problem is when i use the function and return the value, xslt escapes the ampersand symbol as & and i don't know how i can unescape it without unescaping the real ampersand character.
The client shouldn't care whether the characters are entities or not unless they plan on hand editing the files - once the client parses the XML you give them using an XML parser they won't know whether the characteres were represented on disk as entities, character references or the characters themselves - the information isn't contained in the infoset. XSLT deals with infosets, which is why what you are trying to isn't possible without resorting to d-o-e or extensions.
If you really must deliver XML with the entities in place I would suggest using a placeholder element (eg <entityA/>) to represent it in the output and the post process the result with a suitable language to replace the placeholder elements with the entity references.
cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Problem with ampersands, Jeff Sese | Thread | Re: [xsl] Problem with ampersands, Rashmi Rubdi |
Re: [xsl] Problem with ampersands, Jeff Sese | Date | [xsl] processing text nodes one cha, Marie Bilde Rasmusse |
Month |