Parse an XML fragment stored in a string into nodes in XSLT with SAXON for Java
问题 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. 回答1: Use the saxon:parse() extension function . 回答2: The Dimitre solution requires a licensed version of Saxon. Here is another solution that works also with the free