W3C home > Mailing lists > Public > public-qt-comments@w3.org > October 2016

[Bug 29939] New: [FO31] fn:transform stylesheet-base-uri options

From: <bugzilla@jessica.w3.org>
Date: Tue, 18 Oct 2016 08:00:02 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29939-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29939

            Bug ID: 29939
           Summary: [FO31] fn:transform stylesheet-base-uri options
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators 3.1
          Assignee: mike@saxonica.com
          Reporter: tim@cbcl.co.uk
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

I'm rather confused by the stylesheet-base-uri option.

(CASE 1) In combination with "stylesheet-text", it makes sense.  Since the
stylesheet-text is a string, there is no associated base URI.  The text can be
parsed as if by a call to parse-xml with a static context base URI of
stylesheet-base-uri.


(CASE 2) In combination with "stylesheet-node" it is confusing.  Take as
example fn-transform-19.

    <test-case name="fn-transform-19">
        <description>Transform using options stylesheet-node and
stylesheet-base-uri</description>
        <created by="Debbie Lockett" on="2015-03-11"/>
        <dependency type="spec" value="XQ31+"/>
        <dependency type="feature" value="fn-transform-XSLT" satisfied="true"
/>
        <test><![CDATA[
            declare variable $xsl as xs:string :="<xsl:stylesheet version='2.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
                    <xsl:template name='main'>
                    <x><xsl:value-of select='static-base-uri()'/></x>
                    </xsl:template>
                    </xsl:stylesheet>";
            fn:transform(map {"stylesheet-node" : parse-xml($xsl),
"initial-template" : QName('','main'), "stylesheet-base-uri":
"http://www.example.com"})?output
            ]]></test>
        <result>
            <assert>$result/x = 'http://www.example.com'</assert>
        </result>
    </test-case>

The static base URI property from the static context of the fn:parse-xml
function call is used both as the base URI used by the XML parser to resolve
relative entity references within the document, and as the base URI of the
document node that is returned.  Let's say that's urn:foo.

At the <xsl:value-of /> element, the URI will still be urn:foo.  Sicne the
XPath expression static-base-uri() executes with a static context whose base
URI is the base URI of the containing element, the expected result should be
urn:foo.  The "stylesheet-base-uri" option can't have an effect.

(CASE 3) Consider "stylesheet-base-uri" In combination with
"stylesheet-location".  Suppose the implementation uses the stylesheet-location
to load an XDM instance as if by a call to fn:doc.  The base URI of the
document node of the loaded instance would be that of the stylesheet-location. 
This is similar to CASE 1 and "stylesheet-base-uri" would have no effect. 
Suppose instead that the implementation loaded the stylesheet in as if by a
call to unparsed-text, followed by parsing as if by a call to parse-xml.  This
is similar to CASE 2 and "stylesheet-base-uri" would have an effect.

I would expect "stylesheet-base-uri" only to apply in combination with
"stylesheet-text".

It's probably too late in the day, but as an aside, it might have made sense to
give fn:parse-xml an optional base-uri argument.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Tuesday, 18 October 2016 08:00:14 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 18 October 2016 08:00:15 UTC