[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: best practices for using XSLT modes

Subject: Re: best practices for using XSLT modes
From: "BR Chrisman brchrisman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 5 Dec 2019 16:48:36 -0000
Re:  best practices for using XSLT modes
On Wed, Dec 4, 2019 at 2:43 AM Michael Kay mike@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
...
> Secondly, I found it useful recently to split the mode for evaluating
assertions into two: one mode handles the case where the test produces a
normal result, the other handles the case where it produces a dynamic error,
and we issue a different apply-templates instruction for the two cases. The
reason for this is that the two modes have different default behaviour (the
mode that handles error outcomes returns "false" for all assertions except the
one with match="error"): this change eliminated a lot of logic. Perhaps the
same effect could have been achieved using a generic template rule delegating
to specific template rules using next-match; but in this scenario where we're
basically handling a two-dimensional decision tree (X - what is the outcome of
a test?, Y - what is the assertion being tested?) then using modes for one of
the dimensions and match patterns for the other can be useful.
>

Thank you for identifying the conceptual framework I've been using for
a long time in XSLT.  This concept of segmenting the dimensionality of
the problem with modes taking the dimension which appears more
'enumerated' and the match taking the more 'continuous-like'.  That's
what I've been doing, but didn't really recognize it until mentioned.

- Brian

> I would find it quite difficult to capture this experience and produce
general guidance on XSLT coding/design patterns; but if you're writing complex
stylesheets, modes are a powerful tool at your disposal and can be used with
care to great effect.
>
> Michael Kay
>
> XSL-List info and archive
> EasyUnsubscribe (by email)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.