Re: [xsl] Using saxon:parse on processing instructions

Subject: Re: [xsl] Using saxon:parse on processing instructions
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 18 Dec 2017 22:13:22 -0000
On 18.12.2017 21:18, Spencer Tickner spencertickner@xxxxxxxxx wrote:
Hello and thanks in advance for the help. I'm scratching my head on trying to convert a string of serialized xml in a processing instruction back into XML.

I'm restricted to XSLT 2.0 and am using Saxon 9.1. When I treat the simply copy and past the xml into the stylesheet everything works (see variable $s2), but when breaking the string out of the processing instruction the elements remain serialized:


<?xml version="1.0"?>
<root xmlns:bcl="http://bcl";>
<?pi a="&lt;bcl:e&gt;Test&lt;/bcl:e&gt;" ?>

A PI does not contain parsed character data so your data is double escaped.


<xsl:template match="processing-instruction('pi')">
<root xmlns:bcl="";><xsl:value-of select="saxon:get-pseudo-attribute('a')" disable-output-escaping="yes"/></root>

work with your version of Saxon?

With Saxon 9.7 PE that gives

<root xmlns:bcl="";><bcl:e>Test</bcl:e></root>

Current Thread