Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 2nd, 2005, 03:24 AM
Authorized User
 
Join Date: Aug 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Document(.....)

Hi,
I have written some XSLT which tries to access a second XML document with the following code:

<xsl:for-each select="document('Stylesheet.xml')/Page/Stylename[starts-with(@name, $style)]/style">

This always seems to check the local disk (C:) for the file not as a relative http URL file. How can i specify that stylesheet.xml is in the same web folder as the page that called it?

For example, when i test this code using RAD instead of looking in http://localhost:9080/test/Stylesheet.xml it looks in C:/program files/..../...../....

Does this make any sense to anyone? Or am i just being stupid?

Matt
 
Old August 2nd, 2005, 06:32 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

When the argument to document() is specified as a string literal, the relative URI should be taken as being relative to the stylesheet. If you want it to be relative to the source document, you can achieve this using the second argument of the function.

This only works if the base URI of the stylesheet/source document are known. This depends on using the API to invoke the processor correctly (you don't say which processor you're using or how you invoked it). For example, many JAXP users make the mistake of supplying a StreamSource as the input without calling setSystemId() so that the XSLT processor knows the base URI.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
printing document using c# shahanaz C# 0 October 4th, 2007 08:29 AM
Use of key and document rjonk XSLT 4 July 25th, 2006 03:48 PM
Document.write hussainm Javascript How-To 2 July 12th, 2006 05:20 AM
Document all pallone Javascript How-To 2 January 28th, 2005 01:37 PM
Document Storage [email protected] SQL Server 2000 1 December 23rd, 2003 10:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.