搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

Firefox 5: The XPath function name() returns names of attributes of XHTML Elements in capital letters ??

more options

You will see the problem when you open the following file as application/xml with Firefox 5 and with Firefox 3.x:


<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="#" type="application/xml"?>
<xsl:stylesheet
  xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
  xmlns:ht  = "http://www.w3.org/1999/xhtml"
  xmlns     = "http://www.w3.org/1999/xhtml"
  xmlns:po  = "hoppel"
  exclude-result-prefixes = "ht"
  version   = "1.0"
>

<xsl:output method = "xml"/>
<xsl:template match = "/">
  <html>
    <head>
      <title>Test: Attributnamen</title>
    </head>
    <body>
      <h1
	  class = "whisky"  Class = "Whisky" CLASS = "WHISKY"
	  id = "hoppel" Id = "Hoppel" ID = "HOPPEL"
	  nasenbaer = "nasenbär" Nasenbaer = "Nasenbär"
      >
	Test: Attributnamen
      </h1>
      <xsl:for-each select = "//ht:h1 | //po:h1">
	<div>
	  <h2><xsl:value-of select = "concat ('Element ', name(.))"/></h2>
	  <xsl:for-each select = "@*">
	    <p><xsl:value-of select = "concat ('Attribut ', name(.), ': ', .)"/></p>
	  </xsl:for-each>
	  <p><xsl:value-of select = "concat ('Wert ID: ', @ID)"/></p>
	  <p><xsl:value-of select = "concat ('Wert id: ', @id)"/></p>
	  <xsl:for-each select = "@*[name(.)= 'class']">
	    <p><xsl:value-of select = "concat ('Attribut class: ', name(.), ', ', .)"/></p>
	  </xsl:for-each>
	  <xsl:for-each select = "@*[name(.)= 'CLASS']">
	    <p><xsl:value-of select = "concat ('Attribut CLASS: ', name(.), ', ', .)"/></p>
	  </xsl:for-each>
	</div>
      </xsl:for-each>
    </body>
  </html>
</xsl:template>

<po:h1
    class = "whisky"  Class = "Whisky" CLASS = "WHISKY"
    id = "hoppel" Id = "Hoppel" ID = "HOPPEL"
    nasenbaer = "nasenbär" Nasenbaer = "Nasenbär"
/>

</xsl:stylesheet>
You will see the problem when you open the following file as application/xml with Firefox 5 and with Firefox 3.x: <pre><nowiki><?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="#" type="application/xml"?> <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" xmlns:ht = "http://www.w3.org/1999/xhtml" xmlns = "http://www.w3.org/1999/xhtml" xmlns:po = "hoppel" exclude-result-prefixes = "ht" version = "1.0" > <xsl:output method = "xml"/> <xsl:template match = "/"> <html> <head> <title>Test: Attributnamen</title> </head> <body> <h1 class = "whisky" Class = "Whisky" CLASS = "WHISKY" id = "hoppel" Id = "Hoppel" ID = "HOPPEL" nasenbaer = "nasenbär" Nasenbaer = "Nasenbär" > Test: Attributnamen </h1> <xsl:for-each select = "//ht:h1 | //po:h1"> <div> <h2><xsl:value-of select = "concat ('Element ', name(.))"/></h2> <xsl:for-each select = "@*"> <p><xsl:value-of select = "concat ('Attribut ', name(.), ': ', .)"/></p> </xsl:for-each> <p><xsl:value-of select = "concat ('Wert ID: ', @ID)"/></p> <p><xsl:value-of select = "concat ('Wert id: ', @id)"/></p> <xsl:for-each select = "@*[name(.)= 'class']"> <p><xsl:value-of select = "concat ('Attribut class: ', name(.), ', ', .)"/></p> </xsl:for-each> <xsl:for-each select = "@*[name(.)= 'CLASS']"> <p><xsl:value-of select = "concat ('Attribut CLASS: ', name(.), ', ', .)"/></p> </xsl:for-each> </div> </xsl:for-each> </body> </html> </xsl:template> <po:h1 class = "whisky" Class = "Whisky" CLASS = "WHISKY" id = "hoppel" Id = "Hoppel" ID = "HOPPEL" nasenbaer = "nasenbär" Nasenbaer = "Nasenbär" /> </xsl:stylesheet></nowiki></pre>

由 cor-el 於 修改

所有回覆 (2)

more options

A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.
The helpers at that forum are more knowledgeable about web development issues.
You need to register at the mozillaZine forum site in order to post at that forum.

See http://forums.mozillazine.org/viewforum.php?f=25

more options

I have posted this problem at the mozillaZine Web Development/Standards Evangelism forum. I think it is a FF5 Bug.