Subject: [xsl] building a tabular format of data From: "Seema R" <seema.r@xxxxxxxxxxxxx> Date: Wed, 30 Jan 2002 20:54:28 +0530 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] insert an attribute value, Joerg Heinicke | Thread | Re: [xsl] building a tabular format, Joerg Heinicke |
Re: [xsl] Include files with relati, paul_dick | Date | Re: [xsl] installation of FOP on So, yan bai |
Month |