Re: [xsl] Legibility, repetition, nesting
2020-07-22 06:58:37
Hi David,
I'm curious to know what approach you finally chose.
("Enquiring minds want to know.")
thanks and best regards
-alan
On Mon, Jul 20, 2020 at 11:00 PM Liam R. E. Quin
liam(_at_)fromoldbooks(_dot_)org <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
On Mon, 2020-07-20 at 18:24 +0000, David Birnbaum djbpitt(_at_)gmail(_dot_)com
wrote:
Dear Syd (cc xsl-list),
Thanks for the quick response. As you note, the actual main template
does a
lot of things that are common to all types before it gets to the
<xsl:choose>, and if I write completely separate templates for each
of the
types, I would need to repeat that shared code verbatim in each of
the
type-specific templates.
Maybe write a function that returns a map containing the variables, so
instead of $socksize you'd write, $metadata?socksize or whatever.
Call that at the start of the template. Now you have only one line,
and you can use next-match with a parameter. Or lots of templates, but
each calling that common function at the start.
Or you can invert it and have 30 lines of preamble and then call a
function.
It's possible to make a map (or array) whose entries are functions, so
another possibility is a table-driven approach, where you look up in a
table some combination of values and call the function that's listed
there.
Liam
--
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org
--~----------------------------------------------------------------
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>
|
- [xsl] Legibility, repetition, nesting, David Birnbaum djbpitt(_at_)gmail(_dot_)com
- Re: [xsl] Legibility, repetition, nesting, Bauman, Syd s(_dot_)bauman(_at_)northeastern(_dot_)edu
- Re: [xsl] Legibility, repetition, nesting, Alan Painter alan(_dot_)painter(_at_)gmail(_dot_)com
- Re: [xsl] Legibility, repetition, nesting, Liam R. E. Quin liam(_at_)fromoldbooks(_dot_)org
- Re: [xsl] Legibility, repetition, nesting,
Alan Painter alan(_dot_)painter(_at_)gmail(_dot_)com <=
Re: [xsl] Legibility, repetition, nesting, Dimitre Novatchev dnovatchev(_at_)gmail(_dot_)com
Re: [xsl] Legibility, repetition, nesting, David Birnbaum djbpitt(_at_)gmail(_dot_)com
|
|
|