Re: [xml] pb xsltproc path confusion with document() function



On Thu, Sep 25, 2003 at 05:37:42PM -0400, stephane mottelet utc fr wrote:

Ok. How should I write the template ?

With another template in another stylesheet
I do not have the problem /

<xsl:apply-templates 
select="document(@href)//*[name(.)=substring-after(name(current()),'-')][1]"/>

I don't see any difference. But with the above template xsltproc
doesn't try to find the document is the stylesheet folder.

Anyway, how should I write the "select" attribute to
express that I want to read the document in the current
directory ?

  Reread the spec !!!
In one case you pass a string ! A string has no base URI. In the other
case you pass a node set, then the nodes there have base URIs.

  And there is no notion of "current directory" at all in that processing
you have base URI for nodes. there are base URI for the node manipulated
which may come from the input XML data, or from the stylesheet, that's all
an XSLT processor knows of.

  Read the spec, understand it and then you will probably find why you
have a problem, how to solve it and how to avoid that in the future. Nothing
replace understanding a tool before using the tool.

Daniel

Daniel Veillard wrote:
On Thu, Sep 25, 2003 at 05:15:24PM -0400, stephane mottelet utc fr wrote:

In fact xsltproc tries to find the document in the folder
of the stylesheet instead of the current working directory
(the one when xsltproc was run).

Is it a know bug ?


  Why on earth do you think it's a bug ?
What about reading the spec ? Section 12.1 of the XSLT spec
http://www.w3.org/TR/xslt
  ---------------
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.
  ---------------
If you don't understand what an URI-Reference or the base means, the
answer is in RFC 2396 http://www.ietf.org/rfc/rfc2396.txt

Daniel




-- 
e-mail : Stephane Mottelet utc fr
www : http://www.dma.utc.fr/~mottelet

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]