Re: [xsl] When to use conditional constructions?

Subject: Re: [xsl] When to use conditional constructions?
From: John Lumley <john@xxxxxxxxxxxx>
Date: Sun, 30 Mar 2014 21:52:16 +0100
> 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