我想在XSLT中使用处理指令。
逻辑:如果有<?Table Sideturn?>
,则应添加<context:sideturn>
输入:
<table-wrap id="tab_A.1" position="anchor">
<?Table Sideturn?>
<label>Table A.1</label>
<caption/>
<table>
<tbody/>
</table>
</table-wrap
输出应为:
<context:sideturn>
<table/>
</context:sideturn>
尝试的代码:
<xsl:template match="table">
<xsl:choose>
<xsl:when test="preceding-sibling::processing-instruction('Table Sideturn')">
<context:sideturn>
<table/>
</context:sideturn>
</xsl:when>
<xsl:otherwise>
<context:not-sideturn>
<table/>
</context:not-sideturn>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
以上我的xpath运行不正常。我该如何解决?我正在使用XSLT 2.0。
谢谢。