|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] building a tabular format of data
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"> </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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








