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

Re: Generating dynamic HTML table content - headers an

Subject: Re: Generating dynamic HTML table content - headers and cell data
From: Steve <subsume@xxxxxxxxx>
Date: Mon, 31 Jul 2006 16:47:19 -0400
steve yahoo.com
Looks kinda like

<xsl:key name="options" match="measurement" use="@type" />

<xsl:template match="/">
         <td><xsl:value-of select="@time"></td>
         <td><xsl:value-of select="@stage"></td>
<!-- basically gives you each distinct @type -->
                  <xsl:sort select="@type" />
 <!-- sorts it -->
                  <td><xsl:value-of select="@type" /></td>
  <!-- creates a new col -->

This is pretty far from complete but I saw this was your second post
and wanted to at least reply. I may be wrong but this problem seems to
require a recursive algorithm which loops through distinct @type's and
saves them as $col1, $col2, etc, and when complete loops through the
measurements, testing $colX against @type. This is one I have not come
up against, although I have solved similar problems.


On 7/31/06, smithbm33 <smithbm33@xxxxxxxxx> wrote:
I have the following example of XML that I need to
transform into an HTML table.

Requirements are:

The HTML table could be have different column headers
each time it is generated based on the incoming XML -
they are comprised of the two static columns (@time
and @stage) then dynamically based on @type.
Additionally the contents of the rows would be based
on potential groupings of data contained within the
nodes with the context drivers being @stage and @time
within the measurement node (see the second row of the
table below).

I am able to create the table with out the special
logic using XSLT - but this is where I am at a loss
for what XSLT may or may not be able to provide to
perform the additional groupings ang merging, etc..

Thanks in advance...

Here is the XML:

      <measurement stage="Pre" time="12:01" type="CO"
      <measurement stage="Pre" time="12:02" type="O2"
      <measurement stage="Post" time="12:05" type="O2"
      <measurement stage="During" time="12:04"
type="SpO2" uom="%">40</measurement>
      <measurement stage="Pre" time="12:02 "
type="xyz" uom="ml">300</measurement>
      <measurement stage="During" time="12:02"
type="He" uom="%">100</measurement>

The HTML table output that I need is:

Time  | Stage | CO  | O2 | SpO2 | He  | xyz |
12:01 | Pre   | 4.0 |    |      |     |     |
12:02 | Pre   |     | 98 |      |     | 300 |
12:02 | During|     |    |      | 98  |     |
12:04 | During|     |    | 40   |     |     |
12:05 | Post  |     | 88 |      |     |     |

Thanks - Bret

__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Current Thread


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.
First Name
Last Name
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.