If you know that the data is in groups of three, you can use
<xsl:template match="row">
<xsl:for-each select="cell[position() mod 3 = 1]">
<location>
<name><xsl:value-of select="."/></name>
<note><xsl:value-of select="following-sibling::cell[1]"/></note>
<date><xsl:value-of select="following-sibling::cell[2]"/></date>
</location>
</
</
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: max(_at_)gaerber(_dot_)de [mailto:max(_at_)gaerber(_dot_)de]
Sent: 11 June 2005 21:40
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] problem with spreadsheet-like xml structure
Hi all,
I am trying to convert data in an Excel's xml-format to a
custom xml-format.
The logical structure of the Excel data is
<table>
<row>
<cell> location1 <cell>
<cell> note <cell>
<cell> date1 <cell>
<cell> location2 <cell>
<cell> note2 <cell>
<cell> date2 <cell>
<cell> location3 <cell>
<cell> note3 <cell>
<cell> date3 <cell>
</row>
<row>
...
</row>
</table>
What I need is:
<row>
<location date="date1">
<name>location1</name>
<note>note1</note>
</location>
<location date="date2">
<name>location2</name>
<note>note2</note>
</location>
<location date="date3">
<name>location3</name>
<note>note3</note>
</location>
<row>
I can get the location cells ( using position() ) and place
the cell data
into my location element but
then I don't know how to place the following cells inside
this location
element.
<xsl:if test="position() =1 ">
<xsl:element name="location">
<xsl:element name="name">
<xsl:value-of select="."/>
</xsl:element>
<!-- PLACE HERE NEXT TWO CELLS -->
</xsl:element>
</xsl:if>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--