Reputation: 3351
I've the below 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>
Here I want to get the processing instruction containing MAIN
in it, but i'm unable to know how to get it.
I'm trying the below 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>
running this i'm getting <?xpp FOOT;art6_ft1;1?>
picked, but i want <?xpp MAIN;1;0;0;0;619;0;0?>
to be picked, please let me know how can i do this.
Thanks
Upvotes: 0
Views: 355
Reputation: 89325
"Here I want to get the processing instruction containing MAIN in it, but i'm unable to know how to get it."
You can use the following XPath expression to match processing instruction named xpp
having data contains text "MAIN"
:
processing-instruction('xpp')[contains(.,'MAIN')]
Upvotes: 1