Allegedly empty sequence in xsl:number select attribute
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 3
- Joined: Sun Jun 17, 2018 2:01 am
Allegedly empty sequence in xsl:number select attribute
I have an XML source that looks shortened like this
I also have a parameter that specifies a range ("A1:B2") and I am trying to calculate the starting and ending row and column with the following (also shortened) XSL:
Now comes the weird part: the XSL correctly retrieves the startCellAddress, endCellAddress, the startCell and endCell, it counts correctly the startRow and startColumn, but the moment it reaches the calculation of the endRow, it throws an error .
Any idea what might go wrong here?
Code: Select all
<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>
Code: Select all
<xsl:variable name="startCellAddress" select="substring-before(.,':')"/>
<xsl:variable name="endCellAddress" select="substring-after(.,':')"/>
<xsl:variable name="startCell" select="$worksheet/xl:worksheet/xl:sheetData//xl:c[@r=$startCellAddress]"/>
<xsl:variable name="endCell" select="$worksheet/xl:worksheet/xl:sheetData//xl:c[@r=$endCellAddress]"/>
<xsl:variable name="startRow">
<xsl:number select="$startCell" count="xl:row"/>
</xsl:variable>
<xsl:variable name="startColumn">
<xsl:number select="$startCell" count="xl:c"/>
</xsl:variable>
<xsl:variable name="endRow">
<xsl:number select="$endCell" count="xl:row"/>
</xsl:variable>
<xsl:variable name="endColumn">
<xsl:number select="$endCell" count="xl:c"/>
</xsl:variable>
Code: Select all
An empty sequence is not allowed as the @select attribute of xsl:number
Any idea what might go wrong here?
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Allegedly empty sequence in xsl:number select attribute
Hi,
This probably means that the XPath used on the xsl:number count="xl:c" will not match anything in a certain context.
But it's hard to tell what the problem is without having a sample XML + XSLT to test with.
Regards,
Radu
This probably means that the XPath used on the xsl:number count="xl:c" will not match anything in a certain context.
But it's hard to tell what the problem is without having a sample XML + XSLT to test with.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 3
- Joined: Sun Jun 17, 2018 2:01 am
Re: Allegedly empty sequence in xsl:number select attribute
You are right - I meanwhile found the error by debugging the XSL template step by step: it was not this case, but another context, where it retrieved a non-existing node.
Thank you very much!
Thank you very much!
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service