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

RE: Comparison Table for XML files

Subject: RE: Comparison Table for XML files
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 14 Jun 2007 09:27:18 +0100
RE:  Comparison Table for XML files
In 2.0 it's basically

<xsl:for-each select="distinct-values($files/nodes/node/name)">
  <xsl:variable name="name" select="."/>
  <row>
    <xsl:for-each select="$files">
      <column>
        <xsl:value-of select="(nodes/node[name=$name]/value, 'NA')[1]"/>
      </column>
    </xsl:for-each>
  </row>
</xsl:for-each>

adapted of course to your precise input structure, plus a little code to add
row and column headers.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Dan Johnson [mailto:siliconice@xxxxxxxxx] 
> Sent: 14 June 2007 03:11
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Comparison Table for XML files
> 
> I need to generate a comparison table of several XML data files.
> 
> Each data file contains various nodes with "names" and 
> "values". Some nodes exist on one file and not in others. No 
> one file is guaranteed to have all possible node "names".
> 
> I would like to generate a table (using XSLT) as follows:
> 
> The left column will be the "name" - all names from the input 
> files need to be listed in this column. Each file will have a 
> corresponding labeled column in the table, and the value of 
> each "name" node will be placed in the correct spot in the 
> grid. If a particular file does not have a "name" node for 
> some name, a filler will be inserted ("N/A" or
> something) instead of a value. This may not show up, but for example:
>      (f1)   (f2)   (f3)
> A   NA    2     3
> B   1     NA    NA
> C   1      2      NA
> 
> A real-world example of such a table is a product feature 
> comparison chart for various products.
> 
> It's a very simple concept, but not so simple to implement it seems.

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.