- Allow foreign elements in Schematron

- Add some embedded XSLT to improve the input of validation failures
This commit is contained in:
Gabor Kovesdan 2013-04-03 10:56:14 +00:00
parent e8e2dfdbab
commit ffd8fc666f
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/projects/xml-tools/; revision=41361
2 changed files with 12 additions and 6 deletions

View file

@ -338,7 +338,7 @@ NO_RTF= yes
schxslts+= ${sch}.xsl
${sch}.xsl: ${sch}
${XSLTPROC} ${XSLSCH} ${.ALLSRC} > ${.TARGET}
${XSLTPROC} --param allow-foreign "true" ${XSLSCH} ${.ALLSRC} > ${.TARGET}
.endfor
.endif

View file

@ -2,11 +2,17 @@
<!-- $FreeBSD$ -->
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
<schema xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<pattern name="Check file reference validity">
<rule context="//imagedata|//graphic">
<report test="contains(@fileref, '.')">Image references cannot have an extension; the proper format is inferred by the output type to generate.</report>
<report test="@format">Image format must not be specified; it is inferred by the output type to generate.</report>
<report test="contains(@fileref, '.')">Image reference (<xsl:value-of select="@fileref"/>) cannot have an extension; the proper format is inferred by the output type to generate.</report>
<report test="@format">Image reference (<xsl:value-of select="@fileref"/>) format must not be specified; it is inferred by the output type to generate.</report>
</rule>
</pattern>
<pattern name="Check cross-reference validity">
<rule context="//link">
<assert test="* or normalize-space()">Link (<xsl:value-of select="@linkend"/>) element must have a content; or use xref to auto-generate the linking text.</assert>
</rule>
</pattern>
@ -20,10 +26,10 @@
<pattern name="Check profiling attributes">
<rule context="//*/@edition">
<assert test="(. = 'online') or (. = 'print')">The edition attribute can only be set to 'online' or "print".</assert>
<assert test="(. = 'online') or (. = 'print')">Invalid edition value (<xsl:value-of select="."/>); must be either 'online' or "print".</assert>
</rule>
<rule context="//*/@os">
<assert test="(. = 'freebsd8') or (. = 'freebsd9') or (. = 'freebsd10')">The os attribute can only be set to 'freebsd8', 'freebsd9' or 'freebsd10'.</assert>
<assert test="(. = 'freebsd8') or (. = 'freebsd9') or (. = 'freebsd10')">Invalid os value (<xsl:value-of select="."/>); must be either 'freebsd8', 'freebsd9' or 'freebsd10'.</assert>
</rule>
</pattern>
</schema>