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

RE: building a tabular format of data

Subject: RE: building a tabular format of data
From: "Seema R" <seema.r@xxxxxxxxxxxxx>
Date: Wed, 13 Feb 2002 11:14:43 +0530
seema r
Thanks Joerg,

It works just great by itself. However, in the stylesheet that I am using I
have already set
<xsl:template match="/"> since I have to get values of other nodes before I
get to the reportdetailinfo tag.
I cannot embed the another <xsl:template> ie; <xsl:template
match="reportdetailinfo"> within this.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
	<xsl:template match="/">
		<html>
			<body>
				<form>
					...Display some information on patient...
					... If the report type is textual display accordingly...
					Else
					... the code as given by you to display tabular format of reports
				</form>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>

Please let me know if there is some way to solve this.
Thanks,
Seema.


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Joerg
Heinicke
Sent: Saturday, February 09, 2002 9:48 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  building a tabular format of data


I think there was no answer on your problem until now:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output indent="yes" method="html"/>

<!-- grouping by date, without the time -->
<!-- adding time-information by replacing all substring(testdatetime,1,8) by
testdatetime in the whole file -->
<xsl:key name="dates" match="testreport" use="substring(testdatetime,1,8)"/>
<xsl:key name="names" match="testreport" use="testname"/>

<xsl:template match="reportdetailinfo">
    <xsl:variable name="unique_dates"
select="testreport[count(.|key('dates',
substring(testdatetime,1,8))[1])=1]"/>
    <table border="1">
        <tr>
            <td>&#160;</td>
            <xsl:for-each select="$unique_dates">
                <!-- sort in format yymmdd -->
                <xsl:sort
select="concat(substring(testdatetime,7,2),substring(testdatetime,1,2),subst
ring(testdatetime,4,2))"/>
                <td><xsl:value-of
select="substring(testdatetime,1,8)"/></td>
            </xsl:for-each>
        </tr>
        <xsl:apply-templates select="testreport[count(.|key('names',
testname)[1])=1]">
            <xsl:sort select="testname"/>
            <xsl:with-param name="unique_dates" select="$unique_dates"/>
        </xsl:apply-templates>
    </table>
</xsl:template>

<xsl:template match="testreport">
    <xsl:param name="unique_dates"/>
    <!-- all testreports with this testname -->
    <xsl:variable name="names" select="key('names',testname)"/>
    <tr>
        <td><xsl:value-of select="testname"/></td>
        <xsl:for-each select="$unique_dates">
            <!-- must be same sort like above -->
            <xsl:sort
select="concat(substring(testdatetime,7,2),substring(testdatetime,1,2),subst
ring(testdatetime,4,2))"/>
            <td>
                <!-- select the testresult which matches in $names and
$dates -->
                <xsl:value-of select="$names[substring(testdatetime,1,8) =
substring(current()/testdatetime,1,8)]/testresult"/>
                <xsl:text>&#160;</xsl:text>
            </td>
        </xsl:for-each>
    </tr>
</xsl:template>

</xsl:stylesheet>

I don't know whether it's the best solution or if it's understandable. I
added a few comments, which may help.
One thing for more readable XSL-code: change the date-format in XML into a
yyyymmdd-format.

Regards,

Joerg

> -----Original Message-----
> From: Seema R [mailto:seema.r@xxxxxxxxxxxxx]
>
> Sorry, I should have known that the tabular format that i had printed it
in
> would not show as it was done!!!
> I will separate the values with asterisks.
> Needs to be displayed as ;
> ************ 10/16/97***12/12/98***12/21/98
> Potassium ****  10.89   ***  33.6  ***
> Saline     ****          *** 10.54  ***  15
> Sodium   ****          *** 16.84  ***  11.6
> The output I am getting is:
> ************ 10/16/97***12/12/98***12/21/98
> Potassium ****  10.89   ***  33.6  ***
> Saline    ****  10.54   ***   15   ***
> Sodium   ****  16.84   ***   11.6 ***
> I guess I will have to simply alter the XML structure.................the
> problem is that the broker sends it in that format.
> Any suggestions other than changing the XML structure? That would be the
> last bet.
> Thanx,
> Seema.


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


 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.