[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: [xslt 2.0] Difference betwen functions and templat
On 7/19/07, Abel Braaksma <abel.online@xxxxxxxxx> wrote:
6. If you want polymorphism (partially, only nr of arguments) you must use a function
"Specific.xslt" : <xsl:import href="common.xslt"/> <xsl:template match="/"> <xsl:call-template name="commonTemplate"/> </xsl:template> <xsl:template name="poly">Specfic</xsl:template> and then "Common.xslt" : <xsl:template name="commonTemplate"> <xsl:call-template name="poly"/> </xsl:template> <xsl:template name="poly">Common</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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|