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

RE: Converting a SQL XML Resultset using XSL...

Subject: RE: Converting a SQL XML Resultset using XSL...
From: "SANSONE, AARON M [Non-Pharmacia/1000]" <aaron.m.sansone@xxxxxxxxxxxx>
Date: Thu, 28 Feb 2002 18:22:01 -0500
xml resultset
I was really interested in an XSL solution which you have so appropriately
provided.  Thank you both very much for your suggestions.  The XSL Joerg
provided worked beautifully.  I'm starting to better understand grouping in
XSL. 

Thanks again,

Aaron

> -----Original Message-----
> From: Joerg Heinicke [mailto:joerg.heinicke@xxxxxx]
> Sent: Thursday, February 28, 2002 1:53 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Converting a SQL XML Resultset using XSL...
> 
> 
> Hello Aaron,
> 
> if you don't want the SQL-solution or can not use it, here is the
> XSLT-solution:
> 
> Your problem is a grouping problem. Some information you can 
> find here:
> http://www.jenitennison.com/xslt/grouping/index.xml. In your 
> case you need a
> multiple level grouping, first by id, second by tag_name. Using the
> Muenchian Method you need for this at first the id and at second a
> concatenated string with id and tag_name:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" version="1.0" encoding="ISO-8859-1" 
> indent="yes"/>
> 
> <xsl:key name="rows1" match="row" use="id"/>
> <xsl:key name="rows2" match="row" use="concat(id,'::',tag_name)"/>
> 
> <xsl:template match="page">
>     <xsl:copy>
>         <xsl:apply-templates select="rowset/row[count( . | 
> key('rows1',
> id)[1] ) = 1]" mode="rows1"/>
>     </xsl:copy>
> </xsl:template>
> 
> <xsl:template match="row" mode="rows1">
>     <individual id="{id}" name="{display_name}">
>         <xsl:apply-templates select="key('rows1',id)[count( . 
> | key('rows2',
> concat(id,'::',tag_name))[1] ) = 1]" mode="rows2"/>
>     </individual>
> </xsl:template>
> 
> <xsl:template match="row" mode="rows2">
>     <tag name="{tag_name}">
>         <xsl:apply-templates select="key('rows2',
> concat(id,'::',tag_name))"/>
>     </tag>
> </xsl:template>
> 
> <xsl:template match="row">
>     <tmp name="{tmp_name}" score="{score}"/>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> Hope this helps. But maybe it's better to use the 
> SQL-solution provided by
> Kirk.
> 
> Regards,
> 
> Joerg
> 
> 
>  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.