document() usage in xsl stylesheet

Patrick TJ McPhee

Usenet Archive
Joined
Apr 2, 2000
Messages
269
Reaction score
0
[...]
% 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.
 

Stéphane Mottelet

Usenet Archive
Joined
Jul 11, 2001
Messages
14
Reaction score
0
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top