[xsl] Ordering my HTML output

Subject: [xsl] Ordering my HTML output
From: "Aaron McGrath" <aaronmcgrath@xxxxxxxxxxx>
Date: Tue, 01 Mar 2005 12:08:08 +0000
Hi All!

I have looked through the list and don't seem to find anything that answers my specific question, but if there is... I apologise!

I have an xml file similar to this:
  <abs:heading class='100' string='test'>
     <abs:heading class='200' string='tester'></abs:heading>
        <abs:heading class='300' string='sometext'></abs:heading>
        <abs:heading class='300' string='somemoretext'></abs:heading>
     <abs:heading class='200' string='testing'></abs:heading>

This is the output I would like:

class = 200 string='tester'
class = 200 string='testing'
class = 300 string='sometext'
class = 300 string='somemoretext'

What I am trying to achieve is to throw out all instances of a specific class, so for example I might do a <xsl:apply-templates select="@class=200">, then I might have a specific template match for that class somewhere.
But then, which is the bit I am struggling with is being able to then list all instances of another class. Now if I then make a call to something like <xsl:apply-templates select="@class=300"> again with a template match somewhere in my xsl, nothing seems to happen.

I think the problem is that the class=300 elements in the xml above could be great great grand children of a class=200 element.

Sample xsl (forgive the errors in syntax, I hope it is clear enough though):

<xsl:apply-templates select="@class=200"/>
<xsl:apply-templates select="@class=300"/>

<xsl:template match="@class=200">
  Output something here

<xsl:template match="@class=300">
  Output something else here

Is it a case of having to do a <xsl:apply-templates/> in the first template match so the rest of the document is parsed in memory?

I hope I have explained my question clearly...?

Thanks for any help or advice!


Current Thread