Jump to content

XML and XSL file have to be in the same directory?

Recommended Posts

Hi, Just a quick question. In all the tutorials I've seen about xml/xslt, the xsl file is always saved in the same directory as the xml file. My question is; can I have an xml file that links to an xsl file that is saved somewhere else and have it linked via a url? What I'm specifically trying to do is have an xml file and an xsl file saved in a Dropbox folder and link the xml file to the xsl file with a url. It would look like this; xslt file would be the usual; <?xml version= "1.0"?><xsl:stylesheet version= "1.0"xmlns:xsl= "http://www.w3.org/1999/XSL/Transform"> And xml file; <?xml version= "1.0"?><?xsl-stylesheet type= "text/xsl" href= "http://dl.dropbox.com/u/name_of_file.xsl"?> I have tried this and it doesn't seem to work but I wasn't sure if that had something to do with it being in a Dropbox folder or if both documents absolutely have to be in saved in the same folder in the same directory. Thanks.

  • Like 1
Link to post
Share on other sites

They don't have to be in the same folder, but they must be in the same domain.This isn't an XSLT restriction - it's a browser restriction, designed to mitigate XSS attacks.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...