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

Re: Grouping and conditional info questions

Subject: Re: Grouping and conditional info questions
From: "Yang" <sfyang@xxxxxxxxxxxxx>
Date: Sat, 25 Aug 2001 16:11:34 +0800
jfor xsl text
Hi,  Ying Qin

The following xslt may be one of your solutions.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml"  indent="yes"/>
<xsl:key name="item" match="item" use="id" />

<xsl:template match="/">
<groups>
  <xsl:for-each
      select="docs/item[count(.|key('item', id)[1]) = 1]">
<group>
    <title><xsl:text>Group</xsl:text>
      <xsl:number value="position()" format=" A"/>
      </title>
    <xsl:for-each select="key('item', id)">
     <item>
      <xsl:copy-of select="*"/>
     </item>
    </xsl:for-each>
    <xsl:text>&#xA;</xsl:text>
</group>
  </xsl:for-each>
</groups>
</xsl:template>
</xsl:stylesheet>

Basically,  your problem is a typical group method, which
Jeni Tennison is one of the best to illustrate the solution for this kind
of method.

One of her most most recent post is on
http://sources.redhat.com/ml/xsl-list/2001-08/msg01289.html(title:grouping
headers)
I highly recommend you to read this one  and her web site. It will help
yourself a
lot to be familiar with the subject about how to solve the group problem
using key and
Muenchian method.

Besides, copy-of is to copy  child node of item,  and xsl:number to get your
desired title name.

Hope it will help.

cheers.


Sun-fu Yang,

sfyang@xxxxxxxxxxxxx


 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.