Kerry Kobashi wrote:
I want to use the document() function to get the refurl and process
that xml file:
<xsl:variable name="refurl">
<xsl:value-of select="document('../../test.xml')/items/item/@refurl"/>
</xsl:variable>
You are using value-of, which does what it says: it gets you the "value"
of the selected nodes (i.e., the "value", that is a string and not a
node set and cannot be processed further). Use, in XSLT 2.0, copy-of,
sequence, apply-templates or @select, or, in XSLT 1.0 just use @select.
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
you probably tried something else than you state above:
document(file:///bla) is a syntax error and cannot compile. Try
document('file:///bla').
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
again, this cannot compile. If you did use quotes in your original and
indeed got this warning: your URL is malformed. It should be either
file:///c:/a/b/c/index.hmtl (where the first // means: localhost) or it
should be file:/c:/a/b/c/index.html, where the absence of the first //
means, again, localhost. If you do not want localhost but another
server, place that address between // and /, like this:
file://otherhost/c$/some/file/here.html.
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:
By now I assume you just mistyped the function in your mail and did the
right thing in your real-world stylesheet. Since you have a network
address error here, you should try your PHP directly to try to fetch the
document. Probably you are behind a firewall, a proxy or anything and
your PHP just cannot access the external url.
In general, use "file:///c:/my/path/on/c-drive/index.html" for files,
and use "http://www.google.com/index.html" (won't work, google does not
serve valid xhtml, but the syntax should work and it should not give you
the error you mention).
HTH,
cheers
-- Abel Braaksma
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--