File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes xml-stylesheet href= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml-stylesheet href="??"" Watch "xml-stylesheet href="??"" New topic
Author

xml-stylesheet href="??"

Chris Gage
Greenhorn

Joined: Mar 23, 2005
Posts: 17

I have a set of XML pages that I am developing, along with an XSL stylesheet that will render the pages to XHTML on the browser. If I use a stylesheet reference of the following form, with the XSL in the same folder as all the XML files, it works correctly:

<?xml-stylesheet type="text/xsl" href="project.xsl"?>

But when my project grows, I will have many folders on different subjects, all of them using the same XSL, so I would want to put the XSL in the parent folder and use the normal ../foo reference:

<?xml-stylesheet type="text/xsl" href="../project.xsl"?>

But when I move it there and try this, my XSL doesn't work. Is there some special incantation for referencing the parent folder in this case?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18655
    
    8

I'm just guessing, but generally browsers frown on that "parent folder" abbreviation because it can be used to go fishing outside the web domain from which the original resource was loaded. So perhaps it's being treated as a security violation. Not sure how you would confirm that guess, though.
Chris Gage
Greenhorn

Joined: Mar 23, 2005
Posts: 17

That sounds reasonable. Does that mean I should put a full url reference in there, something like...

<?xml-stylesheet type="text/xsl" href="http://www.myproject.com/foo/bar/project.xsl"?>

If the above is the correct and approved way to do it, I'll adopt it. It makes testing the site rather a hassle, since I am using Eclipse WTP and it imposes the workspace/project/WebContent structure, which goes away when the site is deployed to the webserver.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xml-stylesheet href="??"