[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|