RE: [xsl] Aggregation

Subject: RE: [xsl] Aggregation
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Fri, 7 Sep 2001 23:32:34 +0100
Garry,
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/">	
  <html>
    <body>
      <table>
 
<tr><td>State</td><td>Type1</td><td>Type2</td><td>Type3</td></tr>
          <xsl:apply-templates select="eas/ea[st != preceding::st] |
eas/ea[1]" />
      </table>
    </body>
  </html>
</xsl:template>
<xsl:template match="ea">
  <tr>
    <td><xsl:value-of select="position()" /></td>
    <td><xsl:if test="contains(../ea[st = current()/st]/type1,
'Y')">X</xsl:if></td>
    <td><xsl:if test="contains(../ea[st = current()/st]/type2,
'Y')">X</xsl:if></td>
    <td><xsl:if test="contains(../ea[st = current()/st]/type3,
'Y')">X</xsl:if></td>
  </tr>
</xsl:template>
</xsl:stylesheet>

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Mulberry Technologies List Owner
> Sent: 07 September 2001 22:10
> To: xsl-list
> Subject: [xsl] Aggregation
> 
> 
> 
> >From: "Frenkel, Garry J." <garry.j.frenkel@xxxxxxx>
> >To: "'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'" 
> ><xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> >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@xxxxxxxxxxxxxxxx
> 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


Current Thread