获取具体的处理指令

Get a specific processing instruction

我有以下 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?> 被选中,请告诉我该怎么做。

谢谢

"Here I want to get the processing instruction containing MAIN in it, but i'm unable to know how to get it."

您可以使用以下 XPath 表达式来匹配名为 xpp 且数据包含文本 "MAIN" 的处理指令:

processing-instruction('xpp')[contains(.,'MAIN')]