Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xml-stylesheet href="??"

 
Chris Gage
Greenhorn
Posts: 17
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic