[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Problem with msxsl:node-set


Subject: RE: [xsl] Problem with msxsl:node-set
From: "Kenny Akridge" <kenny@xxxxxxxxxxxxxxxxx>
Date: Sat, 27 Mar 2004 19:28:59 -0500

I think I just figured it out right after I submitted this.
[number($begin)] seems to be working.

-----Original Message-----
From: Kenny Akridge [mailto:kenny@xxxxxxxxxxxxxxxxx] 
Sent: Saturday, March 27, 2004 7:25 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Problem with msxsl:node-set

I have this variable, whose internal workings aren't very important:

	<xsl:variable name="uniqueClassDates">
		<xsl:for-each
select="ArrayOfAttendance/Attendance/ClassDate[number(substring(.,1,4)) &gt;
0001
		and not(. = preceding::ClassDate)]">
			<xsl:element name="date">
				<xsl:value-of select="."/>
			</xsl:element>
		</xsl:for-each>
	</xsl:variable>

Which holds this value:

<date>2004-01-10T00:00:00.0000000-05:00</date>
<date>2004-01-11T00:00:00.0000000-05:00</date>
<date>2004-01-12T00:00:00.0000000-05:00</date>

The problem occurs while I am running this comparison:

<xsl:if test="msxsl:node-set($uniqueClassDates)/date[$begin] = ClassDate">

In this case, $begin will be 1, 2 or 3.  However, if I pass ClassDate with
any value that is contained in $uniqueClassDates, it always returns true.
How can I limit the logic to only return true when the $begin position of
date matches ClassDate?

Here is entire template:


<xsl:template name="indexAttendanceCells">
		<xsl:param name="begin"/>
		<xsl:param name="end"/>
		<xsl:choose>
			<xsl:when test="$begin &gt; $end"></xsl:when>
			<xsl:otherwise>
				<xsl:variable name="attended">
					<xsl:if
test="msxsl:node-set($uniqueClassDates)/date[$begin] = ClassDate">
						<xsl:text>true</xsl:text>
					</xsl:if>
				</xsl:variable>
				<xsl:choose>
					<xsl:when test="$attended = 'true'">
						<td>
							X
						</td>
					</xsl:when>
					<xsl:otherwise>
						<td>
							&#xA0;
						</td>
						<xsl:call-template
name="indexAttendanceCells">
							<xsl:with-param
name="begin" select="$begin + 1"/>
							<xsl:with-param
name="end" select="$end"/>
						</xsl:call-template>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>


Current Thread