Hi Experts,
I am trying to transform a xml (custom schema) to MSExcel using SpreadsheetML
2003 specification. I am using Apache's Xalan-C++ (1.10) and Apache's
Xerces-C++
parser (2.70) for the transformation.
When I convert the xsl variable holding a RTF to a nodeset, it seems to fail. I
try to get the count but always end up with a zero. However if I print the xsl
variable itself using a <xsl:copy-of>, I can see all the rows in the output
file.
Can anyone see the issue with my xsl code?
Here's my stylesheet (with relevant comments)
Stylesheet
=========
<!-- the dataRows variable contains all books for the author
each book indicated by a <Row> element -->
<xsl:variable name="dataRows">
<xsl:call-template name="getBooks">
<xsl:with-param name="authorId" select="$authorId" />
</xsl:call-template>
</xsl:variable>
...
<!-- now I want to know how many rows were returned as
I have to apply some conditional formatting in Excel and
I need the range of cells -->
<!-- So I convert this $dataRows to a nodeset and try to get
the count of <Row> elements using the following XPath -->
<xsl:variable name="rowCount" select="count(exsl:node-set($dataRows)/Row)" />
<!-- the above @select doesn't work, although I can not see why
however, I print the $dataRows itself using xsl:copyof and
I can see all <Row> elements in the output file -->
...
<xsl:template name="getBooks">
<xsl:param name="authorId">
<!-- get all books by the author and print a row (excel row) for each -->
<Row>
<Cell ss:StyleID="s17">
<Data ss:Type="Number>
<xsl:value-of select="$totalPages" />
</Data>
</Cell>
...
<!-- other information about the book -->
</Row>
</xsl:template>
The choice of XalanC and XercesC is beyond my control, so I am stuck with XSLT
1.0
I also tried the same in MS VS2005 but without any success. When I debug in VS,
I can see that $dataRows variable contains the child <Row> elements but the
count is still zero.
Thanks for your help
Satish
--~------------------------------------------------------------------
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>
--~--