Subject: Re: [xsl] Accessing context from xsl:function body From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Thu, 8 Nov 2007 15:22:08 +0530 |
Thanks Mike for the insightful comments ... On Nov 8, 2007 3:17 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote: > > > > Why does XSLT 2.0 language prohibits xsl:function to access > > the context information? > > It makes static analysis and optimization a lot easier if all the parameters > to a function are explicit. Otherwise you find yourself passing information > to a function just in case it needs it. > > Consider last(), which is probably the most extreme case. When using > apply-templates, you don't know statically what templates are going to be > called and you don't know whether they will call last() or not. So the > caller has to do a lot of just-in-case preparation, which will usually be > wasted. > > > > On the contrary, the named template can access the context > > information. Why is this difference in capability on named > > template, and xsl:function? > > History. One was designed with the benefit of hindsight. > > > > Is there any use case, where xsl:function body would really > > need the context information? Is there a merit in the > > argument, to provide this capability to xsl:function? > > > If the function needs the information, it can define it as an explicit > parameter. > > Michael Kay > http://www.saxonica.com/ -- Regards, Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Accessing context from xs, Michael Kay | Thread | Re: [xsl] Accessing context from xs, Wendell Piez |
RE: [xsl] Accessing context from xs, Michael Kay | Date | [xsl] creating elements and hierarc, Andreas Peter |
Month |