Re: [ACTION-160] (related to [ACTION-135] too) Summarize specialRequirements

2012/7/6 Yves Savourel <ysavourel@enlaso.com>

> Hi all,
>
> I had the action item to summarize yesterday's call discussion on
> specialRequirements:
>
> Based on the email discussion (ACTION-135):
>
> http://lists.w3.org/Archives/Public/public-multilingualweb-lt/2012Jul/0001.html
>
>
> - There was a consensus that the three aspects of the potential data
> category ("storage size", "display length" and "forbidden characters") were
> somehow related but distinct facets.
>
> - It was pointed out that Schematron or XSD constraints mechanism could
> possibly implement at least part of the requirements. Felix was tasked to
> provide examples.
>

Here is ACTION-159 about this. First an example in Schematron about display
length.

<schema xmlns="http://purl.oclc.org/dsdl/schematron">

   <pattern>

      <title>Display length</title>

      <rule context="gui">

         <assert test="string-length() &lt; 35">The length of the string in
the "gui" element should be less than 35 characters..</assert>

      </rule>

   </pattern>

</schema>



The "pattern" element contains the assertion we want to test. The "context"
attribute provides a relative XPath expression to select the nodes that
should be tested. The "test" attribute contains another relative XPath
expression that provides the test.


I think the counterPart as a global rule would be

<itsx:lengthConstraintRule select="//gui" length="100"/>


For both implementations, you will need an XPath processor. Schematron
often uses XSLT (generating an XSLT stylesheet out of the schema, which is
then applied against the instance document) as an implementation approach,
see

http://www.schematron.com/implementation.html

but there are also java implementations, see

http://www.thaiopensource.com/relaxng/jing.html


Now an example in XSD:

<xs:element name="gui" >

    <xs:simpleType>

        <xs:restriction base="xs:string">

            <xs:length value="75"/>

        </xs:restriction>

    </xs:simpleType>

</xs:element>

<xs:attribute name="gui">

        <xs:simpleType>

           <xs:restriction base="xs:string">

                <xs:length value="75"/>

            </xs:restriction>

        </xs:simpleType>

</xs:attribute>


Of course this has the drawback that you are not flexible with checking the
constraint. As Yves pointed out, once the content is taken out of the
original file and then part of XLIFF, checking against the XML Schema
constraint doesn't work anymore since the XLIFF schema doesn't know about
the constraint.
For Schematron I think this is different, since you can apply the schema
easily to many contexts, by just modifying the "rule" element
<rule context="gui | trans-unit">

Felix


> - It was pointed out that similar work (for either "storage size" and
> "display length" or both) was being done on the XLIFF side, and a work
> document would be available soon (within weeks). DavidF was tasked with
> making sure the document would be posted on this list as soon as possible.
>
> [I'm also CCing Fredrik Estreen (who is looking at this issue in XLIFF)
> just so he is in this loop].
>
> - The conclusion was that, only the "storage size" property was seemingly
> stable and that the two other aspects ("display length" and "forbidden
> characters") were more difficult to define, and that it would be good to
> see what mechanism would be suggested in Fredrik's document.
>
>
> To add to this summary, here I a possible way to represent "storage size"
> as a separate data category:
>
> <its:maxStorageSizeRule selector="//title"
>  maxStorageSize="100" storageEncoding="UTF-16"/>
>
> where maxStorageSize is mandatory and expressed in bytes and
> storageEncoding is optional and defaults to UTF-8 (?)
>
> I suppose there is no reason not to have local support as well:
>
> <record>
>  <title ist:maxStorageSize="100" its:storageEncoding="UTF-16">text</title>
>  <field1>...</field1>
> </record>
>
> Cheers,
> -yves
>
>
>
>


-- 
Felix Sasaki
DFKI / W3C Fellow

Received on Friday, 6 July 2012 06:04:54 UTC