Dave,
At 12:13 PM 5/19/2003, you wrote:
Ah - in almost all places where I have used this, I have gotten away
with it. the only exception was passing the output stream from a sax
transform to the input of a fop process. In that case, passing via a
temporary String did the trick (but I needed to re-parse the XML
afterwards, so there was a cost).
Yikes.
To date I haven't used the native transformer in Mozilla or Netscape,
but have rather had separate xslt processes server-side, so I hadn't
realised this would be a problem for them.
It's a subtle problem to come to understand, but a deep one, since it
involves not only assimilating XSLT's processing model, but a respect for
*why* XSLT is designed this way. There are distinct advantages, for most of
XSLT's expected use cases, to building a tree (and then serializing it if
you need XML output), rather than writing markup directly. Not only does it
allow XSLT to be used in all kinds of places where otherwise it would be
difficult or cumbersome; also, for us stylesheet writers it makes a whole
class of problems (which would otherwise be very FAQs) just go away.
(Consequently, it makes it possible to learn and use XSLT even if you are
only starting to get a grasp of XML well-formedness rules. And they say
XSLT is hard!)
I will go read the FAQ a bit :) That said, my answer did seem to solve
the original poster's problem :)
Well, until they come back when it breaks. :->
Given that my answer was incorrect as an approach, though, how would one
go about doing what was described in xsl 1?
Zarella's just given the answer. Generalizing her solution,
<xsl:param name="cellcount" select="3"/>
<!-- how many cells d'you want in a row? -->
<xsl:template match="cell">
<xsl:if test="(count(preceding-sibling::cell) mod $cellcount) = 1">
<tr>
<xsl:for-each select=".|following-sibling::cell[$cellcount - 1]">
<td>
<xsl:apply-templates/>
</td>
</xsl:for-each>
</tr>
</xsl:if>
</xsl:template>
Cheers,
Wendell
___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
"Thus I make my own use of the telegraph, without consulting
the directors, like the sparrows, which I perceive use it
extensively for a perch." -- Thoreau
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list