RE: [xsl] problem with spreadsheet-like xml structure

Subject: RE: [xsl] problem with spreadsheet-like xml structure
From: max@xxxxxxxxxx
Date: Sun, 12 Jun 2005 11:14:47 +0200 (CEST)
Thanks for your answer, Aron.

You are right about the modulo, first it didn't seem to work
but that was because Excel 2003 skips cell elements in its
xml export format when the cells are empty in the spreadsheet
(don't know which genius came up with this idea...),
so the modulo failed.

Actually I have to call ss:Cell/ss:Data, Cell/Data won't return
anything.

The format of the spreadsheet is:

first cell in row: name of person,
followed by 5 blocks of cells which belong to the person:

date
latitude
longitude
note

I got it working now,

Regards,
Max









>>Actually there are a lot more cells, so I have to use:
>>
>><xsl:if test="(position()  = 2) or (position()  = 7) or (position()  =
>> 12)
>>or (position()  = 17) or (position()  = 22) ">
>
> The idea was that, if each group were comprised of a fixed number of
> cells,
> you could use the mod operator to identify the start of each group.  In
> your
> revised example above, it seems to be 5.  Alternatively, if an attribute
> of
> a cell enables it to be identified as the start of a group, you may use
> this
> instead of position().  With either algorithm you may use keys to get you
> just the start-of-group cells.
>
> From your revised data I can't readily make out your group starts; for
> example you skip over Abrikosov.  Perhaps you could explain your
> group-criteria better.  And provide a sample of your required output.
>
>>	<xsl:element name="location">
>>		<xsl:element name="name">
>>			<xsl:value-of select="./ss:Data"/>
>
> AFAICT, that should be select="Data"
>
>>		</xsl:element>
>>		<xsl:attribute name="arrival">
>>			<xsl:value-of select="following-sibling::ss:Cell/ss:Data[1]"/>
>
> Likewise, select="following-sibling::Cell[1]/Data"
>
>
>>		</xsl:attribute>
>>
>>	</xsl:element>
>></xsl:if>
>>
>
>
> Regards,
>
> --A
>
>
>>
>>  <Row>
>>     <Cell><Data ss:Type="String">Abrikosov</Data></Cell>
>>     <Cell><Data ss:Type="String">Moscow, Russia</Data></Cell>
>>     <Cell><Data ss:Type="DateTime">1928-06-25T00:00:00.000</Data></Cell>
>>     <Cell ss:StyleID="s21"><Data ss:Type="String">55.7506N</Data></Cell>
>>     <Cell ss:StyleID="s39"><Data ss:Type="String">37.6276E</Data></Cell>
>>     <Cell ss:Index="7"><Data ss:Type="String">Argonne, Illinois,
>>USA</Data></Cell>
>>     <Cell ss:StyleID="s26"><Data ss:Type="Number">1991</Data></Cell>
>>     <Cell ss:StyleID="s39"><Data ss:Type="String">41.6688N</Data></Cell>
>>     <Cell ss:StyleID="s39"><Data ss:Type="String">87.9846W</Data></Cell>
>>     <Cell><Data ss:Type="String">National laboratory</Data></Cell>
>>     <Cell><Data ss:Type="String">Stockholm, Sweden </Data></Cell>
>>     <Cell ss:StyleID="s26"><Data ss:Type="Number">2003</Data></Cell>
>>     <Cell ss:StyleID="s39"><Data ss:Type="String">59.3323N</Data></Cell>
>>     <Cell ss:StyleID="s22"><Data ss:Type="String">18.0651E</Data></Cell>
>>     <Cell><Data ss:Type="String">Nobel Prize inPhysics</Data></Cell>
>>     <Cell ss:StyleID="Default"><Data ss:Type="String">Argonne, Illinois,
>>USA</Data></Cell>
>>     <Cell><Data ss:Type="Number">1991</Data></Cell>
>>     <Cell ss:StyleID="s39"><Data ss:Type="String">41.6688N</Data></Cell>
>>     <Cell ss:StyleID="s39"><Data ss:Type="String">87.9846W</Data></Cell>
>>     <Cell><Data ss:Type="String">National Laboratory</Data></Cell>
>>     <Cell ss:Index="23" ss:StyleID="Default"/>
>>     <Cell ss:StyleID="Default"/>
>>     <Cell ss:Index="29" ss:StyleID="Default"/>
>>    </Row>
>
> _________________________________________________________________
> FREE pop-up blocking with the new MSN Toolbar  get it now!
> http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Current Thread