xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Grouping elements by attribute values


Subject: Grouping elements by attribute values
From: DIDM <peter@xxxxxxxxxx>
Date: Tue, 17 Oct 2000 19:49:20 +0100

HI,
Help Please.

I have a set of foo elements. Each foo element has an rl attribute and may
have a wl attribute.
eg.

<foos>
	<foo rl="C" wl="W">CW1</foo>
	<foo rl="C" wl="W">CW2</foo>
	<foo rl="B" wl="W">BW1</foo>
	<foo rl="A" wl="W">AW1</foo>
	<foo rl="C" >C1</foo>
	<foo rl="C" >C2</foo>
	<foo rl="B" >B1</foo>
	<foo rl="A" >A1</foo>
	<foo rl="C" >C3</foo>
</foos>

I want to transform the set such that:

a.  For each unique set of rl and wl attributes there is only one element.
b.  The element values are tramsformed into an NMTOKENS list in the element
with the appropriate attribute set.

ie. to:

<foos>
	<foo rl="C" wl="W">CW1 CW2</foo>
	<foo rl="B" wl="W">BW1</foo>
	<foo rl="A" wl="W">AW1</foo>
	<foo rl="C" >C1 C2 C3</foo>
	<foo rl="B" >B1</foo>
	<foo rl="A" >A1</foo>
</foos>

Peter Sparkes


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor