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

building a tabular format of data

Subject: building a tabular format of data
From: "Seema R" <seema.r@xxxxxxxxxxxxx>
Date: Wed, 30 Jan 2002 20:54:28 +0530
tabular width
Hi,

Here is the XML
<reportdetailinfo>
		<!-- tabular -->
		<testreport>
			<testname>Saline</testname>
			<testshortname>Sa</testshortname>
			<testresult>10.54</testresult>
			<testdatetime>12/12/98 10 am</testdatetime>
		</testreport>
		<testreport>
			<testname>Sodium</testname>
			<testshortname>Na</testshortname>
			<testresult>11.66</testresult>
			<testdatetime>12/21/98 12-30 am</testdatetime>
		</testreport>
		<testreport>
			<testname>Potassium</testname>
			<testshortname>Ka</testshortname>
			<testresult>10.89</testresult>
			<testdatetime>10/16/97 10 pm</testdatetime>
		</testreport>
		<testreport>
			<testname>Saline</testname>
			<testshortname>Sa</testshortname>
			<testresult>15</testresult>
			<testdatetime>12/21/98 12-30 am</testdatetime>
		</testreport>
		<testreport>
			<testname>Sodium</testname>
			<testshortname>Na</testshortname>
			<testresult>16.84</testresult>
			<testdatetime>12/12/98 10 am</testdatetime>
		</testreport>
		<testreport>
			<testname>Potassium</testname>
			<testshortname>Ka</testshortname>
			<testresult>33.6</testresult>
			<testdatetime>12/12/98 10 am</testdatetime>
		</testreport>
	</reportdetailinfo>


It needs to be displayed as :
		10/16/97	12/12/981	12/21/98
Potassium	10.89		33.6
Saline			10.54		15
Sodium			16.84		11.6

The first row should have testdatetime
The first row should have the testname
The values ahould match with the testname and testdatetime

Please help:
Here is the excerpt of the code that i am using for the values:
I have put the first row in  a table
the first column in a table
The third table listed below contains the values

<xsl:for-each select="//reportdetailinfo/testreport">
	<xsl:sort	select="testname" order="ascending"></xsl:sort>
		<xsl:if test="testname[not(./text()=preceding::testname/text())]">
			<xsl:variable name="preval" select="testname"></xsl:variable>
				<tr>
					<xsl:for-each select="//reportdetailinfo/testreport">
					<xsl:sort select="testdatetime" order="ascending"></xsl:sort>
						<xsl:if
test="testdatetime[not(./text()=preceding::testdatetime/text())]">
						<xsl:variable name="predate" select="testdatetime"></xsl:variable>
							<xsl:for-each select="//reportdetailinfo/testreport">
							<xsl:sort select="testname" order="ascending"></xsl:sort>
								<xsl:if test="testname = $preval and testdatetime = $predate">
									<td width="10"><spacer type="block" height="1" width="1"/></td>
									<td  height="25" width="133">
										<xsl:value-of select="testresult"/>
									</td>
									<td width="1" bgcolor="#999999">
										<spacer type="block" height="1" width="1"/>
									</td>																			</xsl:if>																		</xsl:for-each>
<xsl:if test="$flagprint = 0">
								<td width="10"><spacer type="block" height="1" width="1"/></td>
								<td  height="25" width="133">&#160;</td>
								<td width="1" bgcolor="#999999">
									<spacer type="block" height="1" width="1"/>
								</td>
							</xsl:if>
						</xsl:if>
					</xsl:for-each>
				</tr>
			</xsl:if>
</xsl:for-each>
The output is as follows:
		10/16/97	12/12/981	12/21/98
Potassium	10.89				33.6
Saline			10.54				15
Sodium			16.84				11.6

:-(

HELP !!!

Seema.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.