Firefox 2.0.0.6 document() restriction
shaun roe <[email protected]> Mon, 03 Sep 2007 12:09:38 +0200
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Message-ID | <[email protected]> |
I have a problem with the restriction on the document() function loading
a web document which is a background image:
Security Error: Content at
file://localhost/Users/sroe/Desktop/test/JiveXML_3025_00003.xml may not
load data from http://sroe.home.cern.ch/sroe/svg/ffGeometry.svg.
I open a local file which has an associated XSLT stylesheet in the same
directory. This stylesheet attempts to load elements of an SVG file
which is on the web, if it doesnt find the SVG file locally.
Here are some relative code snippets from the xslt (at top, global
level):
<!-- geometry svg file name -->
<xsl:variable name="localFile" select="'ffGeometry.svg'"/>
<xsl:variable name="webFile"
select="'http://sroe.home.cern.ch/sroe/svg/ffGeometry.svg'"/>
<xsl:variable name="localWebFile" select="'../svg/ffGeometry.svg'"/>
.
.
.
.
.
<xsl:variable name="geoFile">
<xsl:choose>
<xsl:when test="count(document($localFile)/*) != 0">
<xsl:message>Local geometry file found, using this.</xsl:message>
<xsl:value-of select="$localFile"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="count(document($localWebFile)/*) != 0">
<xsl:message>Local hosted geometry file found, using
this.</xsl:message>
<xsl:value-of select="$localWebFile"/>
</xsl:when>
<xsl:when test="count(document($webFile)/*) !=0">
<xsl:message>Using the geometry file at
http://sroe.home.cern.ch/sroe/svg/geometry.svg</xsl:message>
<xsl:value-of select="$webFile"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>Your XSLT processor could not open the geometry
file; try downloading it locally
from
http://sroe.home.cern.ch/sroe/svg/geometry.svg</xsl:message>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Can anyone see a way around this? I want the stylesheet to load the
background SVG graphic from the web, when it doesnt exist in the same
directory.
Should I use import / include and wrap the svg in an xslt itself? (I
generate the SVG content in a seprate step) or am I forced to put the
svg content directly in my xslt (cut 'n' paste) and therefore make the
xslt much heavier?
cheers
shaun