Bug #4458
closedannotatedConfig.xsd does not allow saxon:attribute-order with *
100%
Description
This @saxon:attribute-order
is valid according to http://www.saxonica.com/documentation/index.html#!extensions/output-extras/serialization-parameters.
<?xml version="1.0" encoding="UTF-8"?>
<configuration edition="EE" xmlns="http://saxon.sf.net/ns/configuration"
xmlns:saxon="http://saxon.sf.net/">
<serialization saxon:attribute-order="a b c * xml:space" />
</configuration>
However, samples/config/annotatedConfig.xsd
does not allow it.
$java -cp saxon9ee.jar com.saxonica.Validate -xsd:https://dev.saxonica.com/repos/archive/opensource/latest9.9/samples/config/annotatedConfig.xsd -s:config.xml
...
Validation error on line 4 column 61 of config.xml:
FORG0001: Invalid lexical QName {*}
See http://www.w3.org/TR/xmlschema-2/#cvc-complex-type clause 3
Updated by T Hata almost 5 years ago
As a related question, what is the correct syntax to specify saxon:attribute-order="a b c * xml:space" in the second parameter (map) of fn:serialize()
? It seems to reject *
for a reason similar to annotatedConfig.xsd
.
Updated by Michael Kay almost 5 years ago
Thanks for pointing out the omission.
Also applies to config.xsd
.
Both defer to saxon-atributes.xsd for the atttribute definition, which refers back to config.xsd for the type definition (this is itself a bit questionable since it means we duplicate definitions between annotatedConfig.xsd and config.xsd -- I'm really not sure why we have both).
We need to use a new type listOfQNameOrWildcard type in place of listOfQNameType, defined as a (list of (union of(QName, string with enum="*"))).
(By the way, it's great to know that there are users visiting obscure corners of the product like this one, and telling us when they hit problems).
Updated by T Hata almost 5 years ago
Can you shed some light on this?
As a related question, what is the correct syntax to specify saxon:attribute-order="a b c * xml:space" in the second parameter (map) of
fn:serialize()
? It seems to reject*
for a reason similar toannotatedConfig.xsd
.
Updated by Debbie Lockett almost 5 years ago
T Hata wrote:
As a related question, what is the correct syntax to specify saxon:attribute-order="a b c * xml:space" in the second parameter (map) of
fn:serialize()
? It seems to reject*
for a reason similar toannotatedConfig.xsd
.
In the fn:serialize()
function, currently a value supplied for saxon:attribute
must be a sequence of xs:QNames. You are right, this is also a bug - it should also allow "*". So I think something like the following should work, but it currently raises an error.
serialize($v, map{'method':'xml', xs:QName('saxon:attribute-order'): (xs:QName('a'), xs:QName('b'), xs:QName('c'), '*', xs:QName('xml:space'))})
Adding xslt30extra test case -s:output-properties -t:attribute-order-004
Updated by Michael Kay almost 5 years ago
It's a bit of a shame to complicate the type signature (it becomes union(xs:QName, xs:string)*
which is only expressible using extensions)
But I can't immediately think of anything better. An array of two sequences perhaps? Or using some special QName as a separator? Perhaps even two separate serialization properties? None of these seems particularly attractive.
Updated by Michael Kay almost 5 years ago
I've changed the logic for fn:serialize() so it accepts a sequence of (QName or "*"). Patch committed for 9.9 and 10.0. The problem with the schema remains open.
Updated by Michael Kay almost 5 years ago
- Category set to Serialization
- Status changed from New to In Progress
- Applies to branch 9.9, trunk added
- Fix Committed on Branch 9.9, trunk added
Updated by Michael Kay almost 5 years ago
There are a number of problems to fix with config.xsd
(a) As mentioned, the type for saxon:attribute-order does not allow the "*" token.
(b) Several Saxon serialization properties are missing: saxon:canonical
, saxon:property-order
, saxon:single-quotes
(c) Properties that accept a list of QNames generally use the type listOfQNames. This is literally a list with item type xs:QName, which means that the lexical form does not allow a URIQualifiedName (Q{uri}local
). But the configuration reader certainly accepts this format.
(d) We programmatically expand the file config.xsd to annotatedConfig.xsd. This contains a reference to saxon-attributes.xsd, which in turn contains a reference back to config.xsd (not annotatedConfig.xsd).
Updated by Michael Kay almost 5 years ago
- Assignee set to Michael Kay
- Priority changed from Low to Normal
I've renamed config.xsd as config-raw.xsd; the build script now converts config-raw.xsd to config-xsd (previously it converted config.xsd to annotatedConfig.xsd). The schema is now updated to accept the Saxon extension attributes correctly.
Retrofitting the same changes to the 9.9 branch.
Updated by Michael Kay almost 5 years ago
- Status changed from In Progress to Resolved
- Fixed in Maintenance Release 10.0 added
Actually, there is no 9.9 branch for these files: in the repository, repo/samples/config does not have separate 9.9 and 10.0 branches. So the new files will be picked up when we rebuild saxon-resources-9.9 at a future maintenance release.
Updated by Debbie Lockett almost 5 years ago
- Status changed from Resolved to In Progress
- Assignee changed from Michael Kay to Debbie Lockett
9.9 samples are under opensource/latest9.9/samples
I'll make the relevant changes and updates for the 9.9 branch.
Updated by Debbie Lockett almost 5 years ago
- Status changed from In Progress to Resolved
9.9 samples and build file updated.
Updated by O'Neil Delpratt about 4 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.9.1.8 added
Bug fix applied on the Saxon 9.9.1.8 maintenance release.
Please register to edit this issue