xsl-list
[Top] [All Lists]

RE: problem with spreadsheet-like xml structure

2005-06-11 14:14:55
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/


--~------------------------------------------------------------------
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>
--~--