how to test for matching PI in XSLT

I am trying to match a specific PI in my XML and then do stuff.

I want match when my data has <?abc createindex?>
There will be other similar PIs, such as <?abc other?>, <?abc section?> etc - but I want to just pass them through.

My test file contains this
 <?xml version="1.0"?>
<file>
	<header>heading A</header>
	<?abc createindex?>
	<para>aaa bbb <?abc other?></para>
</file>

Open in new window


and my XSLT is currently this
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>
		<xsl:template match="processing-instruction('abc createindex')">
				<index>index data goes here</index>
		</xsl:template>
</xsl:stylesheet>

Open in new window


I can match on 'abc' but want to somehow test the rest of the PI in order to only match the type of 'abc' that I am interested in.
Can anyone help me in matching that specific PI?

Thanks.
LVL 1
LetterpartAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
<xsl:template match="processing-instruction('abc')[normalize-space() = 'createindex']">

the part before the space is the  name() of the PI
the remainder is the text()

note that the name() should be  a valid QName

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LetterpartAuthor Commented:
Excellent, thanks very much Geert.
Gertone (Geert Bormans)Information ArchitectCommented:
welcome
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.