Subject: Re: [xsl] best practices for using XSLT modes From: "BR Chrisman brchrisman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 5 Dec 2019 16:48:36 -0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] best practices for using , Wendell Piez wapiez@ | Thread | Re: [xsl] best practices for using , Dimitre Novatchev dn |
Re: [xsl] best practices for using , John Lumley john@xxx | Date | Re: [xsl] best practices for using , Eliot Kimber ekimber |
Month |