Moin,
das Quell-XML sieht wie folgt aus:
Ich habe ein XSL, das auf Grund eines Bereichsparameters "A1:B2" die Position des Start- und End-Elementes ermitteln soll:
Der Bereichsparameter wird übergeben, die Adresse der Start- und End-Zelle wird ermittelt, die Elemente werden gefunden und den Variablen zugeordnet. Das merkwürdige ist nun, daß die erste Positionsermittlung einwandfrei funktioniert und die zweite (End cell number) mit dem Fehler "An empty sequence is not allowed as the @select attribute of xsl:number" fehlschlägt, obwohl $rangeEnd nicht "empty" ist.
Wo liegt mein Denkfehler?
das Quell-XML sieht wie folgt aus:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"> <dimension ref="A1:C4"/> <sheetViews> <sheetView showGridLines="0" tabSelected="1" workbookViewId="0"> <pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/> <selection pane="bottomLeft" activeCell="A2" sqref="A2"/> </sheetView> </sheetViews> <sheetFormatPr defaultColWidth="12.7109375" defaultRowHeight="12.75" x14ac:dyDescent="0.2"/> <cols> <col min="1" max="1" width="4.7109375" customWidth="1"/> <col min="2" max="2" width="7.28515625" customWidth="1"/> <col min="3" max="3" width="25.5703125" bestFit="1" customWidth="1"/> </cols> <sheetData> <row r="1" spans="1:3" x14ac:dyDescent="0.2"> <c r="A1" s="4" t="s"> <v>0</v> </c> <c r="B1" s="5" t="s"> <v>1</v> </c> <c r="C1" s="5" t="s"> <v>2</v> </c> </row> <row r="2" spans="1:3" x14ac:dyDescent="0.2"> <c r="A2" s="2"> <v>1</v> </c> <c r="B2" s="3" t="s"> <v>3</v> </c> <c r="C2" s="3" t="s"> <v>12</v> </c> </row> <row r="3" spans="1:3" x14ac:dyDescent="0.2"> <c r="A3" s="2"> <v>2</v> </c> <c r="B3" s="3" t="s"> <v>4</v> </c> <c r="C3" s="3" t="s"> <v>13</v> </c> </row> <row r="4" spans="1:3" x14ac:dyDescent="0.2"> <c r="A4" s="2"> <v>3</v> </c> <c r="B4" s="3" t="s"> <v>5</v> </c> <c r="C4" s="3" t="s"> <v>14</v> </c> </row> </sheetData> <phoneticPr fontId="0" type="noConversion"/> <pageMargins left="0.78740157499999996" right="0.78740157499999996" top="0.984251969" bottom="0.984251969" header="0.4921259845" footer="0.4921259845"/> <pageSetup paperSize="9" orientation="portrait" r:id="rId1"/> <headerFooter alignWithMargins="0"/> </worksheet>
Code:
<xsl:value-of select="concat('Cell range : ',.)"/> <!-- Find first cell, get positions, find last cell, get positions, make for-each / for-each --> <xsl:variable name="cellStart" select="substring-before(.,':')"/> <xsl:variable name="cellEnd" select="substring-after(.,':')"/> <xsl:value-of select="concat('Start cell: ', $cellStart)"/> <xsl:value-of select="concat('End cell: ', $cellEnd)"/> <xsl:variable name="rangeStart" select="$worksheet/xl:worksheet/xl:sheetData//xl:c[@r=$cellStart]"/> <xsl:variable name="rangeEnd" select="$worksheet/xl:worksheet/xl:sheetData//xl:c[@r=$cellEnd]"/> <xsl:value-of select="concat('Start cell object:', $rangeStart)"/> <xsl:value-of select="concat('End cell object:', $rangeEnd)"/> <xsl:variable name="countStart"> <xsl:number select="$rangeStart" count="xl:c" /> </xsl:variable> <xsl:value-of select="concat('Start cell number: ', $countStart)"/> <xsl:variable name="countEnd"> <xsl:number select="$rangeEnd" count="xl:c"/> </xsl:variable> <xsl:value-of select="concat('End cell number: ', $countEnd)"/>
Wo liegt mein Denkfehler?