xsl-list
[Top] [All Lists]

Re: [xsl] Controlling process flow in a stylesheet?

2014-08-21 13:53:31
Am 21.08.2014 um 19:59 schrieb Michael Kay:

If the parent has a content model A, B, C, D, and any of the four might be 
absent, then you could try doing

<xsl:apply-templates select="optional(A, $A), optional(B, $B), optional(C, 
$C), optional(D, $D)"/>

where optional(X, Y) is a function that selects X if present or Y otherwise, 
and $A, $B etc are global variables containing default elements of each type 
(or some other marker to indicate that the element is absent).

Can the function be avoided by writing

<xsl:apply-templates select="(A, $A)[1], (B, $B)[1], (C, $C)[1], (D, $D)[1]"/>

This method was mentioned earlier in this list and I used it since several 
times as a method to handle default values.

- Michael
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>