xslt - Loading permitted XML attribute values to a RELAX NG grammar file - Stack Overflow

admin2025-04-19  0

I have a Relax NG grammar file. I would like to load permitted attribute values from an XML file. Would it be possible to load those values from a normal XML file or do I need to generate a RELAX NG file from this XML file with XSLT first? This would feel wrong to me.

<element name="language">
  <externalRef href="language.rng"/>
</element>

I have a Relax NG grammar file. I would like to load permitted attribute values from an XML file. Would it be possible to load those values from a normal XML file or do I need to generate a RELAX NG file from this XML file with XSLT first? This would feel wrong to me.

<element name="language">
  <externalRef href="language.rng"/>
</element>
Share Improve this question edited Mar 4 at 13:01 Stefan Jung asked Mar 4 at 12:55 Stefan JungStefan Jung 1,28811 silver badges20 bronze badges 1
  • 1 Relax NG can't directly grab the allowed attribute values from just any old XML file, especially one that isn't a Relax NG file itself. In other words, if you have your allowed values stored in a plain XML file, you'll need to preprocess "converting" the data (maybe with something like XSLT) into a Relax NG module. Then you can use <externalRef> to bring that module into your grammar. – Lorenzo Castagno Commented Mar 4 at 13:05
Add a comment  | 

1 Answer 1

Reset to default 0

Instead of transforming your list of acceptable values into RelaxNG form, an alternative possibility is to supplement your RelaxNG schema with a Schematron schema, which is capable of validating attributes against an external list of values. https://schematron/

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745042301a281617.html

最新回复(0)