If you have control over the original XML you can use
<!CDATA[[ & or & ]]>
--- andrew welch <andrew.j.welch@xxxxxxxxx> wrote:
> On 9/26/06, Jeff Sese <jsese@xxxxxxxxxxxx> wrote:
> > 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
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|