Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old January 18th, 2007, 02:00 PM
Authorized User
 
Join Date: Nov 2006
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Order of node parsing

Hello all!

I have different nodes which appear in different order, like:
          <A ...>
            ...
          </A>
          <B ...>
            ...
          </B>
          <A ...>
            ...
          </A>
and so one. How can I make the processor go through all the A nodes first (thus displaying them first), then go through nodes B and displaying them, and so one. Currently, it displays A, B, A, etc.
In my XSL file I have something like:
          <xsl:template match="/">
            <xsl:apply-templates select="//A|//B"/>
          </xsl:template>

I'm using XSLT 2.0 and Saxon.

Best regards,
Fred
  #2 (permalink)  
Old January 18th, 2007, 02:33 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default



Assuming the wrapper element is called DOC,

<xsl:template match="DOC">
  <xsl:apply-templates select="A"/>
  <xsl:apply-templates select="B"/>
</xsl:template>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
  #3 (permalink)  
Old January 18th, 2007, 03:12 PM
Authorized User
 
Join Date: Nov 2006
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much Mr. Kay!

Best regards,
Fred


Similar Threads
Thread Thread Starter Forum Replies Last Post
TreeView and SiteMap Node Order robzyc ASP.NET 1.0 and 1.1 Basics 0 May 19th, 2008 04:27 AM
The reference node is not a child of this node.XSL XMLUser XSLT 2 February 25th, 2008 05:22 AM
how to append child node after an node in XML + C# vishnu108mishra XML 5 November 13th, 2007 05:30 AM
Copying Source Node attributes to output node pvsat XSLT 2 November 3rd, 2005 09:46 AM
document node order vs sort node order. ladyslipper98201 XSLT 2 June 5th, 2003 11:06 AM





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