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