我有下面的XML。
<?xpp /MAIN?>
<?xpp MAIN;1;0;0;0;619;0;0?>
<section>
<title>Introduction</title>
<para>
para<superscript>1</superscript>
<?xpp foot;art6_ft1;suppress?>
<?xpp FOOT;art6_ft1;1?>
<footnote label="1" id="art6_ft1">
<para>
data
</para>
</footnote>
<?xpp /FOOT?>
The data
</para>
</section>在这里,我想获得包含MAIN的处理指令,但是我不知道如何获得它。
我正在尝试下面的XSLT。
<xsl:template match="/">
<html>
<head>
</head>
<body>
<xsl:if test="//footnote">
<xsl:apply-templates select="//processing-instruction('xpp')[not(ancestor::toc)]| //footnote" mode="footnote"/>
</xsl:if>
</body>
</html>
</xsl:template>
.
.
.
.
.
.
.
<xsl:template match="processing-instruction('xpp')" mode="footnote">
<xsl:if test="following::footnote[1][preceding::processing-instruction('xpp')[1] = current()]">
<xsl:variable name="pb" select="."/>
<xsl:processing-instruction name="pb">
<xsl:text>label='</xsl:text>
<xsl:value-of select="$pb"/>
<xsl:text>'</xsl:text>
<xsl:text>?</xsl:text>
</xsl:processing-instruction>
</xsl:if>
</xsl:template>运行这个程序时,我会选择<?xpp FOOT;art6_ft1;1?>,但我希望<?xpp MAIN;1;0;0;0;619;0;0?>被选中,请告诉我如何做到这一点。
谢谢
发布于 2015-10-08 07:36:03
“这里我想得到包含MAIN的处理指令,但是我不知道如何得到它。”
您可以使用以下XPath表达式来匹配名为“具有数据包含文本"MAIN"的数据”的处理指令:
processing-instruction('xpp')[contains(.,'MAIN')]https://stackoverflow.com/questions/33008810
复制相似问题