Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl:for-each and not() 1

Status
Not open for further replies.

NBartomeli

Programmer
Jul 1, 2003
111
US
I am trying to do a for-each but leaving out certain nodes,

something like:
Code:
<xsl:for-each select="/Report/*[not(/Totals)]">

In other words, I want all the nodes under Report, except the "Totals" nodes..

Can I do this?

Thanks
 
Code:
<xsl:for-each select="/Report/*[local-name() != 'Totals']">

might do it.. although I think your method would work too ... but it might need to be:

Code:
<xsl:for-each select="/Report/*[not(Totals)]">

rather than /Totals. [untested]

 
Thanks for your input.

I tried both of your suggestions, but neither seemed to work.

Thanks

 
ok given:

Code:
<test>
<reports>
	<report>
		<bing>12</bing>
		<bang>124</bang>
		<bong>242</bong>
		<total>124534</total>
	</report>
	<report>
	<bing>453</bing>
<bang>432</bang>
<bong>321</bong>
<total>124534</total>
</report>
</reports>
</test>

use

Code:
<xsl:for-each select="test/reports/report/*[local-name() != 'total']">

 
I am using something like:

Code:
<report>
  <pagelevel>
    <rowlevel>
      <collevel>data1</collevel>
      <collevel>data2</collevel>
    </rowlevel>
  </pagelevel>
  <pagelevel>
     ...
     ...
  </pagelevel>
  <Totals>123</Totals>
  <Totals>321</Totals>
</Report>

I want to get each page level node, or every node under Report which isn't a Totals node

Thanks

 
I got it. I was making this alot more complex than it had to be.

I simply needed:

Select="/Report/PageLevel"

since there are no other nodes under Report besides PageLevel and Totals

Thanks for your input guys.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top