Subject: Re: [xsl] [xslt 2.0] Difference betwen functions and templates From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Thu, 19 Jul 2007 09:42:32 +0100 |
6. If you want polymorphism (partially, only nr of arguments) you must use a function
You can use import precedence with named templates to get single polymorphism eg:
<xsl:import href="common.xslt"/> <xsl:template match="/"> <xsl:call-template name="commonTemplate"/> </xsl:template>
<xsl:template name="commonTemplate"> <xsl:call-template name="poly"/> </xsl:template>
The output is "Specific" because the named template "poly" in the specific stylesheet has a higher import precedence than that in the common stylesheet.
You can make the poly template in common pseudo-abstract by doing something like:
<xsl:template name="poly"> <xsl:message terminate="yes" select="'This stylesheet must be imported by another stylesheet and cannot be run on its own...'"/>
cheers andrew
-- http://andrewjwelch.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] [xslt 2.0] Difference bet, Abel Braaksma | Thread | Re: [xsl] [xslt 2.0] Difference bet, Abel Braaksma (onlin |
RE: [xsl] javascript result in xsl , Michael Kay | Date | Re: [xsl] [xslt 2.0] Local function, Andrew Welch |
Month |