xsl-list
[Top] [All Lists]

Re: [xsl] In XSLT 3.0, should the "document" function be available in xsl:evaluate?

2017-01-16 08:55:36
Have you also tried the XPath function doc() ?

On Mon, Jan 16, 2017 at 6:35 AM, Martin Honnen 
martin(_dot_)honnen(_at_)gmx(_dot_)de
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Both the latest internal draft of the XSLT 3.0 spec in
https://www.w3.org/XML/Group/qtspecs/specifications/xslt-30/html/#dynamic-xpath
as well as the official https://www.w3.org/TR/xslt-30/#element-evaluate say
about the function signatures in the context of dynamic XPath evaluation
using xsl:evaluate: "Note that this set deliberately excludes XSLT-defined
functions in the standard function namespace".

Based on that I would expect the XSLT "document" function not to be
available in dynamic XPath evaluation using xsl:evaluate. So I wrote a test
case doing

<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:fn="http://www.w3.org/2005/xpath-functions";
        xmlns:math="http://www.w3.org/2005/xpath-functions/math";
        xmlns:array="http://www.w3.org/2005/xpath-functions/array";
        xmlns:map="http://www.w3.org/2005/xpath-functions/map";
        exclude-result-prefixes="array fn map math xs">

        <xsl:output method="xml"/>

        <xsl:template name="main" match="/">
                <xsl:sequence
                        select="
                        let $f := function-lookup(xs:QName('fn:document'),
1)
                        return
                        if (exists($f)) then
                        $f('')
                        else
                        'not found'"/>
                <xsl:variable name="path" as="xs:string">
                        let $f := function-lookup(xs:QName('fn:document'),
1)
                        return
                        if (exists($f)) then
                        $f('')
                        else
                        'not found'</xsl:variable>
                <xsl:evaluate xpath="$path"/>
        </xsl:template>

</xsl:stylesheet>

and expected that to return the stylesheet code for the xsl:sequence and
'not found' for the xsl:evaluate.

However, only Exselt gives me that result, both Saxon 9.7 EE as well as
Altova XMLSpy return the stylesheet code twice which seems to indicate they
make the 'document' function available to xsl:evaluate. Isn't that a bug? Or
does the spec need to allow it if an implementer wants to go beyond pure
XPath support?




-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>