Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: XSL Transformation Problem

From: MellaBel@-----------.---------.---
To: 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent