xsl-list
[Top] [All Lists]

Re: [xsl] Accessing context from xsl:function body

2007-11-08 01:36:33
If a function could access the context, then it could also change it.
hen referential transparency would be lost.

If you need particular pieces of information from the context (such as
the position, or item), then you could pass them to the function as
paramters.

On 08/11/2007, Mukul Gandhi <gandhi(_dot_)mukul(_at_)gmail(_dot_)com> wrote:
Hi all,
  Could somebody please answer this for me ...

Recently I was solving some problem, where I needed the capability for
the xsl:function body to be able to access the context (the
environment from where the function was called, say a particular XPath
expression).

But the XSLT 2.0 spec states ...
"Within the body of a stylesheet function, the focus is initially
undefined; this means that any attempt to reference the context item,
context position, or context size is a non-recoverable dynamic error.
[XPDY0002]"

Why does XSLT 2.0 language prohibits xsl:function to access the
context information?

On the contrary, the named template can access the context
information. Why is this difference in capability on named template,
and xsl:function?

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?

--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--