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

Multiple grouping with substrings

Subject: Multiple grouping with substrings
From: Ben Fry <Ben_Fry@xxxxxxxxxxxxx>
Date: Tue, 13 Aug 2002 16:53:15 +0100
multiple substr
Hi All,

I have a grouping problem I cannot work out. I have done a couple of
stylesheets with keys but this one has me
befuddled. 

I am having trouble declaring and using a key like this; (I am new to keys
so go easy here)
<xsl:key name="xprogs" match="doc/prog[contains(.,'msx']"
use="substring(.,4,1)"/>

My algorithm is 
	a). Group by 3rd character of prog node ie 'x'  in msx123 followed
by 'y' in msy123
	b). For each unique 4th character of prog node list prog nodes 4 (or
ideally custom value) 
	per line	separated by a single space (produce new line when a
different 4th character  
	encountered).

xml;

<doc>
	<prog>msx123</prog>
	<prog>msx124</prog>
	<prog>msx125</prog>
	<prog>msx126</prog>
	<prog>msx127</prog>
	<prog>msx128</prog>
	<prog>msx129</prog>
	<prog>msx213</prog>
	<prog>msx332</prog>
	<prog>msx423</prog>
	<prog>msx424</prog>
	<prog>msx643</prog>
	<prog>msx743</prog>
	<prog>msx843</prog>
	<prog>msy123</prog>
	<prog>msy223</prog>
	<prog>msy224</prog>
	<prog>msy423</prog>
</doc>

desired output text format;
xxx123 xxx124 xxx125 xxx126
xxx127 xxx128 xxx129
xxx213 
xxx332 
xxx423 xxx424
xxx643
xxx743
xxx843
yyy123
yyy223 yyy224
yyy423

Regards,
Ben
=====================================================================
DISCLAIMER

1. The information contained in this E-mail is confidential. 
   It is intended only for the stated addressee(s) and access 
   to it by any other person is unauthorised. 
   If you are not an addressee, you must not disclose, copy, 
   circulate or in any other way use or rely on the information 
   contained in this E-mail. Such unauthorised use may be unlawful. 
   If you have received this E-mail in error, please inform us 
   immediately and delete it and all copies from your system.

2. The views expressed in this E-mail are those of the author, 
    and do not represent the views of AMT-Sybex Group Ltd., its 
    associates or subsidiaries, unless otherwise expressly indicated.
    In the avoidance of doubt, the insertion of the name of AMT-Sybex 
    Group Ltd., its associate or subsidiary under the name of the sender 
    may constitute an express indication that the views stated in the Mail 
    are those of the named company.
=====================================================================
For more information on the AMT Sybex group visit: http://www.amt-sybex.com 



 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.