[xsl] How to calculate rowspan?

Subject: [xsl] How to calculate rowspan?
From: "anton" <a.m@xxxxxxxxxxx>
Date: Thu, 26 Aug 2004 10:26:45 +0200
Hi!

How can i calculate identical nodes with attribute Type="Dimesion"? I wish
to set rowspan and ignore all of unnecessery following nodes with the same
content.

Please, help me.

I wish to get this table in HTML:

-----------------
    |   |   |   |
    -   ---------
    |   |   |   |
    -------------
    |   |   |   |
-----------------
    |   |   |   |
    -------------
    |   |   |   |
-----------------
    |   |   |   |
-----------------


My XML:

<QPivotTable>
<ROW>
	<COL0 Type="Dimesion">A</COL0>
	<COL1 Type="Dimesion">E</COL1>
	<COL2>1</COL2>
	<COL3>2</COL3>
</ROW>
<ROW>
	<COL0 Type="Dimesion">A</COL0>
	<COL1 Type="Dimesion">E</COL1>
	<COL2>1</COL2>
	<COL3>2</COL3>
</ROW>
<ROW>
	<COL0 Type="Dimesion">A</COL0>
	<COL1 Type="Dimesion">Gesamt</COL1>
	<COL2>1</COL2>
	<COL3>2</COL3>
</ROW>
<ROW>
	<COL0 Type="Dimesion">B</COL0>
	<COL1 Type="Dimesion">8040 Haus- u. Stra_ensamml.</COL1>
	<COL2>1</COL2>
	<COL3>2</COL3>
</ROW>
<ROW>
	<COL0 Type="Dimesion">B</COL0>
	<COL1 Type="Dimesion">8055 Sen.Gymn.</COL1>
	<COL2>1</COL2>
	<COL3>2</COL3>
</ROW>
<ROW>
	<COL0 Type="Dimesion">C</COL0>
	<COL1 Type="Dimesion">test</COL1>
	<COL2>1</COL2>
	<COL3>2</COL3>
</ROW>
</QPivotTable>

My XSL:

<!-- count Dimesion -->
<xsl:variable name="dim_count" select="count(
//ROW[not(descendant::node()[1][@Type='Label'])]
[1]/node()[@Type='Dimesion'] )" />

<!-- select data rows -->
<xsl:template match="//ROW[not(descendant::node()[1][@Type='Label'])]" >
<tr>
	<xsl:for-each select="*">
	<xsl:variable name="pos" select="position()" />

	<xsl:choose>
		<xsl:when test=" @Type='Dimesion' ">


			<!-- HOW TO SET ROWSPAN AND IGNORE FOLLOWING
IDENTICAL NODES? -->

			<xsl:value-of select="$pos" />

				<xsl:if test="not(.=following::*/*[$pos])" >
					<td>

						<xsl:value-of select="." />
					</td>
				</xsl:if>
		</xsl:when>
		<xsl:otherwise>
		<!-- igore the firs x values -->
		<xsl:if test="position() &gt; $dim_count" >
			<td>
			<xsl:value-of select="." />
			</td>
		</xsl:if>
	</xsl:otherwise>
	</xsl:choose>

	</xsl:for-each>
</tr>
</xsl:template>

Best Regards
A. Metz

Current Thread