Subject: Re: [xsl] saxon:evaluate() in schematron From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 22 May 2012 11:40:58 -0400 |
Cheers, Wendell
Wendell, Matt,
I recently came across this blog post by Rick Jelliffe, Do you need to make your own XSLT2 function definitions when using Schematron? http://broadcast.oreilly.com/2010/09/do-you-need-to-make-your-own-x.html
Although it is tempting for XSLT2 pundits to introduce user-defined functions in their Schematrons, Ricks post has made me resist this temptation every time since I read it. If only for the reason that without user-defined XSLT functions, Schematron schemas are more portable, as weve seen today.
Rick also proposes let as a tool to break up iterations or, as in Matts example, complex expressions.
Ive reworked my solution using let:
<s:rule context="line"> <s:let name="outliers" value=" for $att in (@x1, @x2)[ xs:integer(.) gt xs:integer(../../../block[@n eq current()/@n]/@x2) or xs:integer(.) lt xs:integer(../../../block[@n eq current()/@n]/@x1) ] union (@y1, @y2)[ xs:integer(.) gt xs:integer(../../../block[@n eq current()/@n]/@y2) or xs:integer(.) lt xs:integer(../../../block[@n eq current()/@n]/@y1) ] return concat(name($att), '=', $att) "/> <s:report test="exists($outliers)"> Line <s:value-of select="@n"/> does not fit. Offending coordinate(s): <s:value-of select="$outliers" /> </s:report> </s:rule>
Gerrit
On 2012-05-21 23:17, Wendell Piez wrote:Matt,
Of course, I forgot that you'll probably want, or need, the function also to say as="xs:boolean". (And who knows what else.)
-- ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] saxon:evaluate() in schem, Imsieke, Gerrit, le- | Thread | Re: [xsl] saxon:evaluate() in schem, Wendell Piez |
[xsl] Venetian Blind Schema - effec, ihe onwuka | Date | Re: [xsl] saxon:evaluate() in schem, Wendell Piez |
Month |