transpect:check-styles check-styles

pubcoach/xpl/check-styles.xpl

Import URI: http://transpect.le-tex.de/book-conversion/converter/xpl/check-styles.xpl

Visualisation

The pre-creation of this SVG image needs the Graphviz software installed. Please inform your project maintainer.

Input Ports

NameDocumentationConnections

source

html-in

parameters

Output Ports

NameDocumentationConnections

result

doc-and-template-styles

report

htmlreport

Please note that the HTML report will not reflect the differentiated styles. It will only do so if the report is rendered by a subsequent step. This is because the svrl in the output will be patched after the transpect:validate-with-schematron step.

Please note that the HTML report will not reflect the differentiated styles. It will only do so if the report is rendered by a subsequent step. This is because the svrl in the output will be patched after the transpect:validate-with-schematron step.

Options

NameDocumentationDefault

debug

'no'

debug-dir-uri

active

'true'

differentiate-by-style

This option will create a distinct error class for each missing style name. In order to use this option, you need to create a <span class="style-name"> in your schematron rule in your adaption’s styles.sch.xml, like this:


    <rule context="*[count($template-style-names) gt count($default-style-names)][@role][not(self::dbk:keywordset or self::dbk:keyword or self::dbk:tab)]">
      <let name="base-role" value="replace(@role, '(_-_|[~˜]).+$', '')" />
      <assert test="($base-role = $template-style-names) or (some $i in $template-style-regexes satisfies (matches(@role, $i)))" role="warning" id="sch_styles_undefined" diagnostics="sch_styles_undefined_de">
        <span class="srcpath"><xsl:value-of select="concat($base-dir, (@srcpath, ancestor::*[@srcpath][1]/@srcpath, .//@srcpath)[1])"/></span>
        Style '<span class="style-name"><xsl:value-of select="$base-role"/></span>' not found in allowed templates catalog 
        '<value-of select="string-join(tokenize(base-uri($template-styles[1]), '/')[position() ge last() - 4],'/')"/>'.</assert>
    </rule>

'false'

Subpipeline

StepInputsOutputsOptions

p:variable status-dir-uri

concat($debug-dir-uri, '/status')

letex:simple-progress-msg start-msg

source

source parameters on check-styles

msgs

 <c:messages>
   <c:message xml:lang="en">Starting Schematron check of used styles against list of permissible styles (look for 'styles' messages in the report)</c:message>
   <c:message xml:lang="de">Beginne Schematron-Prüfung der verwendeten Formatvorlagen gegen Positivliste (entspr. Meldungen tauchen unter der Rubrik 'styles' auf)</c:message>
 </c:messages>

result

file = 'check-styles-start.txt'

status-dir-uri = $status-dir-uri

transpect:load-cascaded template-styles

paths

parameters on check-styles

result

filename = 'styles/cssa.xml'

debug = $debug

debug-dir-uri = $debug-dir-uri

p:wrap-sequence doc-and-template-styles

source

source on check-styles

result on template-styles

result

wrapper = 'transpect:doc-and-template-styles'

transpect:validate-with-schematron sch

source

result on doc-and-template-styles

html-in

html-in on check-styles

parameters

parameters on check-styles

result

active = $active

debug = $debug

debug-dir-uri = $debug-dir-uri

p:sink d307e115

source

result on sch

p:split-sequence d307e117

transpect:validate-with-schematron may produce multiple reports. We know that we put in only one document, so we only select the first report.

source

report on sch

matched

initial-only = 'true'

test = 'true()'

p:choose potentially-differentiate-by-style

$differentiate-by-style = 'true'

p:xslt add-style-names-to-error-codes

source

matched on d307e117

parameters

p:empty

stylesheet

 <xsl:stylesheet version="2.0">
   <xsl:template match="* | @*">
     <xsl:copy>
       <xsl:apply-templates select="@*, node()"/>
     </xsl:copy>
   </xsl:template>
   <xsl:template match="svrl:failed-assert/@id[. = 'sch_styles_undefined']">
     <xsl:attribute name="{name()}" select="concat(., '_', ../svrl:text/s:span[@class = 'style-name'])"/>
   </xsl:template>
 </xsl:stylesheet>

result

p:otherwise

p:identity d307e162

source

matched on d307e117

result

letex:simple-progress-msg success-msg

source
msgs

 <c:messages>
   <c:message xml:lang="en">Successfully finished style checks</c:message>
   <c:message xml:lang="de">Formatvorlagenprüfung erfolgreich abgeschlossen</c:message>
 </c:messages>

result

file = 'check-styles-success.txt'

status-dir-uri = $status-dir-uri

p:sink d307e184

source

result on success-msg