Reputation: 179
I´m trying to create a choose statement, which detects an processing instruction
<xsl:choose>
<xsl:when test="chapter/descriptive/heading='processing-instruction("xm-replace_text")'">
<xsl:template match="chapter/descriptive/heading"/>
</xsl:when>
<xsl:otherwise>
<xsl:template match="chapter/descriptive/heading">
<fo:block
font-size="16pt"
font-weight="bold"
font-color="red"
space-before="5mm"
space-after="2mm">
<xsl:number
count="chapter | task | diagnosis | taskintervals | tools | lubrication | glossary"
format="1.1"
level="multiple"/>
 
<xsl:value-of select="."/>
</fo:block>
</xsl:template>
</xsl:otherwise>
</xsl:choose>
is it not possible to test for processing instructions like this?
edit: xml input (is the full xml needed?)
...
<chapter infoclass-1="description" prodclass-1="setup">
<descriptive prodclass-1="setup" infoclass-1="intro">
<heading><?xm-replace_text Themenangabe in Form einer Überschrift ?></heading>
...
Upvotes: 0
Views: 506
Reputation: 167716
No, a node test for a processing instruction is done literally e.g.
<xsl:template match="processing-instruction('xm-replace_text')">...</xsl:template>
would match a pi <?xm-replace_text ...?>
.
With your example XML assuming you are trying to match the heading
element containing that particular processing instruction then use
<xsl:template match="chapter/descriptive/heading[processing-instruction('xm-replace_text')]">...</xsl:template>
or
<xsl:template match="chapter/descriptive/heading/processing-instruction('xm-replace_text')">...</xsl:template>
if you want to match the processing instruction itself.
Upvotes: 3