John Smart Posted December 20, 2007 Share Posted December 20, 2007 Hi,I'm currently trying to filter my list of trades alphabetically. Thanks to boen_robot and aalbretski, managed to filter when an element exactly equals a string, but I'd now like to use 'starts-with' to create an alphabetical list.To display all my trades, the line I have is this, which works fine.<xsl:for-each select="/trades/trade">ie, my XML is a list of Trades, (Abatoir, Art Gallery, Welder).Despite my best efforts, i can't seem to get it to filter by letter, and the following line is what I thought was correct (have tried MANY variations!)<xsl:for-each select="/trades/trade[starts-with(trade_description, 'A']">Can anyone point out where I am going wrong?Here's a sample from my xml file: <trades> <trade> <trade_description>Abattoir</trade_description> <rag>Ineligible</rag> <trade_group>Food and Drink</trade_group> <trade_code>7</trade_code> <url>/prod/kite/TechContainer.nsf/FreePagesByUNID/8894C713A72F0D59802570E7003F6A2F?OpenDocument</url> </trade></trades> Link to comment Share on other sites More sharing options...
scopley Posted December 20, 2007 Share Posted December 20, 2007 It sounds like what you may need is a sort on trade_description. Maybe something like this:<xsl:for-each select="/trades/trade"><xsl:sort select="trade_description"/>....</xsl:for-each> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.