Subject: Re: document()-function, using 2 arguments From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 05 Apr 2000 23:45:43 -0400 |
> Recall also that if you do not supply a second argument to the document() > function then the a relative first argument value is resolved relative to > the stylesheet node's base URI (hence, relative to the subdirectory in > which the stylesheet is found). If you do supply a second argument to the > document() function, a relative first argument is resolved relative to the > base URI of the node in the supplied second argument. >
Here I have problems... I think when not supplying a second argument the relative first argument s resolved relative to the base URI of itself.
When your node of the first argument is part of an external entity its base-URI is the directory where this entity is physically stored, and that's the place where saxon / xt are looking for the file...
When you want the style's destination as second argument it's done by document($mynode, document('')). (I've read in the spec once again, and I think it's right)
As said: saxon and xt do so, xalan doesn't. Xalan always looks at the base-URI of the first argument...
T:\ftemp\test1>type test.xml <?xml version="1.0"?> <test> This is test.xml from the test1 directory. </test> T:\ftemp\test1>type ..\test2\test.xml <?xml version="1.0"?> <test> This is test.xml from the test2 directory. </test> T:\ftemp\test1>type test1.xsl <?xml version="1.0"?><!--filename.xsl--> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ken="ken" version="1.0">
<ken:data> The file being accessed is test1.xsl. </ken:data>
<xsl:template match="/"> <xsl:call-template name="test2"/> </xsl:template>
T:\ftemp\test1>type ..\test2\test2.xsl <?xml version="1.0"?><!--filename.xsl--> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ken="ken" version="1.0">
<ken:data> The file being accessed is test2.xsl. </ken:data>
<xsl:template name="test2"> <xsl:value-of select="document('')//ken:data"/> <xsl:value-of select="document('test.xml')"/> <xsl:value-of select="document('test.xml', document(''))"/> <xsl:value-of select="document('test.xml',.)"/> </xsl:template>
T:\ftemp\test1>xt test1.xsl test1.xsl <?xml version="1.0" encoding="utf-8"?>
-- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Web site: XSL/XML/DSSSL/SGML services, training, libraries, products. Practical Transformation Using XSLT and XPath ISBN 1-894049-04-7 Next instructor-led training: 2000-05-02,2000-05-11/12,2000-05-15, - 2000-06-12,2000-06-13,2001-01-27
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: document()-function, using 2 ar, michael gruber | Thread | Re: document()-function, using 2 ar, G. Ken Holman |
Re: xsl question, paul . beer | Date | Re: document()-function, using 2 ar, G. Ken Holman |
Month |