[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] When to use conditional constructions?


Subject: Re: [xsl] When to use conditional constructions?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Sun, 30 Mar 2014 23:00:46 +0100

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@xxxxxxxxxxxx> wrote:

>> On 30 Mar 2014, at 19:58, Dimitre Novatchev <dnovatchev@xxxxxxxxx> 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


Current Thread