This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Newbie question - grouping and subtotaling
- From: "Sai N" <sai at enotify dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 3 Dec 2001 09:09:56 -0500
- Subject: [xsl] Newbie question - grouping and subtotaling
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi gurus,
I am just getting my feet wet with XML and XSLT. I have a problem that
requires transformation of some data that has rows (transformed into XML)
returned from a database into another XML that has the same rows, but has
additional rows that have subtotals.
The idea here is to be able to do the subtotals so that a VB program would
then simply read the XML document and display the report.
I have tried to plough through the MSXML 4.0 documentation and have tried
various things and have hit upong quite a few limitations of the XSLT
process.
e.g., if one tries to introduce an xml:key element, one cannot use
variables - isn't this a pain? I mean - if I wanted to write a generic XSLT
that could take any XML file with the appropriate data structure, shouldn't
I be able to apply a generic transform to convert it to another look? Isn't
that the function of XSLT?
Bear with me - I will explain my gripes.
The sample XML that I have is:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="lib_cat2.xsl"?>
<catalog>
<group_params>
<outer_category>book</outer_category>
<subtotal>price</subtotal>
<category_level1>genre</category_level1>
<category_level2>author</category_level2>
</group_params>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
I want to be able to process ANY XML with this generic format - i.e, with
the <group_params> tag followed by various groupings, followed by the actual
data.
I tried to extend the lib_cat2.xsl example that comes with the MSXML 4.0
developer's kit - and hit upon the variables limitation. The next idea was
to use parameters - but that means the XSLT has already been 'contiminated'
with data.
I guess my developer roots are starting to show through. :-)
Could anyone help me?
Note: There is no HTML whatsoever involved in all of this.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list