Rendering canSAS1D in Web Browsers: Difference between revisions
(→Linux) |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Using a stylesheet with XML files == | == Using a stylesheet with CanSAS XML files == | ||
One of the benefits of XML is that with an appropriate stylesheet, web browsers should be able to render the page as HTML. | One of the benefits of XML is that with an appropriate stylesheet, web browsers should be able to render the page as HTML, and other XML-compliant applications can interpret what a file contains and do something sensible with it. | ||
In order to use this feature, the XML file must have a stylesheet associated with it. This can either be local to the machine the XML file resides on, or accessed via a remote URL. | In order to use this feature, the XML file must have a stylesheet associated with it. This can either be local to the machine the XML file resides on, or accessed via a remote URL. | ||
Line 24: | Line 24: | ||
== Browser Compatibility == | == Browser Compatibility == | ||
However, | However, having a local file referencing a remote one is sometimes considered to be a security risk by certain browsers. Thus in some cases it may be necessary to store the XSL file locally and change the URL in the header appropriately. | ||
Below is a list of various browsers and how they behave. The list is not comprehensive. | Below is a list of various browsers/OS combinations and how they behave. The list is not comprehensive. | ||
=== Windows 7 === | === Windows 7 === | ||
Line 33: | Line 33: | ||
** Works with local and remote stylesheets | ** Works with local and remote stylesheets | ||
* IE 9 | * IE 9 | ||
** Works with local stylesheets only after | ** Works with local stylesheets only after altering the browser security settings (Internet Options->Security->Custom Level, and then under "Miscellaneous" enable "Access data sources across domains") | ||
* Firefox 10 | * Firefox 10 | ||
** Works with local stylesheets only | ** Works with local stylesheets only | ||
Line 65: | Line 65: | ||
=== Android === | === Android === | ||
* Dolphin & Dolphin HD | |||
** Not tested | |||
* Firefox | * Firefox | ||
** Not tested | ** Not tested but assume the same behaviour as other platforms | ||
* Opera Mobile/Mini | * Opera Mobile/Mini | ||
** Not tested | ** Not tested |
Latest revision as of 14:44, 18 March 2012
Using a stylesheet with CanSAS XML files
One of the benefits of XML is that with an appropriate stylesheet, web browsers should be able to render the page as HTML, and other XML-compliant applications can interpret what a file contains and do something sensible with it.
In order to use this feature, the XML file must have a stylesheet associated with it. This can either be local to the machine the XML file resides on, or accessed via a remote URL.
A default stylesheet is provided for the cansSAS1D format at: http://www.smallangles.net/cansas1d/1.0/cansasxml-html.xsl
In order to use this, there must be a line in the XML data file (usually the second line, after the xml declaration itself) as follows:
<?xml-stylesheet type="text/xsl" href="http://www.smallangles.net/cansas1d/1.0/cansasxml-html.xsl"?>
Thus the header will look something like:
<?xml version="1.0" encoding="utf-8" ?> <?xml-stylesheet type="text/xsl" href="http://www.smallangles.net/cansas1d/1.0/cansasxml-html.xsl"?> <SASroot version="1.0" xmlns="cansas1d/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="cansas1d/1.0 http://www.smallangles.net/cansas1d/1.0/cansas1d.xsd"> <SASentry> ...
Browser Compatibility
However, having a local file referencing a remote one is sometimes considered to be a security risk by certain browsers. Thus in some cases it may be necessary to store the XSL file locally and change the URL in the header appropriately.
Below is a list of various browsers/OS combinations and how they behave. The list is not comprehensive.
Windows 7
- IE 8
- Works with local and remote stylesheets
- IE 9
- Works with local stylesheets only after altering the browser security settings (Internet Options->Security->Custom Level, and then under "Miscellaneous" enable "Access data sources across domains")
- Firefox 10
- Works with local stylesheets only
- Google Chrome
- Does not work with remote or local stylesheets
- Opera
- Not tested
- Safari
- Not tested
Mac OS
- Safari 5
- Works with remote and local stylesheets with no changes
- Google Chrome
- Does not work with remote or local stylesheets
- Firefox 6
- Works with local stylesheets only
- Opera
- Not tested
Linux
- Firefox
- Not tested but assume the same behaviour as other platforms
iOS
- Mobile Safari
- Not tested
- Opera Mobile/Mini
- Not tested
Android
- Dolphin & Dolphin HD
- Not tested
- Firefox
- Not tested but assume the same behaviour as other platforms
- Opera Mobile/Mini
- Not tested