This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Aggregation
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Aggregation
- From: "Sullivan, Dan" <dsullivan at develop dot com>
- Date: Fri, 7 Sep 2001 14:42:29 -0700
- Reply-To: xsl-list at lists dot mulberrytech dot com
This does it, note it is very sensitive to format of file:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="*" mode ='heading'>
<td><xsl:value-of select="name()"/></td>
</xsl:template>
<xsl:template match="st">
<tr><td><xsl:value-of select="."/></td><xsl:apply-templates
select="following-sibling::*"/></tr>
</xsl:template>
<xsl:template match="*[.='Y']">
<td>X</td>
</xsl:template>
<xsl:template match="*">
<td></td>
</xsl:template>
<xsl:template match="/">
<html>
<body bgcolor="#FFFFFF">
<table rules="all" border="1">
<tr>
<td>State</td>
<xsl:apply-templates
select='eas/ea[1]/*[1]/following-sibling::*' mode='heading'/>
</tr>
<xsl:apply-templates select="/eas/ea/st"/>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Dan
-----Original Message-----
From: Mulberry Technologies List Owner
[mailto:xsl-list-owner@lists.mulberrytech.com]
Sent: Friday, September 07, 2001 5:10 PM
To: xsl-list
Subject: [xsl] Aggregation
>From: "Frenkel, Garry J." <garry.j.frenkel@ssa.gov>
>To: "'xsl-list@lists.mulberrytech.com'"
<xsl-list@lists.mulberrytech.com>
>Subject: Help with aggregation
>Date: Fri, 7 Sep 2001 15:58:26 -0400
>
>Assuming the following xml fragment:
><eas>
><ea>
><st>1</st>
><type1>Y</type1>
><type2>N</type2>
><type3>Y</type3>
></ea>
><ea>
><st>1</st>
><type1>Y</type1>
><type2>N</type2>
><type3>N</type3>
></ea><ea>
><st>2</st>
><type1>Y</type1>
><type2>N</type2>
><type3>N</type3>
></ea>
>etc.
></eas>
>
>The result needs to be an HTML Table like:
>
>State Type1 Type2 Type3
>1 X X
>2 X
>
>In other words for every state designate if it supports any type as
denoted
>by the Y in the typex element.
>
>I've been fooling around with this for a couple of days and am about to
give
>up and use the DOM programatically. I'd appreciate any help.
--
======================================================================
B. Tommie Usdin mailto:btusdin@mulberrytech.com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Phone: 301/315-9631
Suite 207 Direct Line: 301/315-9634
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list