|
Subject: [xsl] Cannot select a node here: the context item is an atomic value From: chris <oneskiingfool@xxxxxxxxx> Date: Tue, 5 Apr 2005 11:10:58 -0600 |
Hello,
I'm using XSLT/XPath 2.0 and am stuck on a very basic problem again.
All I want to do is nest my for-each loop inside another loop so that
the inner for-each loops executes x number of times.
To be more specific, I'm creating an HTML table with dates running
down the left column and corresponding values in the rest of the
cells.
So I have date range: $date1 to $date2
I calculated the number of days between the two: $dayCount
<xsl:for-each select="1 to $dayCount">
<xsl:variable name="day" select="($date1+
xdt:dayTimeDuration(concat('P',position()-1,'D')))"/>
<tr>
<td>
<xsl:value-of select="format-dateTime($day,'[Y,*-2]-[M,2]-[D,2]')"/>
</td>
<xsl:for-each select="my/xpath/query[@day=$day]">
<td>
<xsl:value-of select="."/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
The inner loop gives me this error:
Cannot select a node here: the context item is an atomic value
Could somebody kindly let me know how to do this? It's clearly stated
in the documentation that I can't do it this way (nest node loops in
atomic loops), but I don't see a workaround.
P.S. Also any hints if there is a better way to do that outer loop
would be appreciated as well.
Thanks!
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] math return result proble, Michael Kay | Thread | RE: [xsl] Cannot select a node here, Michael Kay |
| [xsl] Re: Spam:[xsl] math return re, JBryant | Date | RE: [xsl] math return result proble, Michael Kay |
| Month |