Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - XSL Transformation Problem [Thread Next] RE: XSL Transformation ProblemTo: NULL Date: 1/5/2006 6:25:00 AM Try this xsl:-
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes" />
<xsl:template match="/MatchDataset">
<Eintrags>
<xsl:for-each select=".//SeatDataset">
<Eintrag block="{../../../Block}" kat="{../../Category}" row="{../Row}"
seatno="{SeatNo}" />
</xsl:for-each>
</Eintrags>
</xsl:template>
</xsl:stylesheet>
You XSL is simply replacing the same attributes over and over on a the
single Eintrag tag created.
"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 | |||
|
