xsl-list
[Top] [All Lists]

RE: Problem transforming Excel XML Workbook (or how to implement one-more-counter-yet in XSLT)

2005-11-06 06:44:56
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 
Téléchargez cette version sur http://fr.messenger.yahoo.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>
--~--