[xsl] Consolidating xpath expressions....

Subject: [xsl] Consolidating xpath expressions....
From: Oliver Lord <ol@xxxxxxxxxxxxxxx>
Date: Mon, 01 Dec 2003 10:47:55 +0000
Hi.

Can someone give me some advice as to how I can change these three lines of code into a single line??

<xsl:for-each select="//client[not($clientid) or @ID=$clientid]">
<xsl:for-each select="descendant-or-self::client">
<xsl:for-each select="usage[@TOTALSENT > 0]">
..... do something here....
<xsl:for-each>
<xsl:for-each>
<xsl:for-each>


It would be really great if I could just do..... <xsl:for-each select="### super select that does all that! ###"> ..... do something here.... </xsl:for-each>

... but I just can't figure it out.

The transformation is on an Xml document that's a little bit like this...

<client ID=1>
  <client ID=2>
    <client ID=3>
      <usage @TOTALSENT=5/>
      <client ID=5>
        <usage @TOTALSENT=10/>
      </client>
    </client>
  <client>
  <usage @TOTALSENT=9/>
  <client ID=4>
  </client>
</client>

... and I would like to loop through all the clients at a depth of 'n' in the tree.


Any help would be really great.
Thanks.
Ollie Lord.



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



Current Thread