Subject: RE: [xsl] [xslt 2.0] Difference betwen functions and templates From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Sat, 21 Jul 2007 11:50:40 +0100 |
> Now the questions is, is xsl:template name= ... > able to do something, which xsl:function cannot do? Depends what you count as "able to do something". For example, a named template can declare default values for parameters. Does that count? > > Please consider the below example: > ... > > <xsl:function name="xx:dummy-func" as="node()+"> > <dummy-content/> > </xsl:function> > > <xsl:template name="dummy-template"> > <dummy-content/> > </xsl:template> > > I am calling a named template, using xsl:call-template. The > output of this stylesheet is: > > <?xml version="1.0" encoding="UTF-8"?> > <result xmlns:xx="http://dummy-ns"> > <dummy-content/> > </result> > > Can we do a similar thing using xsl:function? Yes, you can: <xsl:template match="/"> <result> <xsl:sequence select="xx:dummy-func()"/> </result> </xsl:template> Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] [xslt 2.0] Difference bet, Mukul Gandhi | Thread | Re: [xsl] [xslt 2.0] Difference bet, Mukul Gandhi |
RE: [xsl] Finding the ID attribute , Michael Kay | Date | RE: [xsl] Group consecutive element, Kevin Bird |
Month |