#53 xsl:message causing "xsl:attribute" error

closed
nobody
None
5
2012-10-08
2007-12-01
No

When I run the attached stylesheet on the attached xml using Saxon 9.0B, I get an error message

"Error at xsl:message on line 55 of file:/home/jak09/Workspace/Semantics/data/schemata/adapt.xslt:
XTDE0420: Cannot create an attribute node (rdo:semanticDistortion) whose parent is a document node"

However, when I turn on tracing (-T) it turns out that the error is being raised on line 55 which is

<xsl:message select="'multiply(',$sequence,') =',$result"/>

Commenting out this line removes the error and the stylesheet completes normally.

I think that this must be a bug.

Regards,
Joe.

Discussion

  • Michael Kay
    Michael Kay
    2007-12-01

    Logged In: YES
    user_id=251681
    Originator: NO

    This looks like the problem described here:

    http://sourceforge.net/tracker/index.php?func=detail&aid=1837335&group_id=29872&atid=397617

    This is fixed in 9.0.0.2, though probably not in the way you would want.

    I assume that in your case $sequence (or perhaps $result) contains an attribute node. xsl:message does not atomize the result of the select expression, which is probably what your example is expecting. I suggest you replace $sequence by string($sequence) if this is the case.

    As mentioned in the bug entry I've raised a bug against the XSLT spec because I think it needs to clarify what ought to happen in such cases.

     


Anonymous


Cancel   Add attachments