Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] Schematron and comma as a decimal delimiter

From: "bryan rasmussen" <rasmussen.bryan@-----.--->
To: xml-dev@-----.---.---
Date: 9/4/2006 12:06:00 PM
>(3) recursion over the items being summed,
>.... None of these can conveniently be used in an XPath
> (as distinct from XSLT) context.

I recently had to do something similar to this for a problem defined as:

every line of text up to and including X lines of text must have no
more than Y characters in the   line.

(my recollection of the problem is perhaps a little fuzzy, it was
several months ago)

For example something like the following:

<sch:assert test="string-length(substring-before(concat(.,'&#010;'),'&#010;'))&lt;5">1:
Every line of the <sch:name/> text node should be no more than 5
characters long</sch:assert>
<sch:assert test="string-length(substring-before(substring-after(concat(.,'&#010;'),'&#010;'),'&#010;'))&lt;5">2:
Every line of the <sch:name/> text node should be no more than 5
characters long</sch:assert>
<sch:assert test="string-length(substring-before(substring-after(substring-after(concat(.,'&#010;'),'&#010;'),'&#010;'),'&#010;'))
&lt; 5">3: Every line of the <sch:name/> text node should be no more
than 5 characters long</sch:assert>

and so forth

The assertions are only called in cases where the string length is incorrect.

As such the rather impossible to write or maintain assertions can be
generate without need to loop or recurse over an input.

I guess I would call it a Stupid Schematron trick, basically in a
language that does not allow recursion or looping such as Schematron
with XPath 1.0 looping can often be handled as part of a code
generation process when the actual constraints of the input data is
known.

Not sure if that is a good thing.

Cheers,
Bryan


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent