W3C home > Mailing lists > Public > public-i18n-its@w3.org > April to June 2006

Re: ITS tagset changelog: Added section on constraints check

From: Felix Sasaki <fsasaki@w3.org>
Date: Mon, 01 May 2006 12:29:31 +0900
Message-ID: <4455809B.7000601@w3.org>
To: Sebastian Rahtz <Sebastian.Rahtz@oucs.ox.ac.uk>
Cc: public-i18n-its@w3.org
Sebastian Rahtz wrote:
> 
> Felix Sasaki wrote:
>> Hi all,
>>
>> I added a section with the schematron document to check some constraints
>> on ITS markup. Please have a look at
>>
>> http://www.w3.org/International/its/itstagset/itstagset-diff-20060414.html#its-schematron-constraints
> 
> 
> dare I ask it actually works with Schematron?
> 

Sorry for not giving an example. I used this erroneous document:

<myDoc xmlns:its="http://www.w3.org/2005/11/its" its:version="1.0">
<its:rules its:version="1.1">
<its:termRule its:termRef=".." its:termRefPointer=".."/>
<its:locInfoRule its:locInfoRef=".." its:locInfoRefPointer=".."
its:locInfoPointer="..">
<its:locInfo/>
</its:locInfoRule>
<its:rubyRule its:rubyText=".." its:rtPointer=".."/>
</its:rules>
<p its:termRef=".." its:locInfo=".." its:locInfoRef=".."></p>
</myDoc>

and this schematron 1.5 implementation
http://xml.ascc.net/schematron/1.5/skeleton1-5.xsl

using
http://www.w3.org/International/its/itstagset/its-constraints-check-schematron.xml
, you will get the generated the XSLT below. Applying it to the
erroneous document, it gives you all error messages which are tested by
the schematron document.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sch="http://www.ascc.net/xml/schematron"
xmlns:its="http://www.w3.org/2005/11/its" version="1.0"
its:dummy-for-xmlns="">
   <xsl:template match="*|@*" mode="schematron-get-full-path">
      <xsl:apply-templates select="parent::*"
mode="schematron-get-full-path"/>
      <xsl:text>/</xsl:text>
      <xsl:if test="count(. | ../@*) = count(../@*)">@</xsl:if>
      <xsl:value-of select="name()"/>
      <xsl:text>[</xsl:text>

      <xsl:value-of
select="1+count(preceding-sibling::*[name()=name(current())])"/>
      <xsl:text>]</xsl:text>
   </xsl:template>
   <xsl:template match="/">
      <xsl:apply-templates select="/" mode="M1"/>
   </xsl:template>
   <xsl:template match="*" priority="4000" mode="M1">
      <xsl:if test="name()='its:locInfoRule' and child::its:locInfo and
@its:locInfoPointer">locInfoRule error: A locInfoRule element must not
have both a locInfo child element and a locInfoPointer attribute.</xsl:if>

      <xsl:if test="name()='its:locInfoRule' and @its:locInfoRef and
@its:locInfoRefPointer">locInfoRule error: A locInfoRule element must
not have both a locInfoRef attribute and a locInfoRefPointer
attribute.</xsl:if>
      <xsl:if test="name()='its:locInfoRule' and child::its:locInfo and
@its:locInfoRef">locInfoRule error: A locInfoRule element must not have
both a locInfo child element and a locInfoRef attribute.</xsl:if>
      <xsl:if test="name()='its:termRule' and @its:termRef and
@its:termRefPointer">termRule error: A termRule element must not have
both a termRef attribute and a termRefPointer attribute.</xsl:if>
      <xsl:if test="name()='its:rubyRule' and @its:rubyText and
@its:rtPointer">rubyRule error: A rubyRule element must not have both a
rubyText attribute and a rtPointer attribute.</xsl:if>
      <xsl:if test="@its:locInfo and @its:locInfoRef">Local ITS usage
error: The locInfo attribute and the locInfoRef attribute must not be
used together.</xsl:if>
      <xsl:if test="@its:termRef and not (@its:term[.='yes']) and
not(name()='its:termRule')">Local ITS usage error: A termRef attribute
must not appear locally without a term attribute which has the value
'yes'.</xsl:if>

      <xsl:if test="/*/@its:version != @its:version">The version
attribute at the root element and at the rules element must not specify
different versions of ITS.</xsl:if>
      <xsl:apply-templates mode="M1"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M1"/>
   <xsl:template match="text()" priority="-1"/>
</xsl:stylesheet>

- Felix

Received on Monday, 1 May 2006 03:29:42 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:43:07 UTC