RE: TR/xquery-operators/#func-doc

Thanks for the long explanation Michael.

I'm either still ignorant, or require convincing.

If I use xml:base, how do I read the stylesheet using document()?
E.g. 
 xml:base = the root of this disk,
 my stylesheet is in directory /xsl

What param is passed to document() to retrieve the stylesheet please?


regards DaveP

ps 
with a variable set to either "" or ''
document($var) fails on both saxon and xalan 1.0 processors.

Another mail I think.



> > http://www.w3.org/TR/xslt20/ 16.1 seems to half answer this,
> > or contradict it.
> > 
> > quote. The effect of these rules is that unless XML entities 
> > or xml:base are used, document("") refers to the document 
> > node of the containing stylesheet module. The XML resource 
> > containing the stylesheet module is processed exactly as if 
> > it were any other XML document, for example there is no 
> > special recognition of xsl:text elements, and no special 
> > treatment of comments and processing instructions. unquote.
> > 
> > Impact on users:
> >   If I want to use xml:base, I can't access the filesheet 
> > using document("")?
> > 
> > I find this unacceptable. 
> > Many people utilise data within the stylesheet as a lookup.
> >
> 
> I think you are misunderstanding the way this worked in XSLT 
> 1.0. There was
> never any special handling of document(""). It worked because 
> "" is a legal
> relative URI, which was resolved relative to the base URI of 
> the stylesheet,
> and would therefore retrieve the XML entity containing the call on
> document(""). This was a happy consequence of the 
> specification, which was
> mentioned in a note, though the note unfortunately failed to 
> mention that it
> only worked if the call was contained in the document entity of the
> stylesheet module. In XSLT 2.0 we now support xml:base; 
> xml:base changes the
> meanings of relative URIs in a document, including the meaning of the
> relative URI "". It's reasonable that the spec should warn 
> you of this.
> > 
> > 
> > 2. Is there another out of sync issue here?
> > xslt 2 says:
> > 
> > document($uri-sequence as item()*, $base-node as node()) as node()*
> > 
> > which is missing from the former reference?
> > 
> 
> By "the former reference" do you mean the fn:doc() function 
> in Functions and
> Operators? This doesn't have a second argument, because it 
> doesn't need one.
> There is now a function fn:resolve-uri() that allows you to 
> resolve relative
> URIs against absolute URIs in any way you choose; this is far 
> more flexible
> than the limited capabilities of the old document() function, 
> so there is no
> need to carry these capabilities forward into the new 
> fn:doc() function.
> 
> The equivalent of:
> 
>    fn:document(concat(@a, '.xml'), @a)
> 
> using the new function is:
> 
>    fn:doc(resolve-uri(concat(@a, '.xml'), base-uri(@a)))
> 
> (This might be longer, but in my experience the second argument of
> document() is very rarely used).
> 
> Michael Kay
> 

- 

NOTICE: The information contained in this email and any attachments is 
confidential and may be legally privileged. If you are not the 
intended recipient you are hereby notified that you must not use, 
disclose, distribute, copy, print or rely on this email's content. If 
you are not the intended recipient, please notify the sender 
immediately and then delete the email and any attachments from your 
system.

RNIB has made strenuous efforts to ensure that emails and any 
attachments generated by its staff are free from viruses. However, it 
cannot accept any responsibility for any viruses which are 
transmitted. We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email 
and any attachments are those of the author and do not necessarily 
represent those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk 

Received on Tuesday, 13 May 2003 05:11:52 UTC