Subject: Re: [xsl] Seeking an elegant XSLT function to check that a pair of numeric ranges are consecutive From: "Bauman, Syd s.bauman@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sat, 25 May 2024 16:11:54 -0000 |
I wrote the test in Schematron, not XSLT (as it seems to me this is a constraint on the business rules of the input document, but to each his own), but should be pretty similar, no? <sch:rule context="Range[following::Range]"> <!-- my maximum is either my value or, if I have a hyphen, then the value of what comes after said hyphen --> <sch:let name="mymax" value="(if ( contains( ., '-') ) then substring-after( ., '-') else .) cast as xs:integer"/> <!-- get next <Range> for texting --> <sch:let name="next" value="following::Range[1]/string()"/> <!-- its minimum is either its value or, if it has a hyphen, then the value of what comes before said hyphen --> <sch:let name="nextmin" value="( if ( contains( $next, '-') ) then substring-before( $next, '-') else $next) cast as xs:integer"/> <!-- in order to be consecutive, my max need be one less than the next min --> <sch:assert test="$mymax + 1 eq $nextmin">Range following this one is not consecutive</sch:assert> </sch:rule> ________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Seeking an elegant XSLT funct, Roger L Costello cos | Thread | Re: [xsl] Seeking an elegant XSLT f, David Carlisle d.p.c |
[xsl] Seeking an elegant XSLT funct, Roger L Costello cos | Date | Re: [xsl] Seeking an elegant XSLT f, David Carlisle d.p.c |
Month |