Closed Bug 296949 Opened 20 years ago Closed 19 years ago

count() on result tree fragment crashes

Categories

(Core :: XSLT, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bebabo, Assigned: peterv)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041217
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041217

count() on a result tree fragment crashes (this mozilla 1.7.5 as well as firefox
1.0.4). As i understand the xsl recommendation it should give 1 (sure not crash).

Reproducible: Always

Steps to Reproduce:
1. load
http://bebabo.homelinux.org/test/moz/xsl_count_bug/result-tree-frag-crash.xml
2.
3.

Actual Results:  
crash

Expected Results:  
display the "Hello" page

xsl is: http://bebabo.homelinux.org/test/moz/xsl_count_bug/rtfc.xsl as pasted here:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:template match="/" priority="1">
    <xsl:variable name="foo">
       <span>hello world</span>
    </xsl:variable>
    <xsl:comment>Foo count: <xsl:value-of select="count($foo)" /></xsl:comment>
    <xsl:apply-templates select="text()|node()|@*" />
  </xsl:template>
  <xsl:template match="node()|text()|@*" priority="0.6">
    <xsl:copy>
      <xsl:apply-templates select="text()|node()|@*" />
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

Note: if i load the xml from the local file system i get in firefox an error (in
mozilla always a crash)
On a deerparky mozilla trunk, I get an error page with

Error during XSLT transformation: An XPath expression was expected to return a
NodeSet.

I do get the crasher on the branch, waiting for talkback public now.
Status: UNCONFIRMED → NEW
Ever confirmed: true
FWIW throwing that error is the right thing to do so technically this bug is
WORKSFORME. But it'd probably be a good thing to fix this on the branch.
(In reply to comment #1)
yes nightly firefox works and gives an error which is probably correct.
propably: the spec is a bit confusing: "A result tree fragment is treated
equivalently to a node-set that contains just a single root node" but then:
"An operation is permitted on a result tree fragment only if that operation
would be permitted on a string" and effectively count() is not allowed on strings.

WORKSFORME in nightly firefox
We need a stack trace, but this might have been fixed on the trunk by the patch
for bug 248258.
Let's close this one.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.