Using <with-param> in <xsl:apply-templates> (and not in <xsl:call-templates/>)
Posted: Thu Jan 23, 2020 12:43 am
Hello,
I am transforming an XML-TEI document and want to pass on some parameters. It works in <xsl:call-template>, but not in <xsl:apply-templates/> with a @mode.
Oxygen version: <oXygen/> XML Editor 21.1, build 2019120214
Saxon HE 9.8.0.12
the following templates do not
The template works so far that <hi/> elements are replaced, but the parameters are not passed on, and instead of a copy-of $p, I get only
If I have an <xsl:call-template/> with parameters,
I have the right results
Is there a mistake or is it a bug?
I am transforming an XML-TEI document and want to pass on some parameters. It works in <xsl:call-template>, but not in <xsl:apply-templates/> with a @mode.
Oxygen version: <oXygen/> XML Editor 21.1, build 2019120214
Saxon HE 9.8.0.12
the following templates do not
Code: Select all
<xsl:template match="p" mode="add-facs">
<xsl:variable name="p" select="."/>
<xsl:variable name="coord" select="someSelection"/>
<<xsl:choose>
<xsl:when test="pb">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates mode="add-facs">
<xsl:with-param name="p" select="$p"></xsl:with-param>
<xsl:with-param name="coord-toBe-Used" select="$coord"></xsl:with-param>
</xsl:apply-templates>
</xsl:copy>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
<xsl:template match="hi" mode="add-facs">
<xsl:param name="p"></xsl:param>
<xsl:param name="coord"></xsl:param>
<testElement>
<xsl:copy-of select="$p"></xsl:copy-of>
<xsl:copy-of select="$coord-toBe-Used"></xsl:copy-of>
</testElement>
</xsl:template>
Code: Select all
<testElement xmlns="" xmlns:tei="http://www.tei-c.org/ns/1.0"> </testElement >
Code: Select all
<xsl:template match="p" mode="add-facs">
<xsl:variable name="p" select="."/>
<xsl:choose>
<xsl:when test="pb">
<xsl:variable name="coord-toBeUsed" select="someSelection"/>
<xsl:copy>
<xsl:call-template name="add-facs">
<xsl:with-param name="p" select="$p"></xsl:with-param>
<xsl:with-param name="coord" select="$coord"></xsl:with-param>
</xsl:call-template>
</xsl:copy>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
<xsl:template name="add-facs">
<xsl:param name="p"></xsl:param>
<xsl:param name="coord-toBe-Used"></xsl:param>
<testElement>
<xsl:copy-of select="$p"></xsl:copy-of>
<xsl:copy-of select="$coord-toBe-Used"></xsl:copy-of>
</testElement>
</xsl:template>
Code: Select all
<testElement xmlns="" xmlns:tei="http://www.tei-c.org/ns/1.0">
<p xmlns="http://www.tei-c.org/ns/1.0" part="N">
<pb n="4r" facs="#BnF_fr_1_zone1"/> [...] </p>
[someSelection]
</testElement>