[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Converting from Excel 2003 to a table XSLT 1.0 (sa

Subject: RE: Converting from Excel 2003 to a table XSLT 1.0 (saxon 6.5)
From: "Kaila Kaarle" <Kaarle.Kaila@xxxxxxx>
Date: Wed, 27 Jul 2005 13:43:56 +0300
excel ss index
I succeeded in the transformation from Excel 2003 to simple table elements.
Thanks a lot for you help.

If I use Saxon 6.5 I must use namespaces in the xslt but when I use the xerces
2.? library  the namespaces must be removed from the xslt i.e. I have one xslt
file with namespaces definitions for saxon6.5 and same without namespace
definitions for the xerces library. I assume one of them does not function
right. Which one is right or am I missing something?

regards
Kaarle


-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: 26. heindkuuta 2005 12:29
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Converting from Excel 2003 to a table XSLT 1.0 (saxon
6.5)


I suspect the test you want to apply is not ss:Index > position(), but
ss:Index > the implicit index of the previous cell, where the implicit index
is the ss:Index value if there is one, or the implicit index of the previous
cell + 1 if not.

Or to put it another way, the column position if there is no ss:Index is
equal to the most recent ss:Index value plus the number of intervening Cells
with no ss:Index plus one.

One way to tackle this would be to first expand the tree by adding the
implicit ss:Index values for cells where they are missing.

There's a good use for functions here, as defined in XSLT 2.0 - especially
memo-functions as implemented in Saxon. You can define the index() of a cell
as being its @ss:Index value if it has one, or the index() of the
preceding-sibling::Cell[1] +1 if not, or 1 if it's the first cell.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Kaila Kaarle [mailto:Kaarle.Kaila@xxxxxxx]
> Sent: 26 July 2005 09:43
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Converting from Excel 2003 to a table XSLT 1.0
> (saxon 6.5)
>
> hello,
>
> I am converting an Excel 2003 Table element to an html table element.
>
> Conversion goes OK if all elements have content or even if
> one set of elements are empty but if more than one set of
> elements are empty then I get it wrong. Can anybody give me
> good advice on this:
>
> This is how teh Table Row looks like in Excel. First Cell
> element begins at column 3 and the 4th Cell element begins at
> column 7.
> ----------------------------
> <Row>
> <Cell ss:Index="3" ss:StyleID="s25">
> <Data ss:Type="String">L1</Data>
> </Cell>
> <Cell>
> <Data ss:Type="String">Eland</Data>
> </Cell>
> <Cell>
> <Data ss:Type="String">se</Data>
> </Cell>
> <Cell ss:Index="7">
> <Data ss:Type="String">Ahvenanmaa</Data>
> </Cell>
> </Row>
> ------------------------------
>
> This is what I have made sofar: It adds correct amount of
> empty cells for 1st Cell but I have not figured out how to
> calculate on what <td> element I am the next time.
>
>
> <xsl:template match="ss:Cell">
> <xsl:if test="@ss:Index &gt; position()">
> <xsl:call-template name="produce-empty-cells">
> <xsl:with-param name="count" select="@ss:Index - position()"/>
> </xsl:call-template>
> </xsl:if>
> <td>
> <xsl:value-of select="ss:Data"/>
> </td>
> </xsl:template>
>
> <xsl:template name="produce-empty-cells">
> <xsl:param name="count"/>
> <xsl:if test="$count != 0">
> <td></td>
> <xsl:call-template name="produce-empty-cells">
> <xsl:with-param name="count" select="$count - 1"/>
> </xsl:call-template>
> </xsl:if>
> </xsl:template>
>
> -----------------
>
> regards
> Kaarle Kaila

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.