Skip to content

Allow query language expressions in element content #41

@AndrewSales

Description

@AndrewSales

This was mentioned during the users meetup at XML Prague 2022, so am capturing here for further discussion.

IIRC the rationale was that it might prove awkward for some query languages to be expressed in attribute values. So the proposal here is to allow a single (presumably first) child element to optionally contain this instead.
To be clear, the proposal is not to replace the current markup, but to give the option to use elements instead of attributes.
See also #22 (comment).

Example:

<rule context='foo'>
<assert test='@bar'>Element <name/> must have a bar attribute.</assert>
</rule>
<rule>
  <context>foo</context>
  <assert><test>@bar</test>Element <name/> must have a bar attribute.</assert>
</rule>

This would mean that if a schema is pre-processed (e.g. via a transform), attribute value normalization would not of course be applied to expressions appearing in element content, which in turn may be of benefit to users to whom the formatting of expressions matters.

It might be argued that such users could author using the idiom in the second example above (or their own variant) and generate a valid Schematron schema from that -- but I think it would be useful to standardize this and be able to do so natively, and it may also smooth the path for other query language bindings for which the current syntax poses difficulties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions