[Bug 5680] fix errors in schematron variable substitution support text & example

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5680


Julia McCarthy <julia@us.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |julia@us.ibm.com




--- Comment #3 from Julia McCarthy <julia@us.ibm.com>  2008-06-18 20:12:38 ---
Background From Valentina: 

This section refers to localization support in SML and IF. The original
intention was to enable translation for messages or text that is visible to a
consumer; also to offer variable substitution support for those strings in such
a way that messages could be re-used in different contexts.

The target for localization support was schematron assertion/report messages
and IF identity elements.

It is obvious that for schematron messages, sch:let can be used to define a
variable in support of var substitution. But this is not possible in the IF
case or any other text not involving schematron. So for a generic solution,
xsl:variable offers the necessary support.

The main issue here is that the localization support as defined now in the SML
narrows down on schematron assertions.

5680 Proposal:

While recent discussions of SML localization support have focused on schematron
assertions, the existing specification acknowledges other uses.  SML section
7.1 item 3 mentions “Elements in instance documents with textual content” as
possible uses of locid; SML section 9.1.7 adds “any element with textual
context”, also in keeping with the intent Valentina reminds us of. The SML-IF
identity element has been mentioned in discussions as another use of variable
substitution with locid. Technically, either xsl:variable or sch:let could be
used in any of the existing Schematron examples. Let’s note this fact in the
text, along with the fact that (in the context of Schematron) the best practice
would likely be sch:let since that keeps all the markup processible by any
Schematron implementation (versus one that also speaks XSLT). 

Bug 5680: Proposed text change

The sample below shows how substitution variable support can be achieved on
Schematron sch:assert messages by using sch:let support. 
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
            xmlns:lang="http://www.university.example.org/translation/">
    <sch:ns prefix="u" uri="http://www.university.example.org/ns" />
    <sch:ns prefix="smlfn" uri="http://www.w3.org/2008/03/sml-function"/>
    <sch:pattern id="StudentPattern”>
<sch:rule context="u:Students/u:Student">
    <sch:let name="var" value="smlfn:deref(.)/u:ID" />
    <sch:assert test="smlfn:deref(.)[starts-with(u:ID,'99')]"
                sml:locid="lang:StudentIDErrorMsg">
        The specified ID <sch:value-of select="$var"/> does not begin with 99.
    </sch:assert>
</sch:rule>

    </sch:pattern>
</sch:schema>
If the message named by lang:StudentIDErrorMsg is intended for use only in the
context of Schematron report/assert elements, this mechanism is sufficient.  If
the message is intended for use in contexts that include but are not limited to
Schematron report/assert elements, then the preceding syntax is insufficient. 
In order to allow re-use of a message exploiting variable substitution in other
contexts, a syntax understood both inside and outside of Schematron elements is
required.  xsl:variable is one possible choice, made more practical by SML’s
requirement that validators support the “xslt" query binding for Schematron. 
The preceding example, altered in this way, follows.
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
            xmlns:lang="http://www.university.example.org/translation/">
    <sch:ns prefix="u" uri="http://www.university.example.org/ns" />
    <sch:ns prefix="smlfn" uri="http://www.w3.org/2008/03/sml-function"/>
    <sch:pattern id="StudentPattern”>
<sch:rule context="u:Students/u:Student">
    <xsl:variable name="var" value="smlfn:deref(.)/u:ID" />
    <sch:assert test="smlfn:deref(.)[starts-with(u:ID,'99')]"
                sml:locid="lang:StudentIDErrorMsg">
        The specified ID <sch:value-of select="$var"/> does not begin with 99.
    </sch:assert>
</sch:rule>

    </sch:pattern>
</sch:schema>
The error message in sch:assert and the localization identifier
lang:StudentIDErrorMsg can now be re-used in contexts other than Schematron
report/assert elements for u:Students/u:Student.  An example of using
localization with variable substitution entirely outside the context of
Schematron rules is given in [SML-IF 4.1].

In SML-IF section 4.1, modify the paragraph that currently reads like this:  
The identity element provides information applications can use to identify and
describe the set of SML documents being interchanged. The baseURI child element
is one way…

To read like this:
The identity element provides information applications can use to identify and
describe the set of SML documents being interchanged.  The description may
include human-readable text suitable for display and localization.
<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.w3.org/2008/03/sml-if" version="1.0">
    <identity>
        <name>
http://www.university.example.org/sml/models/Sample/InterDocReferences
        </name>
        <baseURI>
http://www.university.example.org/Universities/
        </baseURI> 
        <version>1.1</version>
        <displayName sml:locid="lang:ModelVersionMsg">
            SML-IF localization example, model version: 
                <xsl:variable name=”vers” select=”../version”/>
        </displayName>
    </identity>
…
</model>

The baseURI child element is one way...


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 18 June 2008 20:13:12 UTC