Subject: Re: Nestled <xsl:choose>
From: tcn@xxxxxxxxxxxxx (Trevor Nash)
Date: Sat, 14 Jul 2001 18:34:26 GMT
|
On Sat, 14 Jul 2001 17:53:47 +0100, Chris wrote:
>[snip]
>
>Just let xsl do it's job and let it go off and apply templates.
>Next you want to add templates that will only match the specific types of
>books you have in your library i.e.
>
><xsl:template match="book[@variant = 'Book' and @style = 'Fiction']">
> <table cellspacing="4px">
> <tr> <td align="center" valign="middle" rowspan="7" width="120px">
>[snip]
>
>That gets rid of all those horrible xsl:choose and the despicable
>xsl:for-each you have liberaly scattered around.
All good advice.
>You probably want to add a default book template to catch any books that
>don't match your templates
>
><xsl:template match="book">
><b>Error Trapped Undefined Book Type</b>
></xsl:template>
>
>Put this before all the other book templates so that it only matches book
>types you don't have templates for. If you put it at the end it will match
>all book elements.
>
Slightly flawed (unless you are using the old MSMXL ??). It doesn't
matter where you put this template, because the default priority for a
name pattern like 'book' is higher than for qualified patterns like
'book[@...]'. But rather than rely on default priorities, a nice
trick I saw somewhere else (in schematron?) is to give this template a
priority of -1. You are then guaranteed it will not be chosen in
preference to anything else, whatever the style of pattern.
Regards,
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email
Melvaig Software Engineering Limited
voice: +44 (0) 1445 771 271
email: tcn@xxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- Nestled <xsl:choose>, (continued)
- dante - Sat, 14 Jul 2001 03:20:21 -0400 (EDT)
- Jeni Tennison - Sat, 14 Jul 2001 04:31:41 -0400 (EDT)
- dante - Sat, 14 Jul 2001 10:49:11 -0400 (EDT)
- Chris Bayes - Sat, 14 Jul 2001 12:58:23 -0400 (EDT)
- Trevor Nash - Sat, 14 Jul 2001 14:40:55 -0400 (EDT) <=
- Chris Bayes - Sun, 15 Jul 2001 05:33:24 -0400 (EDT)
- Trevor Nash - Sun, 15 Jul 2001 06:48:54 -0400 (EDT)
Michael Kay - Sat, 14 Jul 2001 04:48:41 -0400 (EDT)
David Carlisle - Sat, 14 Jul 2001 07:05:19 -0400 (EDT)
|
|