xsl-list
[Top] [All Lists]

Re: [xsl] When to use conditional constructions?

2014-03-30 17:01:05

I always thought it would be nice if template rules belonging to a particular 
mode could be grouped together under an xsl:mode element. We've introduced an 
xsl:mode element in 3.0, but haven't taken the further step of allowing 
xsl:template to appear as children of xsl:mode. It's cosmetic of course, 
because you can always organize a stylesheet module to contain all the template 
rules for one mode; and it would only really help the searching problem if you 
knew that all the template rules had to be children of the mode, which would 
make backwards compatibility difficult...

Michael Kay
Saxonica


On 30 Mar 2014, at 21:52, John Lumley <john(_at_)saxonica(_dot_)com> wrote:

On 30 Mar 2014, at 19:58, Dimitre Novatchev 
<dnovatchev(_at_)gmail(_dot_)com> wrote:

John,

If the conditions can be expressed as mutually exclusive, order doesn't 
matter.

If this isn't possible, simply use the 'priority' attribute on the
templates that implement what corresponds to the <xsl:when> elements,
so that template for the first <xsl:when> has the highest priority,
..., etc.

Thanks Dimitre,

I'm aware of that - and have used that for example in converting CSS to XSLT. 

The real issue is keeping all the relevant cases together, so you don't have 
to go searching all over the place. And for some cases (such as in my 
'pagination' example) whilst the conditions can be described as mutually 
exclusive, they are really compounds - e.g. is-page-break, will-fit and 
not(is-page-break), not(is-page-break or will-fit) and can-be-broken etc. 
which are most coherently described as a priority sequence of cases.

John
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--