<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>3039</bug_id>
          
          <creation_ts>2006-03-24 02:11:14 +0000</creation_ts>
          <short_desc>Proposal: check constraints in global rules</short_desc>
          <delta_ts>2006-07-24 10:31:36 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>ITS</product>
          <component>ITS tagset</component>
          <version>WorkingDraft</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Felix Sasaki">fsasaki</reporter>
          <assigned_to name="Felix Sasaki">fsasaki</assigned_to>
          
          
          <qa_contact name="Felix Sasaki">fsasaki</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>8859</commentid>
    <comment_count>0</comment_count>
    <who name="Felix Sasaki">fsasaki</who>
    <bug_when>2006-03-24 02:11:14 +0000</bug_when>
    <thetext>I propose to have a non-normative example in the spec how to check constraints on the global rules.
Example: the constraint that an its:locInfoRule element must not have both an its:locInfo child element and an @its:locInfoPointer attribute.

We could give an example of a schematron document that describes what to check.

&lt;schema xmlns=&quot;http://www.ascc.net/xml/schematron&quot; &gt;
&lt;ns prefix=&quot;its&quot; uri=&quot;http://www.w3.org/2005/11/its&quot;/&gt;
     &lt;pattern name=&quot;Check ITS Global Rules Constraint&quot;&gt;
          &lt;rule context=&quot;its:locInfoRule&quot;&gt;
               &lt;report test=&quot;its:locInfo and @its:locInfoPointer&quot;&gt;An its:locInfoRule element must not have both an its:locInfo child element and an @its:locInfoPointer attribute.&lt;/report&gt;
&lt;!--               &lt;assert test=&quot;@name&quot;&gt;AAA misses attribute name.&lt;/assert&gt;
               &lt;report test=&quot;@name&quot;&gt;AAA contains attribute name.&lt;/report&gt;--&gt;
          &lt;/rule&gt;
     &lt;/pattern&gt;
&lt;/schema&gt;

Out of this, we generate an xslt stylesheet via e.g. the existing schematron processor skeleton1-5.xsl:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
&lt;xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; xmlns:sch=&quot;http://www.ascc.net/xml/schematron&quot; xmlns:its=&quot;http://www.w3.org/2005/11/its&quot; version=&quot;1.0&quot; its:dummy-for-xmlns=&quot;&quot;&gt;
   &lt;xsl:template match=&quot;*|@*&quot; mode=&quot;schematron-get-full-path&quot;&gt;
      &lt;xsl:apply-templates select=&quot;parent::*&quot; mode=&quot;schematron-get-full-path&quot;/&gt;
      &lt;xsl:text&gt;/&lt;/xsl:text&gt;
      &lt;xsl:if test=&quot;count(. | ../@*) = count(../@*)&quot;&gt;@&lt;/xsl:if&gt;
      &lt;xsl:value-of select=&quot;name()&quot;/&gt;
      &lt;xsl:text&gt;[&lt;/xsl:text&gt;
      &lt;xsl:value-of select=&quot;1+count(preceding-sibling::*[name()=name(current())])&quot;/&gt;
      &lt;xsl:text&gt;]&lt;/xsl:text&gt;
   &lt;/xsl:template&gt;
   &lt;xsl:template match=&quot;/&quot;&gt;
      &lt;xsl:apply-templates select=&quot;/&quot; mode=&quot;M1&quot;/&gt;
   &lt;/xsl:template&gt;
   &lt;xsl:template match=&quot;its:locInfoRule&quot; priority=&quot;4000&quot; mode=&quot;M1&quot;&gt;
      &lt;xsl:if test=&quot;its:locInfo and @its:locInfoPointer&quot;&gt;
&lt;xsl:apply-templates mode=&quot;schematron-get-full-path&quot;/&gt;
&lt;xsl:text&gt;An its:locInfoRule element must not have both an its:locInfo child element and an @its:locInfoPointer attribute.&lt;/xsl:text&gt;&lt;/xsl:if&gt;
      &lt;xsl:apply-templates mode=&quot;M1&quot;/&gt;
   &lt;/xsl:template&gt;
   &lt;xsl:template match=&quot;text()&quot; priority=&quot;-1&quot; mode=&quot;M1&quot;/&gt;
   &lt;xsl:template match=&quot;text()&quot; priority=&quot;-1&quot;/&gt;
&lt;/xsl:stylesheet&gt;

Applying this stylesheet to the erronous file
&lt;its:documentRules xmlns:its=&quot;http://www.w3.org/2005/11/its&quot;&gt;
&lt;its:locInfoRule its:select=&quot;//p&quot; its:locInfoPointer=&quot;@existing-locInfo&quot;&gt;
&lt;its:locInfo&gt;New locInfo&lt;/its:locInfo&gt;
&lt;/its:locInfoRule&gt;
&lt;/its:documentRules&gt;

Will give the following result:
/its:documentRules[1]/its:locInfoRule[1]/its:locInfo[1]
An its:locInfoRule element must not have both an its:locInfo child element and an @its:locInfoPointer attribute.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9339</commentid>
    <comment_count>1</comment_count>
    <who name="Felix Sasaki">fsasaki</who>
    <bug_when>2006-04-20 08:20:56 +0000</bug_when>
    <thetext>closed after discussion at http://www.w3.org/2006/04/18-i18nits-minutes.html#item07 , felix to integrate the result in the spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>10679</commentid>
    <comment_count>2</comment_count>
    <who name="Felix Sasaki">fsasaki</who>
    <bug_when>2006-07-24 10:31:36 +0000</bug_when>
    <thetext>Closed, no further action necessary.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>