[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How to calculate rowspan?

Subject: How to calculate rowspan?
From: "anton" <a.m@xxxxxxxxxxx>
Date: Thu, 26 Aug 2004 10:26:45 +0200
xslt rowspan
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.