On Sat, Feb 11, 2012 at 04:22:47PM +0100, Wolfgang Laun scripsit:
My XSLT generates a HTML document containing (almost) nothing except
<h*> and <table>. I wrote it as a template reflecting the <html>
structure, with called templates pulling in the data from the XML
source. It is within these called templates that the various <table>
elements (of differing structure) are generated.
An new requirement demands that all the various <table> elements are
to be wrapped with another <table> (with a single <tr>) for layout
purposes, adding one <td> with uniform contents to the <td> containing
the original table.
I cannot insert two different template calls producing the outer
table's introduction and completion, respectively: they each would
contain unbalanced data.
Supposing you are using XSLT2, this seems like a textbook example of
when to use xsl:next-match; the higher priority "outer" match creates
the wrapper, the normal-priority "inner" match creates the table.
Generally, I suspect this is a case where making the table creators
callable named templates might not be what you want; it compels you to
manage the logic of which table to create when. If you could do that
via source document template matches, a whole lot of the headache
vanishes into the XSLT processor's domain.
-- Graydon
--
Graydon Saunders
graydon(_at_)epiphyte(_dot_)net
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--