Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xslt] annotation-prefixes #19

Closed
liamquin opened this issue Dec 14, 2020 · 3 comments
Closed

[xslt] annotation-prefixes #19

liamquin opened this issue Dec 14, 2020 · 3 comments
Labels
Feature A change that introduces a new feature XSLT An issue related to XSLT

Comments

@liamquin
Copy link

By analogy with Schema annotations, i'd like to see an annotation-prefixes attribute on xsl:stylesheet/transform containing a space-separated list of NCName namespace prefixes that are associated with annotations; the XSLT processor would discard these elements (including children) during compilation. Here's a rough go at some text.

The purpose is to be able to include annotations at any level where elements are allowed - for example, inside an xl:variable or template or function body. Annotations might include XTest unit tests, Schmatron rules, human-readable documentation, CSS styles, or more, and could be used by other operations than the XSLT transformation: for example, by processing the XSLT source itself with XSLT.

It should be possible for the same element to be both an extension element and an annotation, but the behaviour is implementation-dependent in this case (for example, an API might allow an extension to access content or convert the annotation elements to something else on compilation).

XSLT instructions occurring inside annotation elements are ignored along with other content, except for xsl:fallback instructions (and their contents) if the prefix was also declared as an extension prefix and no matching extension was found. Similarly, extension attributes are discarded. The fallback behaviour might be used to support an XSLT-based implementation, for example by reading the XSLT source and processing embedded Schematron tests.

Attributes of annotation elements are not considered to be attribute value templates and content is not considered to be text value templates - that is, { and } are not special. However, an annotation element or attribute backed by an extension could perform such processing if an implementation supported it. The behaviour of shadow annotation attributes and xsl:use-when is implementation defined, but expressions contained in them must be processed as elsewhere.

@michaelhkay
Copy link
Contributor

I did actually experiment with this idea (I called it documentation-prefixes) but didn't pursue it because the details got quite complicated (like everything to do with namespaces). Although I didn't take it quite as far as this; my main aim was to ensure that namespaces declared only for use in top-level "data elements" had no effect on run-time execution (exclude-result-prefixes stops them being used by literal result elements, but not by other things that use the static namespace context at run-time, e.g. the xs:QName() constructor function).

@liamquin
Copy link
Author

liamquin commented Dec 18, 2020 via email

@michaelhkay
Copy link
Contributor

This issue can be closed following adoption of PR #353 (xsl:note)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature A change that introduces a new feature XSLT An issue related to XSLT
Projects
None yet
Development

No branches or pull requests

3 participants