|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: flat XML to normal XML
Borut, with your CML input, the following XSL
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes" method="xml" omit-xml-declaration="yes"/> <xsl:template match="/"> <NewDataSet> <xsl:for-each select="DataSet/Table[Level = 1]"> <xsl:variable name="next1" select="./following-sibling::*[1]"/> <Transport name="${Description}"> <xsl:for-each select="following-sibling::Table[Level = 2 and not(./following-sibling::Table = $next1)]"> <Brand name="${Description}"> </Brand> </xsl:for-each> </Transport> </xsl:for-each> </NewDataSet> </xsl:template> </xsl:stylesheet> produces: <NewDataSet> <Transport name="$Cars"> <Brand name="$BMW"/> <Brand name="$Citroen"/> <Brand name="$Alfa Romeo"/> </Transport> <Transport name="$Motorcycles"/> </NewDataSet> I'm sure you can work out how to extend this to include models. Regards, --A From: Borut BolDina <bob@xxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] flat XML to normal XML Date: Mon, 16 May 2005 12:24:45 +0200 _________________________________________________________________ Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








