[Schematron] XPath after a triggered error message of an assert

G. Ken Holman gkholman at CraneSoftwrights.com
Sat Dec 12 20:02:44 EST 2009


At 2009-12-13 13:57 +1300, DMS Lists wrote:
>May I ask for some help with this:
>
>I have two 'similar' implementations (Crane CVA-to-Schematron) that 
>transform Schematron into XSL. They both produce correct error 
>outputs, but show one distinct difference:
>
>- One implementation has every triggered error message automatically 
>appended with the XPath of the offending context. (i.e. the XPath 
>appears to be added somewhere automatically in the transformation.)
>- The other implementation correctly triggers the same error, but 
>instead of the XPath it appends the actual data VALUE(S) of the 
>offending context node. (once again, that appears to be done 
>automatically behind the scenes.)
>
>I wish to migrate to the second implementation, but it should also 
>list the offending XPath before we do so.
>
>a) Of all the various artefacts in the Schematron-to-XSL transform, 
>which one is responsible for adding the context XPath after an error message?

Please see the "process-message" template in 
Message-Schematron-terminator.xsl where the message is processed and 
then followed by the XPath address.  The XPath address is added using 
the "schematron-get-full-path-3" mode found in the skeleton.

>b) What can cause the differing outputs?

In the older implementation a different wrapper for the skeleton was used.

There are a number of wrappers available for the skeleton.  I don't 
think the Schematron site yet includes my latest 
Message-Schematron-terminator.xsl wrapper, but I find it a very 
useful deployment of the skeleton.  That it uses <xsl:message 
terminate="yes"> will for most XSLT processors put the message to the 
error port (2) and return a non-zero return code that can be tested 
in shell/batch script invocation.

I hope this helps.

. . . . . . . . Ken

--
XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman at CraneSoftwrights.com
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal



More information about the Schematron mailing list