[Schematron] Two significant problems with iso_schematron_skeleton_for_saxon.xsl

Lists DMS lists at d-m-s.co.nz
Wed Dec 14 20:09:27 EST 2011


Hi,

I observe that Ken Holman's post last week has so far gone without replies.

I am a user of iso_schematron_skeleton_for_saxon.xsl, and without sufficient
understanding of XSLT to comprehend the skeleton's logic.

What should a user like me do when an issue with the skeleton is identified?
I realise that the skeleton has been generously provided by volunteers. A
big 'thank you' goes to the volunteers! But does that imply that users are
expected to hack their local copies as required, or is there a desire to
maintain a master skeleton with new versions published?

Thank you for sharing your views on evolving the skeleton.

Juerg Tschumperlin
http://www.d-m-s.co.nz
Wellington, New Zealand


> -----Original Message-----
> From: schematron-bounces at eccnet.com [mailto:schematron-bounces at eccnet.com]
On
> Behalf Of G. Ken Holman
> Sent: Wednesday, 7 December 2011 11:31 a.m.
> To: Schematron Users
> Subject: [Schematron] Two significant problems with
> iso_schematron_skeleton_for_saxon.xsl
> 
> I've just unfortunately spent an inordinate amount of time I don't have
> helping a Schematron user work with UBL documents in an XSLT 2
environment,
> discovering two significant problems in the
> iso_schematron_skeleton_for_saxon.xsl file that have been the roots of his
> problem.
> 
> These problems do not exist in the XSLT 1 environment and have been
introduced
> in the XSLT 2 environment for Schematron (at least for the Saxon version).
> 
> Users of UBL who use Crane's "Context/Value Association to Schematron"
> conversion environment have no problems using XSLT 1:
> 
>    http://www.CraneSoftwrights.com/resources/ubl/#cva2sch
> 
> This particular user adapted my code in his environment for XSLT 2 and the
> following skeleton problems have come to light:
> 
> (1) The auto-detect of the use of attributes in context expressions does
not
> accommodate rules that are incorporated in the schema using the
<sch:include>
> directive ... it appears to only look at the rules found in the base
schema:
> 
> <xsl:param name="attributes">
>    <xsl:choose>
>      <xsl:when test="//iso:rule[contains(@context,'@') or
> contains(@context,'attribute')]">true</xsl:when>
>      <xsl:otherwise>false</xsl:otherwise>
>    </xsl:choose>
> </xsl:param>
> 
> The away around the above is to assemble all of the fragments into a
single
> Schematron schema, and then the "//iso:rule" will visit all of the rules
in
> the full schema.  But the above will not work if the schema stays in
> fragments.
> 
> (2) Even passing an arbitrary value of "true" for $attributes at
invocation
> still does not add the attribute pattern to the context XPath because of
the
> following top-level variable:
> 
> <xsl:variable name="context-xpath">
>    <xsl:if test="$attributes='true' and parent::node() ">@*|</xsl:if>
>    <xsl:choose>
>      <xsl:when test="$only-child-elements='true'">*</xsl:when>
>      <xsl:when test="$visit-text='true'">node()</xsl:when>
>      <xsl:otherwise>*|comment()|processing-instruction()</xsl:otherwise>
>    </xsl:choose>
> </xsl:variable>
> 
> My understanding is that in XSLT top-level variables are evaluated
assuming
> the context of the document node of the input document.  This document
node
> has no parent.  The "and parent::node()" expression above will *always*
> evaluate to false, thus never adding "@*|" to the XPath expression.  My
read
> of the above is that in this stylesheet it is impossible to trigger the
> inclusion of attributes in the search contexts of the stylesheet created
by
> Schematron.  Why would it have been included and how was it tested?
> 
> I have suggested the user hack the above to be:
> 
>    <xsl:if test="$attributes='true'">@*|</xsl:if>
> 
> ... and to use "attributes=true" on the command line when invoking the
> stylesheet with a fragmented Schematron schema in order to avoid the auto-
> detect bug of not looking for attributes in rules of included Schematron
> fragments.
> 
> The user is now successfully detecting attributes in his input data.  No
> changes were needed for Crane's environment ... the problem was entirely
in
> the skeleton.
> 
> Please advise if I have misunderstood the situation.
> 
> I hope this helps in the maintenance of the skeleton.  Certainly users of
the
> OASIS code list environment for documents with attributes (as in UBL) will
> appreciate the skeleton being fixed.
> 
> . . . . . . . . . Ken
> 
> --
> Contact us for world-wide XML consulting and instructor-led training Free
5-
> hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/t37DVX
> Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
> G. Ken Holman                   mailto:gkholman at CraneSoftwrights.com
> Google+ profile: https://plus.google.com/116832879756988317389/about
> Legal business disclaimers:    http://www.CraneSoftwrights.com/legal
> 
> _______________________________________________
> Schematron mailing list
> Schematron at eccnet.com
> http://www.eccnet.com/mailman/listinfo/schematron




More information about the Schematron mailing list