Subject: [xsl] Transform XML to CSV with XSLT pipeline From: Jesper Tverskov <jesper@xxxxxxxxxxx> Date: Fri, 17 Sep 2010 07:50:24 +0930 |
Hi list I have made a tutorial, http://www.xmlplease.com/pipeline_xml2csv, a pure XSLT pipeline of 7 transformations, as an easy to understand showcase for XSLT at its best: the identity transformation with templates of exceptions. The solution is also an example of a pure XSLT pipeline of many transformations, each step transforming the outcome of the previous step. Having done a lot of XSLT training over the last five years, it is my experience that educators often need easy to understand examples of the full power of XSLT. ----- I have a question to the list about the "equalizing" step stylesheet (see tutorial), the step that adds missing optional elements. Is there a better way to do it? My "equalizing" stylesheet works as follows (flattening has already taken place): 1.The input XML document is transformed to a temporary tree in order to add a count-children-of-item attribute to all item elements with the count of children elements. 2.The input document is sorted by the children count to get the "item" element with most children first. 3.A list is made of distinct children names. 4.The input file is transformed to a temporary tree, using the list of distinctive element names to create the children. If a child exists more than once, it is recreated as often as required with distinctive names like "member_1", "member_2", etc. 5.A new temporary tree is created and sorted to get the "item" element with most children first. 6.A new list of distinctive element names is created, and a new temporary tree is generated based on the list, and the "_1", "_2", etc, are now deleted from the element names. Cheers, Jesper Tverskov http://www.xmlkurser.dk http://www.xmltraining.net http://www.xmlplease.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] [ann] oXygen version 12 -, Lars Huttar | Thread | Re: [xsl] Transform XML to CSV with, Michael Kay |
RE: [xsl] Selecting the value from , Shashank Jain | Date | Re: [xsl] Selecting the value from , Imsieke, Gerrit, le- |
Month |