OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   XSL Transformation

[ Lists Home | Date Index | Thread Index ]
  • From: James.Thompson@dresdnerkb.com
  • To: xml-dev@ic.ac.uk
  • Date: Mon, 29 Mar 1999 18:45:01 +0100

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@ic.ac.uk
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@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS