Thomas J.S.: Tabelle aufbauen

Beitrag lesen

Hallo!

<?xml version="1.0" encoding="UTF-8"?>
<?xml:stylesheet href="test1.xsl" type="text/xsl"?>
<root>
<test code="1">A 1</test>
<test code="1">B 1</test>
<test code="2">A 2</test>
<test code="3">A 3</test>
<test code="4">A 4</test>
<test code="4">B 4</test>
<test code="4">C 4</test>
</root>
---------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="root">

<table border="1" width="50%">
<tr>
<xsl:for-each select="test[@code='1']">
<td><xsl:value-of select="self::test" /></td>
</xsl:for-each>
</tr>
<tr>
<xsl:for-each select="test[@code='2']">
<td><xsl:value-of select="self::test" /></td>
</xsl:for-each>
</tr>
<tr>
<xsl:for-each select="test[@code='3']">
<td><xsl:value-of select="self::test" /></td>
</xsl:for-each>
</tr>
<tr>
<xsl:for-each select="test[@code='4']">
<td><xsl:value-of select="self::test" /></td>
</xsl:for-each>
</tr>
</table>

</xsl:template>
</xsl:stylesheet>
--------------------
Oder meinst du was anderes?

Grüße
Thomas