You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Per Jessen <pe...@computer.org> on 2003/04/14 11:17:53 UTC

how document() resolves a relative path

I've just recently "discovered" something which I'm not certain
is correct. 
I'm using XSLT function document() to read in a local file. WHen the 
filepath is relative, document() tries to resolve it as relative to the 
location of the .xsl file using document(). 

Eg. if I call the xalan command-line processor along these lines:

./xalan [options]  <xmldoc>  ../qwerty.xsl  

a document('jessen/g7.xml') will try to access '../jessen/g7.xml' .

Is this correct/expected behaviour? 


thanks,
Per Jessen, Zurich


RE: how document() resolves a relative path

Posted by Per Jessen <pe...@computer.org>.
Mark Weaver wrote:

> Yes, that seems correct to me.  URI imports should be resolved relative to
> the base URI.

OK, thanks - I came to the same conclusion fairly quickly after posting 
this :-) 

/Per




Re: how document() resolves a relative path

Posted by Per Jessen <pe...@computer.org>.
david_n_bertoni@us.ibm.com wrote:

> 
> Yes, this behavior is correct, and is explicit in the XSLT recommendation:
> 
[snip]
> 
> The two argument call is available, if you need to provide a base URI.

Ah, that's what I was looking for - thanks for mentioning it. 


/Per


RE: how document() resolves a relative path

Posted by Mark Weaver <ma...@npsl.co.uk>.
Yes, that seems correct to me.  URI imports should be resolved relative to
the base URI.

> -----Original Message-----
> From: news [mailto:news@main.gmane.org]On Behalf Of Per Jessen
> Sent: 14 April 2003 10:18
> To: xalan-c-users@xml.apache.org
> Subject: how document() resolves a relative path
>
>
> I've just recently "discovered" something which I'm not certain
> is correct.
> I'm using XSLT function document() to read in a local file. WHen the
> filepath is relative, document() tries to resolve it as relative to the
> location of the .xsl file using document().
>
> Eg. if I call the xalan command-line processor along these lines:
>
> ./xalan [options]  <xmldoc>  ../qwerty.xsl
>
> a document('jessen/g7.xml') will try to access '../jessen/g7.xml' .
>
> Is this correct/expected behaviour?
>
>
> thanks,
> Per Jessen, Zurich
>
>
>


Re: how document() resolves a relative path

Posted by da...@us.ibm.com.



Hi Per,

Yes, this behavior is correct, and is explicit in the XSLT recommendation:

   http://www.w3.org/TR/xslt#document

   "The URI reference may be relative. The base URI (see [3.2 Base URI]) of
   the node in the second argument node-set that is first in document order
   is used as the base URI for resolving the relative URI into an absolute
   URI. If the second argument is omitted, then it defaults to the node in
   the stylesheet that contains the expression that includes the call to
   the document function."

The two argument call is available, if you need to provide a base URI.

Dave



                                                                                                                        
                      Per Jessen                                                                                        
                      <per@computer.or         To:      xalan-c-users@xml.apache.org                                    
                      g>                       cc:      (bcc: David N Bertoni/Cambridge/IBM)                            
                      Sent by: news            Subject: how document() resolves a relative path                         
                      <news@main.gmane                                                                                  
                      .org>                                                                                             
                                                                                                                        
                                                                                                                        
                      04/14/2003 02:17                                                                                  
                      AM                                                                                                
                                                                                                                        



I've just recently "discovered" something which I'm not certain
is correct.
I'm using XSLT function document() to read in a local file. WHen the
filepath is relative, document() tries to resolve it as relative to the
location of the .xsl file using document().

Eg. if I call the xalan command-line processor along these lines:

./xalan [options]  <xmldoc>  ../qwerty.xsl

a document('jessen/g7.xml') will try to access '../jessen/g7.xml' .

Is this correct/expected behaviour?


thanks,
Per Jessen, Zurich