Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - RE: XSL Transformation Problem [Thread Next] RE: XSL Transformation ProblemTo: NULL Date: 1/5/2006 7:59:00 AM Anthony, thank you very much! That does it...yuhuu :o) @Martin due to the large xsl and the rather small editor window for posting, one could simply copy and paste in a new file?! Thanks and kisses, Mel "AnthonyWJones" wrote: > Here is a further mod which output the csv directly:- > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:output method="text" encoding="UTF-8" indent="yes" /> > <xsl:template match="/MatchDataset"> > <xsl:text>Block;Row;Category;SeatNo > </xsl:text> > <xsl:for-each select=".//SeatDataset"> > <xsl:value-of select="../../../Block" /><xsl:text>;</xsl:text> > <xsl:value-of select="../../Category" /><xsl:text>;</xsl:text> > <xsl:value-of select="../Row" /><xsl:text>;</xsl:text> > <xsl:value-of select="SeatNo" /><xsl:text> > </xsl:text> > </xsl:for-each> > </xsl:template> > </xsl:stylesheet> > > > "Mel_la_Bel" wrote: > > > Hi All, > > > > I want to make a csv out of an xml file. > > The XML file's structure is: > > <MatchDataset> > > <BlockDataset> > > <Block>A.3</Block> > > <CategoryDataset> > > <Category>2</Category> > > <RowDataset> > > <Row>26</Row> > > <SeatDataset> > > <SeatNo>1</SeatNo> > > </SeatDataset> > > <SeatDataset> > > <SeatNo>2</SeatNo> > > </SeatDataset> > > <MatchDataset> > > > > and I want to put it into a csv file: > > Block;Row;Category;SeatNo > > > > A block can have one or more row that can be of different categories and > > each row can have one or more seats. > > > > I wrote an XSL file, but it gives me only one row in the csv file!! > > Here is the code: > > <xsl:stylesheet version="1.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs xsi"> > > <xsl:output method="xml" encoding="UTF-8" indent="yes" > > doctype-system="C:/DOKUME~1/tnuccio/EIGENE~1/test/result.dtd"/> > > <xsl:template match="/MatchDataset"> > > <Eintrag> > > <xsl:for-each select="BlockDataset"> > > <xsl:for-each select="Block"> > > <xsl:attribute name="block"> > > <xsl:value-of select="."/> > > </xsl:attribute> > > </xsl:for-each> > > </xsl:for-each> > > <xsl:for-each select="BlockDataset"> > > <xsl:for-each select="CategoryDataset"> > > <xsl:for-each select="Category"> > > <xsl:attribute name="kat"> > > <xsl:value-of select="."/> > > </xsl:attribute> > > </xsl:for-each> > > </xsl:for-each> > > </xsl:for-each> > > <xsl:for-each select="BlockDataset"> > > <xsl:for-each select="CategoryDataset"> > > <xsl:for-each select="RowDataset"> > > <xsl:for-each select="Row"> > > <xsl:attribute name="row"> > > <xsl:value-of select="."/> > > </xsl:attribute> > > </xsl:for-each> > > </xsl:for-each> > > </xsl:for-each> > > </xsl:for-each> > > <xsl:for-each select="BlockDataset"> > > <xsl:for-each select="CategoryDataset"> > > <xsl:for-each select="RowDataset"> > > <xsl:for-each select="SeatDataset"> > > <xsl:for-each select="SeatNo"> > > <xsl:attribute name="seatno"> > > <xsl:value-of select="."/> > > </xsl:attribute> > > </xsl:for-each> > > </xsl:for-each> > > </xsl:for-each> > > </xsl:for-each> > > </xsl:for-each> > > </Eintrag> > > </xsl:template> > > </xsl:stylesheet> > > --- > > > > Can anybody explain why onle one row is written? > > > > Thanks in advance, > > Mel | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
