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

XSL Transformation

  • From: James.Thompson@d...
  • To: xml-dev@i...
  • Date: Mon, 29 Mar 1999 18:45:01 +0100

xsl codes
Hi,

I have an XML doc that looks like this

<STOCKITEM>
	<CATEGORY>A</CATEGORY>
	<STOCKCODE>123</STOCKCODE>
</STOCKITEM>
<STOCKITEM>
	<CATEGORY>A</CATEGORY>
	<STOCKCODE>456</STOCKCODE>
</STOCKITEM>
<STOCKITEM>
	<CATEGORY>B</CATEGORY>
	<STOCKCODE>789</STOCKCODE>
</STOCKITEM>

I would like to transform it into this kind of structure using XSL:

<CATGEGORY name="A">
	<STOCKITEM>
			<CODE>123</CODE>
	</STOCKITEM>
	<STOCKITEM>
			<CODE>456</CODE>
	</STOCKITEM>
</CATEGORY>
<CATGEGORY name="B">
	<STOCKITEM>
			<CODE>789</CODE>
	</STOCKITEM>
</CATEGORY>

I don't know the categories in advance, and there are also sub cats that
will nest within the categories. I could do it using scripts and some kind
of fudge based on the SQL SELECT DISTINCT category idea. However, I think
this is somewhat against the spirit of XSL. Any ideas on how this might be
done? I can't be this first person to want to do this kind idiom.

Many Thanks

James Thompson



##########################################
This email, its content and any files transmitted with it are intended
solely for the addressee(s) and may be legally privileged and/or 
confidential. Access by any other party is unauthorised without the
express written permission of the sender. If you have received this 
email in error you may not copy or use the contents, attachments or 
information in any way. Please destroy it and contact the sender on 
the number printed above, via the Dresdner Kleinwort Benson 
switchboard on +44 171 623 8000 or via e-mail return. Internet 
communications are not secure unless protected using strong 
cryptography. This email has been prepared using information believed
by the author to be reliable and accurate, but Dresdner Kleinwort 
Benson makes no warranty as to accuracy or completeness. In particular
Dresdner Kleinwort Benson does not accept responsibility for changes
made to this email after it was sent. Any opinions expressed in this 
document are those of the author and do not necessarily reflect the 
opinions of the Bank or its affiliates. They may be subject to change
without notice.
##########################################

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.