DITAの変更履歴(4)

oXygenのサポートに聞いてみました。すぐにRaduさんから回答が返ってきて、saxon:parseを2回使えばエスケープを元に戻せること!ナルホドそうですね!

次のようなサンプルを作ってみてうまくゆきました。削除された内容で要素が入れ子になっても大丈夫です。

    <xsl:template match="processing-instruction('oxy_delete')" priority="2">
        <xsl:variable name="piText" as="xs:string" select="string(.)"/>
        <xsl:variable name="regX" as="xs:string" select="'author=&quot;(.+)&quot; timestamp=&quot;(.+)&quot; content=&quot;(.+)&quot;'"/>
        <xsl:variable name="author" as="xs:string" select="replace($piText,$regX,'$1')"/>
        <xsl:variable name="timeStamp" as="xs:string" select="replace($piText,$regX,'$2')"/>
        <xsl:variable name="content" as="xs:string" select="replace($piText,$regX,'$3')"/>
        <xsl:variable name="contentRemoveEscaped1" as="document-node()">
            <xsl:document>
                <xsl:text>&lt;root&gt;</xsl:text>
                <xsl:value-of select="$content"/>
                <xsl:text>&lt;/root&gt;</xsl:text>
            </xsl:document>
        </xsl:variable>
        <xsl:variable name="contentRemoveEscaped2" as="document-node()">
            <xsl:document>
                <xsl:text>&lt;root&gt;</xsl:text>
                <xsl:value-of select="saxon:parse($contentRemoveEscaped1)"/>
                <xsl:text>&lt;/root&gt;</xsl:text>
            </xsl:document>
        </xsl:variable>
        <xsl:processing-instruction name="oxy_delete">
            <xsl:text>author="</xsl:text>
            <xsl:value-of select="$author"/>
            <xsl:text>" timestamp="</xsl:text>
            <xsl:value-of select="$timeStamp"/>
        </xsl:processing-instruction>
        <xsl:copy-of select="saxon:parse(string($contentRemoveEscaped2))/*/node()"/>
        <xsl:processing-instruction name="oxy_delete_end"/>
    </xsl:template>

やはり聞くべきところは本家ですね!