Subject: RE: Problem transforming Excel XML Workbook (or how to implement one-more-counter-yet in XSLT)
From: drkm <darkman_spam@xxxxxxxx>
Date: Sun, 6 Nov 2005 14:44:56 +0100 (CET)
|
Michael Kay wrote:
> <xsl:function name="excel:get-cell" as="element(Cell)?">
> <xsl:param name="row" as="element(Row)"/>
> <xsl:param name="cellNr" as="xs:integer"/>
> <xsl:sequence select="excel:get-sibling-cell(Cell[1],
> (Cell[1]/@ss:Index,
> 1)[1], cellNr)"/>
> </xsl:function>
> <xsl:function name="excel:get-sibling-cell" as="element(Cell)?">
> <xsl:param name="current-cell" as="element(Cell)?"/>
> <xsl:param name="current-index" as="xs:integer"/>
> <xsl:param name="required-index" as="xs:integer"/>
> <xsl:sequence select="
> if (exists($current-cell)) then
> if ($current-index eq $required-index) then
> $current-cell
> else
>
excel:get-sibling-cell($current-cell/following-sibling::Cell,
> ($current-cell/following-sibling::Cell/@ss:index,
> $current-index + 1),
$current-index + 1)[1],
isn't it?
> $required-index)
> else ()"/>
> </xsl:function>
And IMHO, you can change the test:
if (exists($current-cell)) then
with something like:
if (exists($current-cell) and
$current-index ge $required-index) then
for stopping the recursion when the element with the
required index is not explicitely present in the document.
--drkm
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Tilichargez cette version sur http://fr.messenger.yahoo.com
|