Skip to content

Instantly share code, notes, and snippets.

@etoyoda
Created July 20, 2022 17:55
Show Gist options
  • Save etoyoda/1eb5c26e9383f840e157496bc6982fc0 to your computer and use it in GitHub Desktop.
Save etoyoda/1eb5c26e9383f840e157496bc6982fc0 to your computer and use it in GitHub Desktop.
XSLT stylesheet to extract Schematron 1.5 embedded in RELAX NG
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s="http://www.ascc.net/xml/schematron"
xmlns:rng="http://relaxng.org/ns/structure/1.0"
>
<xsl:output method="xml" indent="yes" standalone="yes"/>
<xsl:template match="/rng:grammar">
<s:schema>
<xsl:copy-of select=".//s:ns"/>
<s:pattern name="schematron">
<xsl:for-each select=".//s:rule">
<xsl:copy-of select="."/>
</xsl:for-each>
</s:pattern>
</s:schema>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment