Skip to content

Callback API

David Maus edited this page Jun 3, 2019 · 1 revision

SchXslt follows the footsteps of the Skeleton implementation and lets you customize the reporting output. The callback API defines named templates that are called to create the parts of the validation stylesheet that report on active patterns, fired rules, failed asserts and successful asserts. The names of these templates live in the dedicated namespace https://doi.org/10.5281/zenodo.1495494#api which is conventionally bound to the prefix schxslt-api.

As of version 1.2 of SchXslt the API defines the following named templates:

schxslt-api:validation-stylesheet-body-top-hook (since 1.2)

Contribute to the top part of the validation stylesheet.

<xsl:template name="schxslt-api:validation-stylesheet-body-top-hook">
  <xsl:param name="schema" as="element(sch:schema)" required="yes"/>
</xsl:template>

schxslt-api:validation-stylesheet-body-bottom-hook (since 1.2)

Contribute to the bottom part of the validation stylesheet.

<xsl:template name="schxslt-api:validation-stylesheet-body-bottom-hook">
  <xsl:param name="schema" as="element(sch:schema)" required="yes"/>
</xsl:template>

schxslt-api:report

Create part of the validation stylesheet that creates the report. This template is called after the report has been gathered.

<xsl:template name="schxslt-api:report">
  <xsl:param name="schema" as="element(sch:schema)" required="yes"/>
  <xsl:param name="phase" as="xs:string" required="yes"/>
</xsl:template>

The content of the report is available in the variable schxslt:report.

schxslt-api:active-pattern

Create part of the validation stylesheet that reports an active pattern.

<xsl:template name="schxslt-api:active-pattern">
  <xsl:param name="pattern" as="element(sch:pattern)" required="yes"/>
</xsl:template>

schxslt-api:fired-rule

Create part of the validation stylesheet that reports a fired rule.

<xsl:template name="schxslt-api:fired-rule">
  <xsl:param name="rule" as="element(sch:rule)" required="yes"/>
</xsl:template>

schxslt-api:failed-assert

Create part of the validation stylesheet that reports a failed assert.

  <xsl:template name="schxslt-api:failed-assert">
    <xsl:param name="assert" as="element(sch:assert)" required="yes"/>
  </xsl:template>

schxslt-api:successful-report

Create part of the validation stylesheet that reports a successful report.

  <xsl:template name="schxslt-api:successful-report">
    <xsl:param name="report" as="element(sch:report)" required="yes"/>
  </xsl:template>