dasch124 / xsl-patternmatcher

experimental pattern matching library for xslt
MIT License
0 stars 0 forks source link

Limit scope to anything but "/" #1

Open skurzinz opened 3 years ago

skurzinz commented 3 years ago

With

<xsl:template match="tei:body"><!-- or anything other than "/" for that matter --> 
        <xsl:apply-templates>
            <xsl:with-param name="patternmatcher.patterns" select="$myPatterns" tunnel="yes"/>
        </xsl:apply-templates>
</xsl:template>

Running pattern-matcher.xsl results in an error:

Beschreibung: The required item type of the first operand of '/' is node(); the supplied value "" is an atomic value. Found while atomizing the first argument of fn:string-join()

It would be great to be able to limit this e.g. to only body, or e.g. avoid nesting tei:rs when there's already an rs wrapping the same partial text node…

skurzinz commented 2 years ago

Locally solved by limiting using a predicate on https://github.com/dasch124/xsl-patternmatcher/blob/9a5150e4e78aa9261544048a2f6c217901d0186a/pattern-matcher.xsl#L161 à la [not(ancestor::tei:teiHeader or ancestor-or-self::tei:rs or ancestor-or-self::tei:date)] -- but it would be nicer to be able to pass another xsl:param there.