This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 4618 - Fix sch:rule samples to comply with the Schematron specification
Summary: Fix sch:rule samples to comply with the Schematron specification
Status: RESOLVED FIXED
Alias: None
Product: SML
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: Second draft
Assignee: Virginia Smith
QA Contact: SML Working Group discussion list
URL:
Whiteboard:
Keywords: resolved
Depends on:
Blocks: 4691
  Show dependency treegraph
 
Reported: 2007-06-10 01:48 UTC by Pratul Dublish
Modified: 2007-08-23 08:01 UTC (History)
0 users

See Also:


Attachments

Description Pratul Dublish 2007-06-10 01:48:19 UTC
Several samples of sch:rule in the spec specify a query expression with deref function as the value of sch:rule/@context. These samples do not comply with the Schematron spec and hence should be fixed. The non-compliant samples occur in Section 4 and Appendix III 

The Schematron standard defines a matching semantic for the sch:rule/@context attribute.  This semantic is not immediately obvious from the spec  which is why these errors have survived for so long. Annex C of Schematron spec states that
"The rule context is interpreted according to the Production 1 of XSLT. The rule context may be the root node,elements, attributes, comments and processing instructions"

This matching semantic is identical to that of XSLTs xsl:template/@match attribute.  The value of this attribute is an XPath expression, but its not a query  its an XSLT Pattern production, as defined by XSLT Pattern [1] at http://www.w3.org/TR/xslt#patterns:

A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.

However, not all XPath expressions that can be evaluated using the query semantic are valid patterns that can be used with the matching semantic.  In particular, patterns do not allow function calls except in a predicate (a part of an XPath expression enclosed in square brackets).  Therefore, samples such as <sch:rule context="smlfn:deref(sm:Applications/sm:Application)"> are invalid.
Comment 1 Virginia Smith 2007-08-23 01:37:06 UTC
changed the text(in 2 places in section 4) from:

<sch:rule context="smlfn:deref(u:Students/u:Student)">
  <sch:assert test="starts-with(u:ID,'99')">
      The specified ID <sch:value-of select="string(u:ID)"/> 
      does not begin with 99
  </sch:assert>

to:

<sch:rule context="u:Students/u:Student">
  <sch:assert test="smlfn:deref(.)[starts-with(u:ID,'99')]">
    The specified ID <sch:value-of select="string(u:ID)"/>
    does not begin with 99.
</sch:assert>



-------
Changed appendix C from:
	    <sch:rule context="smlfn:deref(sm:Applications/sm:Application)">
	      <sch:report test="sm:SecurityLevel!='High'">
		Application <sch:value-of select="string(sm:Name)"/>
		from <sch:value-of select="string(sm:Vendor)"/>
		does not have high security level
	      </sch:report>
	      <sch:assert test="sm:Vendor='TrustedVendor'">
		A secure workstation can only contain
		applications from TrustedVendor
	      </sch:assert>
	    </sch:rule>

to:
	    <sch:rule context="sm:Applications/sm:Application">
	      <sch:report test="smlfn:deref(.)[sm:SecurityLevel!='High']">
		Application <sch:value-of select="string(sm:Name)"/>
		from <sch:value-of select="string(sm:Vendor)"/>
		does not have high security level.
	      </sch:report>
	      <sch:assert test="smlfn:deref(.)[sm:Vendor='TrustedVendor']">
		A secure workstation can only contain
		applications from TrustedVendor.
	      </sch:assert>
	    </sch:rule>