试试这个 xsl。这不是一个完整的答案,但您可以将其作为起点(当然,如果可以的话):
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" indent="yes" />
<!-- for easy selection of Polozka elements: -->
<xsl:key name="reports-by-stredisko" match="/Report/Polozka" use="Stredisko" />
<xsl:template match="/">
<xsl:for-each select="/Report/Polozka[not(Stredisko = preceding-sibling::Polozka/Stredisko)]">
<table summary="Stredisko: {Stredisko}">
<xsl:for-each select="key('reports-by-stredisko',Stredisko)">
<tr>
<td>I_Cislo: <xsl:value-of select="I_Cislo"/></td>
<td>Stredisko: <xsl:value-of select="Stredisko"/></td>
<td>...</td>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
此 xsl 生成以下输出:
<table summary="Stredisko: 4">
<tr>
<td>I_Cislo: 29IM00001</td>
<td>Stredisko: 4</td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 29IM00001</td>
<td>Stredisko: 4</td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 12D3333</td>
<td>Stredisko: 4</td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 10DM00004</td>
<td>Stredisko: 4</td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 10DM00005</td>
<td>Stredisko: 4</td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 10DM00007</td>
<td>Stredisko: 4</td>
<td>...</td>
</tr>
</table>
<table summary="Stredisko: ">
<tr>
<td>I_Cislo: 10IM00002</td>
<td>Stredisko: </td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 11IM00002</td>
<td>Stredisko: </td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 12IM00002</td>
<td>Stredisko: </td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 10IM00002</td>
<td>Stredisko: </td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 11IM00002</td>
<td>Stredisko: </td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 12IM00002</td>
<td>Stredisko: </td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 12DM00007</td>
<td>Stredisko: </td>
<td>...</td>
</tr>
<tr>
<td>I_Cislo: 10LM00002</td>
<td>Stredisko: </td>
<td>...</td>
</tr>
</table>
<table summary="Stredisko: 1">
<tr>
<td>I_Cislo: 12DM00006</td>
<td>Stredisko: 1</td>
<td>...</td>
</tr>
</table>
希望能帮助到你