Subject: Re: [xsl] Late requirement for uniform wrapping of differently generated elements From: Graydon <graydon@xxxxxxxxx> Date: Sat, 11 Feb 2012 11:23:03 -0500 |
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@xxxxxxxxxxxx
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Late requirement for unif, Wolfgang Laun | Thread | [xsl] XSLT containing javascript co, Wolfgang Laun |
Re: [xsl] Late requirement for unif, Wolfgang Laun | Date | [xsl] XSLT containing javascript co, Wolfgang Laun |
Month |