In my XSLT, I have a variable which contains a string. This string contains a fragment of XML. This is coming in programmatically, but its the equivalent of this:
<xsl:variable name="xmlfrag" select="'<foo>this <bar>is</bar> it</foo>'"/>
Is there a way to parse this XML and add it to the output? We're using SAXON for Java.
Use the saxon:parse()
extension function.
UPDATE: Since XPath/XSLT 3.0 one can use the standard XPath 3.0 functions parse-xml
and parse-xml-fragment
.