Re: [xsl] Generic stylesheet to flatten XML hierarchy

Subject: Re: [xsl] Generic stylesheet to flatten XML hierarchy
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 03 Dec 2009 14:56:21 -0500
At 2009-12-03 10:50 -0800, Sara Mitchell 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?

I published one at the request of a fellow UBL committee member:


http://www.CraneSoftwrights.com/resources/ublss/#ublcodex

... you may find the "push" technique used there will guide you.

Another example is the SHOWTREE stylesheet:

http://www.CraneSoftwrights.com/resources/#showtree

I hope these help.

. . . . . . . . . Ken

--
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread