XSL Transformation

James.Thompson at dresdnerkb.com James.Thompson at dresdnerkb.com
Mon Mar 29 19:46:34 BST 1999


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




More information about the Xml-dev mailing list