Subject: RE: [xsl] Generic stylesheet to flatten XML hierarchy From: Sara Mitchell <samitchell6@xxxxxxxxx> Date: Mon, 7 Dec 2009 10:45:02 -0800 (PST) |
Hm...well it was one idea I had considered but was hoping for a simpler answer. Thanks for the idea, though. I will continue to struggle. --- On Sat, 12/5/09, Michael Kay <mike@xxxxxxxxxxxx> wrote: > From: Michael Kay <mike@xxxxxxxxxxxx> > Subject: RE: [xsl] Generic stylesheet to flatten XML hierarchy > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Date: Saturday, December 5, 2009, 2:26 AM > > > > But probably you know exactly what you're doing, there > is a perfectly > > reasonable algorithm for what you want, and I just > haven't > > understood. > > > > I did once write a fairly generic stylesheet for a client > that was inspired > by the behaviour of the IDEs that show an XML document in > "grid" layout. It > ended up being an interesting set of heuristics that worked > quite well for a > reasonable range of input documents (and didn't fail on > others). It's best > seen as producing nested tables representing successive > levels of hierarchy, > with each table being formatted in one of a number of > different styles based > on pattern matching: a "named colummns" style where a > sequence of elements > each has N children with different names, a "list" style > where elements have > N children with the same name, a "mixed content" style > where elements are > displayed as text, and so on. The patterns have to be > applied consistently > across the whole document, so for example every order-item > element is > displayed in the same way regardless of its own individual > structure. > > I can't remember why we decided to drive it from the actual > data in instance > documents rather than from the schema, but there was a good > reason at the > time. > > It was actually a meta-stylesheet, if I remember right: > rather than doing > the transformation, it generated the stylesheet to do the > transformation. > The idea of that was that once you had the logic to display > one purchase > order (say), you would use the same logic to display other > purchase orders, > so you got a consistent rendition for all of them; it also > allowed > hand-tweaking of the rules. > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay > > > --~------------------------------------------------------------------ > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ > or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> > --~--
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Generic stylesheet to fla, Michael Kay | Thread | Re: [xsl] Generic stylesheet to fla, Sara Mitchell |
Re: [xsl] How to prevent blank line, David Carlisle | Date | Re: [xsl] database and XSL, a kusa |
Month |