xmlxsltxslt-2.0processing-instruction

XSLT-2 xsl:if with processing-instructions


Hej!

I would like to query whether ':' occurs in a processing instruction and only then execute something. Before I only match the oxy_comment_start and would like to refine that. In this case, it doesn't matter to me whether I use an AND or an if function, the main thing is that I get all the processing instructions that are an oxy_comment_start and contain a ':' in the comment.

Has anybody an idea how to acquire that?

this should be ignored:

<?oxy_comment_start author="cln98vq" timestamp="2024" comment="Paratext has G"?>

this should be processed:

<?oxy_comment_start author="cln98vq" timestamp="2024" comment="stultifere: steltifere G"?>                

I have

    <xsl:template match="processing-instruction('oxy_comment_start')">
        <div>
            <xsl:value-of select="replace(., '.*?comment=&quot;(.*?): \w+ [A-H]&quot;.*', '$1')"/>
        </div>
    </xsl:template>

to get all oxy_comment_starts. If I try to add a match="processing-instruction('oxy_comment_start' and ':')" I get an error and <xsl:if processing-instruction('oxy_comment_start')="contains(':')"> gives the error, processing-instructions can't be put in xsl:if.


Solution

  • Using <xsl:template match="processing-instruction('oxy_comment_start')[contains(., ':')]"> is certainly possible.