Saturday, 18 April 2015

Excel xslt rowcount



I have an xml (for brevity sake):



<row>...</row>
<row>...</row>
<row>...</row>
<row>...</row>
<row>...</row>


the last "row" contains the totals, so I was trying to do something like this in the excel xslt (the number of "row" are dynamic)



<Cell ss:Formula="=SUM(R[-{count(row)}]C:R[-1]C)">
<Data ss:Type="Number">
<xsl:value-of select="." />
</Data>
</Cell>


Which will give me: =sum(R[-5]C:R[-1]C).


Because of circular reference problem, I need to get this: =sum(R[-4]C:R[-1]C). I have tried:



ss:Formula="=SUM(R[-{count(row)-1)}]C:R[-1]C)"

ss:Formula="=SUM(R[-({count(row)}-1)]C:R[-1]C)"


but none of those are working. I know I could change the last "row" to "totals" and the row count would be right, but I'd like to do it w/o changing the xml.


Can someone help me with the syntax?


Thanks in advance!!!


No comments:

Post a Comment