This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
static vars or how to write dirty tags
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] static vars or how to write dirty tags
- From: friepoertner <friepoertner at globalpark dot de>
- Date: Thu, 25 Oct 2001 12:20:20 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi list,
Now I can create a multirow table-head from an existing tree ... but
as xml is not as flexible as html is, i can't create row endings (</tr>)
where I need them ...
The xml-file:
<chart>
<column>
<name>foo</name>
<column>
<name>bar</name>
</column>
</column>
</chart>
( complete 2 - 4 layers ...)
My stylesheet :
<xsl:template match="chart">
<table><tr>
<xsl:apply-templates select="descendant::column">
<xsl:sort select="count(ancestor::column)"/>
</xsl:apply-templates>
</tr></table>
<xsl:template match="column">
<xsl:variable name="colspan" select="count(.//column[not(column)])"/>
<td colspan="{$colspan}"><xsl:value-of select="name"/></td>
<xsl:if test="count(following-sibling::column) = 0">
</tr><tr> <!-- :-) well, thats what I want to do ... -->
</xsl:if>
</xsl:template>
Sometimes I think xml could be more flexible ... the output would be
clean html ... :-)
In php I would solve this problem printing all the <td> ... </td> in a
var until end
of the current row ...
$foo .="<td> ...</td>";
Is there a solution like this in xsl ?
My next idea was <eval></tr></eval> but eval does not work ...!?
Greets,
Ingo
--
Ingo Friepoertner
friepoertner@globalpark.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list