Processing oxy_delete processing instruction
Posted: Sat Mar 29, 2014 6:01 pm
Hi,
I want to use oxy_delete processing instruction with my XSLT stylesheet.
[Source Document]
[Stylesheet]
This template outputs following message:
Description: [Saxon-PE] author= toshi
Description: [Saxon-PE] timestamp= 20140321T225157+0900
Description: [Saxon-PE] content= <term keyref="KAIKOKU_OPEN"/>
As you can see, '<' , '>' and '"' are doubly escaped in $content.
Are there any ways to restore $content into XML fragment using XSLT stylesheet? I want parse it using parse-xml-fragment() function.
Regards,
Toshihiko Makita
I want to use oxy_delete processing instruction with my XSLT stylesheet.
[Source Document]
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic_v5d_3ly_hn">
<title>Change tracking example</title>
<body>
<p>Mr. Abe's TPP<?oxy_delete author="toshi" timestamp="20140321T225157+0900" content="<term keyref="KAIKOKU_OPEN"/>"?>
<?oxy_insert_start author="toshi" timestamp="20140321T225137+0900"?><term
keyref="KAIKOKU_BREAK"/><?oxy_insert_end?></p>
</body>
</topic>
<?oxy_options track_changes="on"?>
Code: Select all
<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="(.+)" timestamp="(.+)" content="(.+)"'"/>
<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:message select="'author=',$author"/>
<xsl:message select="'timestamp=',$timeStamp"/>
<xsl:message select="'content=',$content"/>
</xsl:template>
Description: [Saxon-PE] author= toshi
Description: [Saxon-PE] timestamp= 20140321T225157+0900
Description: [Saxon-PE] content= <term keyref="KAIKOKU_OPEN"/>
As you can see, '<' , '>' and '"' are doubly escaped in $content.
Are there any ways to restore $content into XML fragment using XSLT stylesheet? I want parse it using parse-xml-fragment() function.
Regards,
Toshihiko Makita