Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 23rd, 2009, 02:13 PM
Registered User
Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re-ordering values


I have an XML file (simplified):

  <Industry name="Industry One">
    <Ticker market="Blue" Symbol="AAA" />
    <Ticker market="Green" Symbol="BBB" />
  <Industry name="Industry Two">
    <Ticker market="Green" Symbol="XXX" />
    <Ticker market="Blue" Symbol="YYY" />
[Industry repeats]
Output must be:

                 Blue       Green
Industry One     AAA        BBB
Industry Two     YYY        XXX
The Blue column will always appear first in the output, but there are situations (out of my control) where the Green item may appear first in the XML.

Any suggestions on some XSL code to handle this? I have everything else in place but the test/solution for this re-ordering situation.

Old April 23rd, 2009, 02:19 PM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

You just need to specify the Ticker element using the market attribute:
Ticker[@market = 'Blue']
Old April 23rd, 2009, 02:40 PM
Registered User
Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Ahha! That did the trick - thanks much.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ordering rows problem ami4quest6 SQL Language 10 October 12th, 2005 01:13 AM
Ordering a dataview Louisa VB.NET 2002/2003 Basics 1 November 11th, 2004 10:04 AM
Ordering results EstherMStrom XSLT 6 October 13th, 2004 09:50 AM
alternate ordering polecat XSLT 17 October 2nd, 2003 08:35 AM
Ordering lists POL XSLT 3 June 9th, 2003 11:39 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.