I have several stylesheets and templates, and I’d like to add some behaviour to all of them.
Let’s say something like that :
<xsl:template match="*" priority='10'>
<xsl:apply-templates select="." mode="someFunStuffsToDo"/>
<xsl:next-match/>
</xsl:template>
But, as i need some generic templates, i have issues with params because I don’t know all the different types of param I could have.
Is there any ‘easy’ way to say something like that :
<xsl:template match="*" priority='10'>
<xsl:param select="All the params you get"/>
<xsl:apply-templates select="." mode="someFunStuffsToDo">
<xsl:with-param select="All the params you got"/>
</xsl:apply-templates>
<xsl:next-match/>
</xsl:template>
I could imagine some solution based on generic param which would contain nodes of params but I’d need to rewrite most of my actual templates to switch different specifics params declaration for the generic one…
EDIT :
Ok, I think I just find a solution just before posting my question :
Tunnel parameters.
Is that working for my purpose as I understand it, i mean
<xsl:template match="*" priority='10'>
<xsl:apply-templates select="." mode="someFunStuffsToDo"/>
<xsl:next-match/>
</xsl:template>
will work if i just set my parameters before and after with the attribute tunnel=’yes’ ?
(I haven’t tested yet and shame on me, but i assume that next-match will preserve the current mode)
Yes,
tunnelparameters help, you however need to make sure your passing code and your receiving templates have the<xsl:with-param name="foo" tunnel="yes" select="bar"/>respectively<xsl:param name="foo" tunnel="yes"/>. But any templates in between, like the one you have, will then not need awith-param.