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

[xsl] how select all siblings?


Subject: [xsl] how select all siblings?
From: "Hardy Merrill" <HMerrill@xxxxxxxxxxxxxxxx>
Date: Tue, 12 Oct 2004 14:42:17 -0400

Here's a snippet from an XSL style sheet:

<xsl:template name="display_section">
	<xsl:param name="section_legislators"/>

	<tr><td colspan="4">Count section_legislators:<xsl:value-of
select="count($section_legislators)"/></td></tr>	
	<xsl:variable name="sorted_legislators">
		<xsl:for-each select="$section_legislators">
			<xsl:sort select="district_type" />
			<xsl:sort select="district_no"
data-type="number" />
			<xsl:sort select="legislator_active_date"
data-type="number" order="descending" />
			<xsl:copy-of select="."/>	
		</xsl:for-each>
	</xsl:variable>
	<tr><td colspan="4">Count sorted_legislators: <xsl:value-of
select="count(msxsl:node-set($sorted_legislators))"/></td></tr>
-------------------------------------------------------------------------------

Param "section_legislators" is a node-list consisting of many
"legislator" nodes - each legislator node has several child nodes like
"full_name", "district_type", etc.

I put in the <tr> tag displaying Count section_legislators to ensure
that "section_legislators" is really a node list.  That <tr> displays a
row saying that there are 243 for a count of section_legislators.  But,
the <tr> displaying the count of sorted_legislators shows only 1.

I'm sure my for-each select is incorrect for variable
"sorted_legislators".  I want *all* legislator nodes in
"section_legislators" to be in "sorted_legislators" - just sorted.  What
should my "select" in the for-each be for "sorted_legislators"?

Thanks.

Hardy Merrill


Current Thread
Keywords
xsl