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

creating XML hierarchy where not existed before??

Subject: creating XML hierarchy where not existed before??
From: Fred Boon <fredboon@xxxxxxxxx>
Date: Mon, 18 Dec 2000 11:05:56 -0800 (PST)
fred boon
Hi,

I've been banging my head on this for a while now: I
need to create hierarchical XML out of flat XML. The
logic is simple, but I think that I can't perform this
translation in XSL because I can't proceed through the
input file ina serial manner.

In the example that follows:
all group3s following a group2 must be included in the
last group2; all group2s follwing a group1 must be
included in the last group1. There can be any number
of groups that I would like to nest.

Can this problem be solved using XSLT, or will I have
to look somewhere else to process my input files?

Any help greatly appreciated,

//F

INPUT:
<group1>
  <datafield1>value1</datafield1>
  <datafield2>value2</datafield2>
</group1>

<group2>
  <datafield1>value1</datafield1>
  <datafield2>value2</datafield2>
</group2>

<group2>
  <datafield1>another_value1</datafield1>
  <datafield2>another_value2</datafield2>
</group2>

<group3>
  <datafield1>value1</datafield1>
  <datafield2>value2</datafield2>
</group3>

Desired Output:

<group1>
  <datafield1>value1</datafield1>
  <datafield2>value2</datafield2>

  <group2>
    <datafield1>value1</datafield1>
    <datafield2>value2</datafield2>
  </group2>

  <group2>
    <datafield1>another_value1</datafield1>
    <datafield2>another_value2</datafield2>

    <group3>
      <datafield1>value1</datafield1>
      <datafield2>value2</datafield2>
    </group3>

   </group2>

</group1>

__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

 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.