Re: [xsl] Document() question

Subject: Re: [xsl] Document() question
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 Sep 2007 22:00:43 -0400
(Sorry; I was accidentally using the wrong email profile and signature for sending my earlier response because of ongoing work in another window)

At 2007-09-18 18:33 -0700, Kerry Kobashi wrote:
I am not able to access the /a/b/c/index.xml file located off my website:
http://www.foobar.com/a/b/c/index.xml

I tried:

document(file:///a/b/c/index.xml)

*Warning*: XSLTProcessor::transformToXml() [function.XSLTProcessor-transformToXml <http://www.iqlicksoftcms.com/function.XSLTProcessor-transformToXml>]: I/O warning : failed to load external entity

document(file://a/b/c/index.xml)

*Warning*: XSLTProcessor::transformToXml() [function.XSLTProcessor-transformToXml <http://www.iqlicksoftcms.com/function.XSLTProcessor-transformToXml>]: remote host file access not supported

document(http://www.foobar.com/a/b/c/index.xml)

*Warning*: XSLTProcessor::transformToXml() [function.XSLTProcessor-transformToXml <http://www.iqlicksoftcms.com/function.XSLTProcessor-transformToXml>]: php_network_getaddresses: getaddrinfo failed:

Any suggestions?

Did you quote the URL values?


There should be no problems with:

document("http://www.foobar.com/a/b/c/index.xml";)

The first argument to the document() function is a string. If you apply a node set the processor converts each node to a string and uses the string as a URI.

Remember if you are using a relative URI the absence of the second argument signals the stylesheet node as the base URI (which is a bug in Internet Explorer in that it incorrectly uses the current node URI; IE apparently only uses the stylesheet node if the first argument is the empty string), while supplying a second argument signals the processor to use the base URI of the fragment with the syntax that created the given source tree node.

To work around the Internet Explorer bug, a patch that is portable across all processors I've tried while getting around the bug in IE is:

document( '...relative-uri...', document( '' ) )

For IE this gives conformant behaviour as if the second argument were absent. For other processors this second argument is redundant.

I hope this helps.

. . . . . . . . . . . . Ken

--
Upcoming public training: UBL and code lists Oct 1/5; Madrid Spain
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
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 (F:-0995)
Male Cancer Awareness Jul'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread