Schematron rules to HTML rendering


Table of Contents

1. Schematron rules to HTML rendering - Crane-sch2html.xsl
1.1. Invocation
1.2. Stylesheet logic
2. Index

Available invocation parameter

1. Schematron rules to HTML rendering - Crane-sch2html.xsl

Filename: Crane-sch2html.xsl

$Id: Crane-sch2html.xsl,v 1.24 2008/07/04 21:56:25 gkholman Exp $

This renders a summary of the messages that may be reported from a Schematron schema. See the associated sch2html.bat for an example invocation from a Windows-based system.

Copyright (C) - Crane Softwrights Ltd. 

Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, 
  this list of conditions and the following disclaimer. 
- Redistributions in binary form must reproduce the above copyright notice, 
  this list of conditions and the following disclaimer in the documentation 
  and/or other materials provided with the distribution. 
- The name of the author may not be used to endorse or promote products 
  derived from this software without specific prior written permission. 

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 
NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Note: for your reference, the above is the "Modified BSD license", this text
      was obtained 2002-12-16 at http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
  

1.1. Invocation

Using stylesheet association one can reference the stylesheet at the top of the Schematron schema for automatic invocation by an aware processor:

<?xml-stylesheet type="text/xsl" href="Crane-sch2html.xsl"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron" ...

Alternatively, one can invoke the stylesheet with a copy of the input filename as a passed parameter.

Note that for Windows systems the Windows Manager icon for the supplied Crane-sch2html.bat file can be used in a drag-and-drop fashion to create an HTML file without using the command prompt. Just drop the icon for the Schematron schema on top of the icon for the batch file.

inFileName as="xsd:string" select="''" (xsl:param)

This argument passed during invocation is the filename of the input file used for reporting.

If this is empty, the stylesheet will attempt to figure it out for itself.

If the stylesheet cannot do so, the arbitrary string Input Schematron file is used.

1.2. Stylesheet logic

Note that throughout the stylesheet where you see a select with "/*/sch:include/@href" in fact it should work with "//sch:include/@href" but apparently that doesn't in Internet Explorer.

s:inFileName as="xsd:string" (xsl:variable)

The calculation of the filename for use in reporting.

s:first select="document('',/)" as="document-node()" (xsl:variable)

The input document expressed as a document tree using the document() function, because "document('',/)" may be different than "/".

match="/" (xsl:template)

Getting started

s:find-all (xsl:template)

Determine all of the fragments in the entire schema, relying on the XPath union of node sets not duplicating the same node.

Parameter hrefs as="attribute(href)*" required="yes"

All of the include directive attributes found so far.

s:report-one (xsl:template)

Do all processing for one fragment.

Parameter this as="document-node()" required="yes"

The document fragment being processed

Parameter hrefs as="attribute(href)*" required="yes"

All of the include directive attributes.

match="sch:include" (xsl:template)

Report on an include found in play not in a pattern

Parameter hrefs as="attribute(href)*" required="yes"

All of the include directive attributes.

Parameter fragment as="xsd:string"

The string by which the fragment is referenced.

match="sch:pattern" (xsl:template)

Report on a pattern

Parameter hrefs as="attribute(href)*" required="yes"

All of the include directive attributes.

Parameter fragment as="xsd:string"

The string by which the fragment is referenced.

match="sch:include" mode="s:in-pat" (xsl:template)

Report on an include found in play in a pattern

Parameter hrefs as="attribute(href)*" required="yes"

All of the include directive attributes.

Parameter pattern as="xsd:string"

The string by which the pattern is referenced.

match="sch:rule" mode="s:in-pat" (xsl:template)

Report on a rule when in a pattern.

Parameter pattern as="xsd:string"

The ordinal of the pattern being reported.

match="sch:rule" (xsl:template)

Report on a rule when not in a pattern.

Parameter pattern as="xsd:string"

The ordinal of the pattern being reported.

s:rule-report (xsl:template)

Report common information for all rules.

Parameter pattern as="xsd:string"

The ordinal of the pattern being reported.

match="sch:assert | sch:test" (xsl:template)

Report a message's content

Parameter rule as="xsd:string"

The ordinal of the rule being reported.

match="sch:*" (xsl:template)

Report all Schematron vocabulary constructs in italics.

Include the "select" attribute where present.

s:fragment-title (xsl:template)

Generate the title for the given fragment

Parameter this as="document-node()" required="yes"

The document fragment being processed

Parameter hrefs as="attribute(href)*" required="yes"

All of the pointers to document fragments.

2. Index

F I R

F

I

R