How to escape > in XML/XSL

N

Niko

I am trying to pass a piece of XMLthat has escaped characters e.g >
into a new piece of XML. However when I pass it I don't want these
characters escaped and want them to appear in the XML.

Any ideas on how to do this.

TIA
 
M

Mike Brown

I am trying to pass a piece of XMLthat has escaped characters e.g >
into a new piece of XML. However when I pass it I don't want these
characters escaped and want them to appear in the XML.

Any ideas on how to do this.

FAQ.

You're essentially asking for a way to re-parse something that was
designated character data in your XML as if it were actually elements and
other markup. If you want it to be treated as markup, don't put it in your
original XML as character data. Fix the problem at it's source.

If you cannot fix the XML, then check your XSLT processor's docs for an
extension function that can parse an arbitrary string and return a node-set
or result tree fragment. If there isn't one, then write your own. You'll
probably need to wrap the string in a dummy element to ensure it's a
well-formed document entity before you send it to the parser.

In a controlled environment you may be able to rely on the kludgy
disable-output-escaping="yes" on xsl:value-of or xsl:text. It's not
guaranteed to work if the XSLT processor is not in direct control of the
serializer, if any (e.g. the processor may actually output a DOM object,
thus rendering d-o-e ineffective... Netscape/Mozilla comes to mind).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top