Bug #3064
closedIncorrect optimization of xsl:attribute using default namespace
100%
Description
When all the following conditions apply:
-
an xsl:attribute instruction is used with a computed name,
-
the name can be computed statically
-
the result of computing the name is a string with no namespace prefix
-
the xsl:attribute instruction has no namespace attribute
-
there is a default namespace declaration N in scope for the xsl:attribute instruction
then the attribute MAY be put incorrectly in namespace N rather than in no namespace (this will involve adding a generated prefix such as "ns0".
The problem can probably also occur under analogous conditions in XQuery.
The problem does not always happen when the above conditions are satisfied. Saxon makes two attempts to pre-evaluate the attribute name statically, and the problem only occurs when the first attempt fails (that is, when it is not able to reduce the expression to a simple string) and the second attempt succeeds. It's difficult to be precise about the exact conditions where this will happen but it depends on the expression having a certain level of complexity.
Despite this complex explanation the actual error in the code is very simple: it is doing the local-name-to-QName resolution using a method that treats unprefixed names as being in the default namespace rather than in no namespace.
Updated by Michael Kay over 7 years ago
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch 9.7, 9.8 added
- Fix Committed on Branch 9.7, 9.8 added
Updated by O'Neil Delpratt about 7 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.7.0.15 added
Bug fix applied to the Saxon 9.7.0.15 maintenance release
Updated by O'Neil Delpratt almost 7 years ago
- Fix Committed on Branch trunk added
- Fix Committed on Branch deleted (
9.8)
Please register to edit this issue