RE: [xsl] <xsl:sort> using a derived element

Subject: RE: [xsl] <xsl:sort> using a derived element
From: "RUSSO, EDITH" <EDIRUS@xxxxxxxxxx>
Date: Tue, 6 Mar 2001 10:45:06 -0800
Hi Jeni!

Since I'm not doing exactly what you mentioned, I put in more snippets and a
better picture of the data...

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0"> 
...
<tr>
	<td>Office: </td>
	<td><SELECT id="office">
	<xsl:apply-templates select="PATHFINDER/List[ListID='102000']">
		<xsl:sort select="substring-after(ItmDesc,'-')"
order="ascending"/>
	</xsl:apply-templates>
		</SELECT>
	</td>
</tr>
...
<xsl:template match="PATHFINDER/List[ListID='102000']">
	<xsl:for-each select="Itm">
		<OPTION><xsl:attribute name="value"><xsl:value-of
select="ItmID"/>
</xsl:attribute><xsl:value-of select="substring-after(ItmDesc,'-')"/>
</OPTION>
	</xsl:for-each>
</xsl:template>

<PATHFINDER version="2000">
	<List>
		<ListID>102000</ListID>
		<ListDesc>Legal Office</ListDesc>
		<Itm>
			<ListID>102000</ListID>
			<ItmID>102020</ItmID>
			<ItmDesc>020-Glendale</ItmDesc>
		</Itm>
		<Itm>
			<ListID>102000</ListID>
			<ItmID>102021</ItmID>
			<ItmDesc>021-Ventura</ItmDesc>
		</Itm>
	</List>
</PATHFINDER>

//What you have should work as long as the ItmDesc elements are children of
//the elements that you're sorting.  You should have something like:

// <xsl:for-each select="Itm">
//    <xsl:sort select="substring-after(ItmDesc, '-')"
//              order="ascending" />
//    ...
// </xsl:for-each>

//with the source being something like:

//  <Itm>
//     <ItmDesc>214-Spokane</ItmDesc>
//  </Itm>
//  <Itm>
//     <ItmDesc>534-Hullabaloo</ItmDesc>
//  </Itm>

//I guess another possibility would be that you might be using the old
//MSXML namespace rather than the XSLT namespace?



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread