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

Re: Generic stylesheet to flatten XML hierarchy

Subject: Re: Generic stylesheet to flatten XML hierarchy
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 03 Dec 2009 14:31:53 -0500
Re:  Generic stylesheet to flatten XML hierarchy

At 01:50 PM 12/3/2009, you wrote:
I've been wandering through the archives and other searches and so far have not found exactly what I am hoping to find. I need to write an XSLT stylesheet that accepts an unknown XML document and flattens the hierarchy to a two-dimensional row/columns structure.

I know the basics, especially when you know the input structure, but this has to be completely generic. The input document may have any level of repeating node sets, including none. I believe we can ignore (at least for the moment) mixed content. I'm getting stuck on the logic to handle the issue of any level of repeating nodes.

Does anyone know of an example of anything approaching this?

It's hard to say without more information about what you mean by a row/columns structure.

A mockup of sample input and output data would be nice. Also, some indication of what you're going to do with these transformation results would help us to guess what sorts of features or facilities would be appropriate.

At the very least, this flattens an arbitrary XML document:

<xsl:template match="*">
    <xsl:apply-templates select="text()"/>
  <xsl:apply-templates select="*"/>

... but run this and you'll see how much information is lost.


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread


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.
First Name
Last Name
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.