Re: Default Attributes and XSD

"Dr. Marko Hedler" <hedler-2h7L2rogWU5dW/[email protected]> Sat, 13 Mar 2021 10:45:46 +0100
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
Hello Michael,
> Validating XML against a schema will expand the attribute values and will also add type annotations to the nodes.
>
> There are many ways you can retain the expanded defaults while discarding the type annotations, The simplest way is just to serialize the XML immediately after validation - with s9api, just send the output of a SchemaValidator to a Serializer. The s9api interface tends to work much better for this than JAXP interfaces because it's more tightly integrated (JAXP, for example, struggles if you want to separate schema validation from XML parsing).
Thanks a lot for your explanation. At first I thought, there was an 
option in saxon which handles default attribute expansion and type 
annotations seperately. That's why I put the problem in this group.
> The constraint of only doing one transformation pass seems a rather artificial one and I'm not sure what the real constraint is. Similarly, the constraint of not doing schema-aware transformation.

The one-pass-constraint comes from a legacy software component, which 
wraps the transformation and cannot be changed at the moment. The 
non-schema-aware transformation constraint comes from the fact, that we 
want to move from a DTD-based project (huge XSLT), to a XSD-based 
workflow. The first step should be getting the existing stylesheet to run.

Marko

>
> Michael Kay
> Saxonica
>
>> On 12 Mar 2021, at 12:49, Christophe Marchand <[email protected]> wrote:
>>
>> Marko, you can have a look at a custom SAXParserFactory [1] that *should* be able to load files with default values from schema, if schema is referenced from XML with a xsl:schemaLocation  or a xsi:noNamespaceSchemaLocation.
>>
>> I had no time to test it, but you should be able to start Saxon with this Factory from command line (-x:... option).
>>
>> Feel free to use this code as you like, but be careful, it is not tested, and there are strict limitations, mainly multiple schema are not supported.
>>
>> Hope that helps,
>> Christophe
>>
>> Le 11/03/2021 à 20:30, Marko Hedler a écrit :
>>> Hi Wendell,
>>>> If on the other hand the XSD is relatively stable, a way to do this
>>>> would be to run an XSLT to produce your list of values from the schema
>>>> (once), then use that values list (expressed in XML or XSLT) as a
>>>> component within your XSLT runtime (many times). So the two passes are
>>>> distinct and loosely coupled. You are merely giving your XSLT a "look
>>>> up a default" capability, then externalizing the declarations in your
>>>> XSD to support that.
>>> I think, this could be the way to go. I'll give it a try.
>>>
>>> Thanks a lot.
>>> Cheers
>>> Marko
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> saxon-help mailing list archived at http://saxon.markmail.org/
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/saxon-help
>>
>> _______________________________________________
>> saxon-help mailing list archived at http://saxon.markmail.org/
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help


-- 

Hochschule der Medien
Prof. Dr.-Ing. Marko Hedler
Publishing - Cross-Media-Systeme
Nobelstrasse 10
70569 Stuttgart

Tel: 0711/8923-2141
Fax: 0711/8923-2180



_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help