#394 xsl:number level="any" count="/ | node()"

v8.5
closed
nobody
None
5
2012-10-08
2005-08-16
Jack Matheson
No

I have whittled the stylesheet down to only the part that causes
Saxon to crash.

Interestingly, this crashes in AnyNodeTest.java in Saxon 8.5, but in
PrecedingEnumeration.java for earlier versions of Saxon 8.x.

Attached are the .xsl and .xml which can be used to demonstrate
this.

Discussion

  • Jack Matheson
    Jack Matheson
    2005-08-16

    A small stylesheet which causes Saxon 8.5 to throw a runtime exception

     
    Attachments
  • Jack Matheson
    Jack Matheson
    2005-08-16

    Source file for this bug

     
    Attachments
  • Michael Kay
    Michael Kay
    2005-08-17

    Logged In: YES
    user_id=251681

    Title changed: was
    OASIS conformance test bvt061 causes Saxon to crash

    Thanks, now fixed, and a test case added.

    Even where it's self-evident that there's a bug, I do prefer
    incidents to be submitted on the saxon-help list or forum
    (or via "support requests"), so that the bug register
    describes the bugs after analysis, to help people searching
    for known errors.

    This problem affects any use of <xsl:number level="any">
    with a count pattern that matches document nodes. I suspect,
    but haven't confirmed, that it will also trigger if the
    count pattern matches the element at the root of a
    non-document tree.

    Source fix: in PrecedingEnumeration add an else branch to
    the if statement at line 39 (if !includeAncestors):

    } else {
    if (tree.depth[nextNodeNr] == 0) {
    current = null;
    position = -1;
    return null;
    }

     
  • Michael Kay
    Michael Kay
    2005-08-17

    Logged In: YES
    user_id=251681

    This test actually reveals a second problem: with
    level="any", if no ancestor or preceding node matches the
    "from" pattern, which is the case here, then the result
    should be () - an empty sequence. Saxon is treating this
    case as if the from pattern were absent.

    I've fixed this one too but won't provide a patch. Test case
    numb41.

    MK