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

Transformation problem with MSXML's XSL

Subject: Transformation problem with MSXML's XSL
From: "Julian Reschke" <reschke@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Jun 1999 10:53:19 +0200
msxml xsl transformation
Hi,

I was trying to do a special transformation with IE5's XSL, but I failed. My
understanding is that it would be possible to do it using the latest spec
and using variables, but I'd like to confirm that it's really not possible
with what IE5 implements now.

The source XML looks like:

<test>
  <record>
     <name>foo</name>
     <date>1999-01-01</date>
  </record>
  <record>
     <name>bar</name>
     <date>1999-01-01</date>
  </record>
  <record>
     <name>foo</name>
     <date>1999-01-03</date>
  </record>
  <record>
     <name>foo</name>
     <date>1999-01-04</date>
  </record>
  <record>
     <name>bar</name>
     <date>1999-01-05</date>
  </record>
</test>

which I would like to transform into something like:

<tree>
  <name>foo
    <date>1999-01-01</date>
    <date>1999-01-03</date>
    <date>1999-01-04</date>
  </name>
  <name>bar
    <date>1999-01-01</date>
    <date>1999-01-05</date>
  </name>
</tree>

So basically I want to generate a tree view out of a set of records. The top
level of the tree should only contain one element per unique <name>, and
contain all matching <date>s.

I succeeded to generate the basic structure by doing for-each, and then for
each <record> going again through the DOM finding matching <date>s,
generating somehting like:

<tree>
  <name>foo
    <date>1999-01-01</date>
    <date>1999-01-03</date>
    <date>1999-01-04</date>
  </name>
  <name>foo
    <date>1999-01-01</date>
    <date>1999-01-03</date>
    <date>1999-01-04</date>
  </name>
  <name>foo
    <date>1999-01-01</date>
    <date>1999-01-03</date>
    <date>1999-01-04</date>
  </name>
  <name>bar
    <date>1999-01-01</date>
    <date>1999-01-05</date>
  </name>
  <name>bar
    <date>1999-01-01</date>
    <date>1999-01-05</date>
  </name>
</tree>

But how can I prevent to generate new entries for each of the additional
entries for the same <name>? It seems to me that I need some method to
preserve state information while the stylesheet executes...

Regards, Julian



--
Julian F. Reschke (mailto:reschke@xxxxxxxxxxxxxxxxxxxxx)
MedicalData Service GmbH Münster, Germany


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


Current Thread

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
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.