xsl-list
[Top] [All Lists]

RE: Fwd: Parsing Entities

2006-01-10 05:49:15

I have an XML document that has some XML mark-up that is stored as
entities so I have something like:

<letter_text>&lt;p&gt;Some random letter text 
:(.&lt;/p&gt;&lt;p&gt;Will this work?&lt;/p&gt;</letter_text>

Well, to be pedantic, it isn't markup; the only reason it's been entitized
is to tell the world that it isn't markup; but we know what you mean.

Now the encoded data should be valid XHTML fragments (though if I was
parsing it as a root node I would expect there would be multiple roots
causing issues) which I would like to use as XHTML in my result
document.

I've looked at saxon:parse
(http://www.saxonica.com/documentation/extensions/functions/pa
rse.html)
though that seems specific to CDATA and expects a single root node XML
document.


saxon:parse will do the job just fine. You need to wrap it in an element to
make it well-formed:

select="saxon:parse(concat('&lt;e&gt;', letter_text,
'&lt;/e&gt;'))/e/child::node()"

should do the trick.

Michael Kay
http://www.saxonica.com/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>