document.write
?
media="print"
?
transformNode
?
Make sure the mime type for both source and stylesheet are set to an XML mimetype, namely
text/xml
or
application/xml
. The XSLT namespace is
http://www.w3.org/1999/XSL/Transform
. Use the <?xml-stylesheet ?> processing instruction instead of the non-standard xml:stylesheet. The most common cause is the MIME type handling. To find out which MIME type your server sends, look at Page Info, use extensions like
LiveHTTPHeaders
or a download manager like
wget
. Mozilla won't load XSLT stylesheets from a different domain for security reasons.
注意:
Starting in
Gecko 7.0
, both
text/xsl
and
application/xslt+xml
are supported MIME types for XSLT media stylesheets.
Note that Firefox will override your XSLT stylesheet if your XML is detected as an RSS or Atom feed. A known workaround is to add a sufficiently long XML comment to the beginning of your XML file in order to "push" the
<feed>
or
<rss>
tag out of the first 512 bytes, which is analyzed by Firefox to determine if it's a feed or not. See the discussion on bug
#338621
了解更多信息。
There are even more differences. Most come from what we suspect IE to do after the transformation. It (AFAICT) serializes and parses the output to generate what it actually renders. Mozilla in contrast renders exactly the result of your transformation.
This is actually pretty close to the question above. And in short, no. Disabling output escaping requires us to add a parsing step to our output generation, which we don't. In most cases, there are pretty easy workarounds. The only use cases we have seen are bad XML or bad XSLT. And RSS feeds. The latter is pretty much the only issue to us, and we're sorry that we can't support it. But mixing parsing with XSLT is brittle and we rather not support d-o-e than either crash or be even slower.
document.write
?
Just like for XHTML,
document.write
is not supported during XSLT transformations. Sadly, current builds don't error, but just give unexpected results, like crashes (
bug 202765
). In most cases, there is no need to actually use it, though. If you need platform dependent code or stylesheets, just do
<xsl:if test="system-property('xsl:vendor')='Transformiix'">
<!-- Mozilla specific markup -->
</xsl:if>
<xsl:if test="system-property('xsl:vendor')='Microsoft'">
<!-- IE specific markup -->
</xsl:if>
Check system-properties.xml for the properties of your favorite system. MSXML has an additional property.
<xsl:if xmlns:msxsl="urn:schemas-microsoft-com:xslt"
test="system-property('msxsl:version')=3">
<!-- MSXML3 specific markup -->
</xsl:if>
media="print"
?
When printing a document, Mozilla tries to render the page on paper as closely to what you see as possible. This includes stuff like text entered into textfields and other dynamic changes. This is achieved by printing the current DOM tree. Having XSLT stylesheet specific to particular
media
would require to retransform the original XML source, which counteracts the expectations of the user. Thus, using
media
in <?xml-stylesheet ?> is strongly discouraged. Future builds might only load an XSLT stylesheet if
media
is not specified, or if the specified
media
包括
screen
.
This does not affect CSS stylesheets loaded from the generated DOM, those honor media just like in pages without XSLT.
transformNode
?
There is
transformToDocument
and
transformToFragment
starting with Mozilla 1.2 final, see
Using the Mozilla JavaScript interface to XSL Transformations
.
IE up to version 6 required a deprecated namespace of a XSLT working draft, please update to Mozilla ;-), IE6+ or MSXML3+, as it is fixed there. As the differences between XSLT1.0 and the IE implementation of that WD are significant, we offer no legacy support.
见 Building TransforMiiX standalone 页面。