Created
June 10, 2022 16:18
-
-
Save dmj/cf011c1790444ba36c2aece1b38a6c55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<document attribute="some value"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt3" | |
xmlns:svrl="http://purl.oclc.org/dsdl/svrl" | |
xmlns:fun="tag:[email protected],2022:SchematronFun" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<ns prefix="fun" uri="tag:[email protected],2022:SchematronFun"/> | |
<ns prefix="svrl" uri="http://purl.oclc.org/dsdl/svrl"/> | |
<xsl:function name="fun:parse" as="element(parsed-attribute)"> | |
<xsl:param name="attribute" as="attribute()"/> | |
<parsed-attribute xmlns=""/> | |
</xsl:function> | |
<xsl:function name="fun:validate" as="element(svrl:schematron-output)"> | |
<xsl:param name="document" as="node()"/> | |
<xsl:variable name="result" as="map(*)" | |
select="transform(map{'stylesheet-node': document(''), 'source-node': $document })"/> | |
<svrl:schematron-output> | |
<xsl:sequence select="$result?output"/> | |
</svrl:schematron-output> | |
</xsl:function> | |
<pattern> | |
<rule context="document"> | |
<let name="parsed-attribute" value="fun:parse(@attribute)"/> | |
<let name="sub-validation-report" value="fun:validate($parsed-attribute)"/> | |
<report test="$sub-validation-report//svrl:failed-assert" properties="sub-validation-report"/> | |
</rule> | |
</pattern> | |
<pattern> | |
<rule context="parsed-attribute"> | |
<assert test="false()"/> | |
</rule> | |
</pattern> | |
<properties> | |
<property id="sub-validation-report"> | |
<xsl:copy-of select="$sub-validation-report"/> | |
</property> | |
</properties> | |
</schema> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment