2

我正在使用一些XML处理方法,但遇到了一个奇怪的问题,即XML当我使用浏览器查看XML文件和使用. 当我在 中打开文件时,我看到:IEFireFoxIE

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:template match="root">
        <xsl:apply-templates select="property" />
    </xsl:template>
    <xsl:template match="property">
        <xsl:number />
        <xsl:apply-templates select="node()" />
    </xsl:template>
    <xsl:template match="node()">
        <xsl:if test="normalize-space(.)">
            <xsl:value-of select="normalize-space(.)" />
        </xsl:if>
    </xsl:template>
</xsl:stylesheet>

但是,在 中FireFox,我看到以下内容:

<xsl:stylesheet version="1.0">
    <xsl:template match="root">
        <xsl:apply-templates select="property" />
    </xsl:template>
    <xsl:template match="property">
        <xsl:number />
        <xsl:apply-templates select="node()" />
    </xsl:template>
    <xsl:template match="node()">
        <xsl:if test="normalize-space(.)">
            <xsl:value-of select="normalize-space(.)" />
        </xsl:if>
    </xsl:template>
</xsl:stylesheet>

基本上,我知道问题是FireFox没有显示xmlns属性。我试图找到解决它的方法;但没有运气。任何人以前遇到过这个问题并且知道如何解决它?谢谢。

PS:我使用的是 IE 9.0.8112.16421 和 Firefox 15.0.1。

4

1 回答 1

0

https://bugzilla.mozilla.org/show_bug.cgi?id=175946

基本上,Firefox 实际上使用 XSLT 来实现 XML prettyprinter,而 XSLT 不能使用 xmlns 属性......

于 2012-10-13T04:16:00.530 回答