- From: <bugzilla@farnsworth.w3.org>
- Date: Thu, 08 May 2008 00:42:13 +0000
- To: public-sml@w3.org
- CC:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=5680
Summary: fix errors in schematron variable substitution support
text & example
Product: SML
Version: LC
Platform: PC
OS/Version: Windows NT
Status: NEW
Keywords: hasProposal
Severity: normal
Priority: P2
Component: Core
AssignedTo: cmsmcq@w3.org
ReportedBy: kumarp@microsoft.com
QAContact: public-sml@w3.org
The spec currently shows the following example:
...
<sch:rule context="u:Students/u:Student">
<sch:assert test="smlfn:deref(.)[starts-with(u:ID,'99')]"
sml:locid="lang:StudentIDErrorMsg">
<xsl:variable name="var" select="u:ID" />
The specified ID <sch:value-of select="string($var)"/> does not begin
with 99.
</sch:assert>
</sch:rule>
...
There are a number of errors present in this:
a. No need of xsl:variable
Schematron provides its own mechanism for variable substitution using sch:let
element, therefore there is no need to use xsl:variable.
b. <xsl:variable> (or rather sch:let) should be outside the <sch:assert>
element
Currently it is inside <sch:assert>, therefore when we replace the contents of
sch:assert by the translated text (based on sml:locid), the <xsl:variable>
element will get replaced too and there will not be any further variable
substitution.
c. value of $var is incorrect
The value of $var is currently “u:ID”. It should really be
“smlfn:deref(.)/u:ID”.
Proposal:
[1]
Remove all references to xsl:variable and mention sch:let appropriately. Fix
the above mentioned errors so that the example looks like below.
...
<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>
...
[2]
Alternatively, we can remove the following sections because they were put
there solely to describe how xsl:variable could be used.
- 7.1 Variable Substitution
- “Variable substitution support” (in Appendix F)
Received on Thursday, 8 May 2008 00:42:43 UTC