Schematron complains about AVT for xml:id Attribute
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 87
- Joined: Tue Jan 01, 2013 3:19 pm
Schematron complains about AVT for xml:id Attribute
Hi,
i am writing an XSLT 3.0 stylesheet for documentation (in docbook) of relax ng grammars. There is a function called rng:define-id (rng:define) which computes, for a given rng:define element, the value of the corresponding id attribute. The function has this signature:
Transformation of a rng:define element into a docbook section should be done with a template like this:
However, Validation of the XSLT Stylesheet shows an error with the AVT for the xml:id attribute: The value '{rng:define-id(.)}' is not a valid xs:ID
The error will vanish when i use an explicit xsl:attribute element instead:
It will also vanish when i use any other name für the attribute (xml:bid for example).
Is it illegal to use attribute value template for an xml:id attribute in xslt/xpath 3.0? Or is it a bug in the validation of xslt Stylesheets?
Sincerely,
Frank
i am writing an XSLT 3.0 stylesheet for documentation (in docbook) of relax ng grammars. There is a function called rng:define-id (rng:define) which computes, for a given rng:define element, the value of the corresponding id attribute. The function has this signature:
Code: Select all
<xsl:function name="rng:define-id" as="xs:ID">
Code: Select all
<section xmlns="http://docbook.org/ns/docbook" xml:id="{rng:define-id(.)}">
The error will vanish when i use an explicit xsl:attribute element instead:
Code: Select all
<xsl:attribute name="xml:id" select="rng:define-id(.)"/>
Is it illegal to use attribute value template for an xml:id attribute in xslt/xpath 3.0? Or is it a bug in the validation of xslt Stylesheets?
Sincerely,
Frank
-
- Posts: 9451
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Schematron complains about AVT for xml:id Attribute
Hi Frank,
If you send us via email (support@oxygenxml.com) a small sample set of files (XML + XSLT) we could try to take a look on our side, see if it's a problem in the additional Schematron rules we created to validate XSLT.
Do both approaches work when actually applying the XSLT on the XML?
Regards,
Radu
If you send us via email (support@oxygenxml.com) a small sample set of files (XML + XSLT) we could try to take a look on our side, see if it's a problem in the additional Schematron rules we created to validate XSLT.
Do both approaches work when actually applying the XSLT on the XML?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 87
- Joined: Tue Jan 01, 2013 3:19 pm
Re: Schematron complains about AVT for xml:id Attribute
Hi Radu,
i tried to reproduce on another computer (but same Oxygen Version, i think) and failed at first.
The error appeared again when i checked the "Use Saxon-EE (schema-aware) for xslt2 query language binding" option in XML / XML Parser / Schematron.
Since the XSLT Script does not compile (when this option is checked), i'm unable to apply it to any XML input.
I think this bug is not crucial since there is allways the workaround with an explicit <xsl:attribute ... /> expression.
Thanks,
Frank
i tried to reproduce on another computer (but same Oxygen Version, i think) and failed at first.
The error appeared again when i checked the "Use Saxon-EE (schema-aware) for xslt2 query language binding" option in XML / XML Parser / Schematron.
Since the XSLT Script does not compile (when this option is checked), i'm unable to apply it to any XML input.
I think this bug is not crucial since there is allways the workaround with an explicit <xsl:attribute ... /> expression.
Thanks,
Frank
-
- Posts: 9451
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Schematron complains about AVT for xml:id Attribute
Hi Frank,
Thanks for the details, now I can reproduce the problem on my side and I will add an internal issue for it.
We have a couple of extra Schematron-based validation steps when validating an XSLT stylesheet and one of those steps is the one which complains about this.
If you want to bypass this extra validation stage on your side, in the Oxygen Preferences->"Document Type Association" page you can Extend the "XSLT" document type association and in the Validation tab you can edit the default XSLT validation scenario and remove from it the last 3 stages which are all Schematron-based.
Regards,
Radu
Thanks for the details, now I can reproduce the problem on my side and I will add an internal issue for it.
We have a couple of extra Schematron-based validation steps when validating an XSLT stylesheet and one of those steps is the one which complains about this.
If you want to bypass this extra validation stage on your side, in the Oxygen Preferences->"Document Type Association" page you can Extend the "XSLT" document type association and in the Validation tab you can edit the default XSLT validation scenario and remove from it the last 3 stages which are all Schematron-based.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 389
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Schematron complains about AVT for xml:id Attribute
Hi Frank,
When an XSLT is validated using Schematron, the XSLT is considered to be an XML document. Therefore, the attribute value template from the value of the "xml:id" attribute ({rng:define-id(.)}) will not be evaluated, and it is not a valid xs:ID. I think it is correct to get this error if you validate the XSLT with Schematron and Saxon-EE (schema-aware).
Best Regards,
Octavian Nadolu
When an XSLT is validated using Schematron, the XSLT is considered to be an XML document. Therefore, the attribute value template from the value of the "xml:id" attribute ({rng:define-id(.)}) will not be evaluated, and it is not a valid xs:ID. I think it is correct to get this error if you validate the XSLT with Schematron and Saxon-EE (schema-aware).
Best Regards,
Octavian Nadolu
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 87
- Joined: Tue Jan 01, 2013 3:19 pm
Re: Schematron complains about AVT for xml:id Attribute
Hi Octavian,
ok, i see the problem. This is interesting. I was wrong assuming that schematron complains the AVT. It is, in fact, the Saxon engine which complains about the XSLT Stylesheet which results from compilation of Schematron as beeing invalid XML.
Attribute value templates are defined in section 5.6.1 of the XSLT 3.0 Spec. Its a XSLT feature. What i understand from your explanation means that the use of this feature may -under specific circumstances - lead to Stylesheets which are invalid XML files. This surprises me. But of course the XML validation engine does not know anything about this XSL feature called AVT.
The next interesting and very surprinsing observation is, that the XSLT file (result of compiling Schematron to XSLT) with AVT in places, where an xsd:ID type is expected, runs perfectly well although it is a technically invalid XML file. The XSLT engine loads the invalid XML file, silently replacingthe string within curly brackets by its value at runtime. As described in section 5.6.1 of the spec, thereby correcting the error.
I would expect that the XSLT Specification explains this situation, but i can't find it.
Once again,
thanks for the explanation
ok, i see the problem. This is interesting. I was wrong assuming that schematron complains the AVT. It is, in fact, the Saxon engine which complains about the XSLT Stylesheet which results from compilation of Schematron as beeing invalid XML.
Attribute value templates are defined in section 5.6.1 of the XSLT 3.0 Spec. Its a XSLT feature. What i understand from your explanation means that the use of this feature may -under specific circumstances - lead to Stylesheets which are invalid XML files. This surprises me. But of course the XML validation engine does not know anything about this XSL feature called AVT.
The next interesting and very surprinsing observation is, that the XSLT file (result of compiling Schematron to XSLT) with AVT in places, where an xsd:ID type is expected, runs perfectly well although it is a technically invalid XML file. The XSLT engine loads the invalid XML file, silently replacingthe string within curly brackets by its value at runtime. As described in section 5.6.1 of the spec, thereby correcting the error.
I would expect that the XSLT Specification explains this situation, but i can't find it.
Once again,
thanks for the explanation
-
- Posts: 389
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Schematron complains about AVT for xml:id Attribute
Hi Frank,
In fact Saxon complains about the validation of the XSLT file with Schematron, because the validation with Schematron is schema-aware and the XSLT (that is just an XML for this validation) has an invalid "xml:id" attribute value. The validation of the XSLT with Schematron it is not always perfect, but impose some quality assurance rules for the XSLT. These rules will detect when variable or parameter names conflict with names of elements or attributes used in XPath expressions and issue a warning, or inform the user to add documentation for templates and functions
You can deactivate them from Oxygen Preferences->"Document Type Association" page you can Extend the "XSLT" document type association and in the Validation tab you can edit the default XSLT validation scenario and remove from it the last 3 stages which are all Schematron-based.
Best Regards,
Octavian
In fact Saxon complains about the validation of the XSLT file with Schematron, because the validation with Schematron is schema-aware and the XSLT (that is just an XML for this validation) has an invalid "xml:id" attribute value. The validation of the XSLT with Schematron it is not always perfect, but impose some quality assurance rules for the XSLT. These rules will detect when variable or parameter names conflict with names of elements or attributes used in XPath expressions and issue a warning, or inform the user to add documentation for templates and functions
You can deactivate them from Oxygen Preferences->"Document Type Association" page you can Extend the "XSLT" document type association and in the Validation tab you can edit the default XSLT validation scenario and remove from it the last 3 stages which are all Schematron-based.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service