Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > document() usage in xsl stylesheet

Reply
Thread Tools

document() usage in xsl stylesheet

 
 
Patrick TJ McPhee
Guest
Posts: n/a
 
      09-26-2003
In article <3f733bec$0$2802$(E-Mail Removed)>,
Stéphane Mottelet <(E-Mail Removed)> wrote:

[...]
% document(concat(@base,'.xml')) (*)
%
% will be interpreted (by W3C compliant xslt processors) as
% document('/some/path/file.xml') because the result of concat
% is a string and not a node-set. This is the case of Gnome's xsltproc,
% the processor I am currently using. This is not the case of Xalan,
% since this processor silently interprets (*) as document("file.xml").

More precisely, the first argument is treated as a URI. I'm not sure
how much leeway there is in interpreting URIs which don't include
the protocol, but it seems like Xalan is treating this as a relative
URI, while libxslt is treating it as if it were file:///some/path/file.xml.
If there's no second argument and the first argument is a string,
document() resolves relative URIs against the location of the stylesheet.

You could try changing the concatenation to put file:// at the front
if you know that the resulting URI is always going to be a file.
--

Patrick TJ McPhee
East York Canada
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Stéphane Mottelet
Guest
Posts: n/a
 
      09-26-2003
Hi.

How do you specify the document()'s arguments when
the name of the document you want to load is obtained
as a string, e.g.

concat(@base,'.xml') ?

The problem is that if the path of the xsl
stylesheet is /some/path/, and @base contains
"file" then

document(concat(@base,'.xml')) (*)

will be interpreted (by W3C compliant xslt processors) as
document('/some/path/file.xml') because the result of concat
is a string and not a node-set. This is the case of Gnome's xsltproc,
the processor I am currently using. This is not the case of Xalan,
since this processor silently interprets (*) as document("file.xml").

My question is : how do I have to write the 2 arguments to document()
to refer to a document's name obtained as a string (and not a node set). ?

Thanks for help

S.



 
Reply With Quote
 
 
 
 
Stéphane Mottelet
Guest
Posts: n/a
 
      09-26-2003
I got it : this is

document(concat(@base,'.xml'), /)

S.

"Stéphane Mottelet" <(E-Mail Removed)> a écrit dans le
message news: 3f733bec$0$2802$(E-Mail Removed)...
> Hi.
>
> How do you specify the document()'s arguments when
> the name of the document you want to load is obtained
> as a string, e.g.
>
> concat(@base,'.xml') ?
>
> The problem is that if the path of the xsl
> stylesheet is /some/path/, and @base contains
> "file" then
>
> document(concat(@base,'.xml')) (*)
>
> will be interpreted (by W3C compliant xslt processors) as
> document('/some/path/file.xml') because the result of concat
> is a string and not a node-set. This is the case of Gnome's xsltproc,
> the processor I am currently using. This is not the case of Xalan,
> since this processor silently interprets (*) as document("file.xml").
>
> My question is : how do I have to write the 2 arguments to document()
> to refer to a document's name obtained as a string (and not a node set). ?
>
> Thanks for help
>
> S.
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use output of XSL transformation as new XSL stylesheet barney.b@iname.com XML 0 01-16-2006 02:29 PM
[XSL] : use array variable in XSL stylesheet MC XML 1 03-24-2005 10:41 AM
Documenting xsl (searching xsl:doc stylesheet) Thomas Sommer XML 0 11-25-2004 01:03 AM
have a stylesheet generate another stylesheet based on XML? Steven An XML 1 11-23-2004 01:07 PM
Stylesheet referanse i stylesheet =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?= XML 3 07-04-2004 03:16 PM



Advertisments