This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Converting markup to non-markup
- From: Mike Brown <mike at skew dot org>
- To: xsl-list at lists dot mulberrytech dot com
- Cc: "'XSL-List at lists dot mulberrytech dot com'" <XSL-List at lists dot mulberrytech dot com>
- Date: Thu, 12 Sep 2002 07:50:08 -0600 (MDT)
- Subject: Re: [xsl] Converting markup to non-markup
- Reply-to: xsl-list at lists dot mulberrytech dot com
Lars Eskildsen wrote:
> I want to be able to convert an XML snippet like:
>
> <CONV_TAG>
> <TAG1 ATTR1="VAL1">Statement: 4 < 5</TAG1>
> <CONV_TAG>
>
> to this XML code:
>
> <CONVERTED_TAG>
> <TAG1 ATTR1="VAL1">Statement: 4 &lt; 5</TAG1>
> </CONVERTED_TAG>
Have a look at http://www.xmlportfolio.com/xml-to-string/
Note that it is a FAQ on this list that converting the output back into
a node-set or copying it to output without escaping, can be quite difficult.
> The problem is i want to convert standard entities inside non-markup content.
>
> < to <lt;
> > to >gt;
> & to &amp;
I don't think that's really what you meant. (<lt; should be &lt;,
right?) Regardless, you must understand that this in your XML, in the content
of an element...
Statement: 4 < 5
...is reported by an XML parser (to the XSLT processor) as the character data
Statement: 4 < 5
You have no access to the lexical details like entity references and character
references, just like you have no access to the fact that attribute values
might be quoted with " in some cases and ' in others. (Another FAQ)
- Mike
____________________________________________________________________________
mike j. brown | xml/xslt: http://skew.org/xml/
denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list