Re: Default Attributes and XSD
Marko Hedler <[email protected]> Thu, 11 Mar 2021 17:18:19 +0100
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <[email protected]> |
Thanks for your response, we have one limitation: (only one single Transformation is allowed. Tried to use fn:tranform() to do the 2-step solution: works, but the performance ist too low. Marko > Indeed, this is not Saxon-specific, so may not be appropriate for this > particular list — happy to move this conversation to the XSLT list or > the XML Slack channel. > > In any case, my first thought is that a 2-step solution would be to > read in the schema (in this case XSD), and write out an XSLT that > itself reads in an instance and writes out the same with defaulted > attributes added. > > I wrote such a system that did the opposite — removed attributes that > had the default value — for RELAX NG over a decade ago. (I just > looked: 12.98 years ago. :-) > > ------------------------------------------------------------------------ > First it's useful to keep in mind that XSDs are not DTDs - most > particularly, DTDs have no notion of local declarations. > > This being the case, what you are asking is a tall order in the > general case - for any (conformant) XSD. > > It might not be so bad, however, for a particular XSD, if it happens > to follow coding conventions making it more like a DTD (and > simplifying the problem of matching attributes to their definitions). > The approach would probably be to reduce your XSD with a filter (XSLT) > into what would constitute essentially a lookup table for your > attribute defaults, then reference that from your main XSLT. > > Note this is not specifically a Saxon question, or answer. > > using XSLT with SaxonEE 10.3, I want all default attribute values > from a schema-valid XML instance to be expanded, but the > XSLT-Transformation itself must not be schema-ware. > > I would like to have the same behavior as transforming a DTD-valid > XML instance with Saxon. > > Any suggestions? Thanks in advance > > > > > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > [email protected] > https://lists.sourceforge.net/lists/listinfo/saxon-help -- ---------------------------------------------------------------- Dr. Marko Hedler Flurstraße 11 91555 Feuchtwangen 0179 750 2735 [email protected] _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ [email protected] https://lists.sourceforge.net/lists/listinfo/saxon-help