Re: [xsl] How to find out number of elements which does not have a particular attribute

Subject: Re: [xsl] How to find out number of elements which does not have a particular attribute
From: "Ranjan K. Baisak" <ranjanbaisak@xxxxxxxxx>
Date: Fri, 9 Jul 2004 03:14:20 -0700 (PDT)
Hello David,
           I am using <xsl:variable
name="sharedcount1"
select="count(connectivity/*[@*[not(local-name() =
'sharedsource')]])"/> for the below document but it
return 2 though there are no elements under
<connectivity> which does not have an attribute with
name  'sharedsource'. Can you please suggest me where
it was going wrong.

<?xml version="1.0" encoding="UTF-8"?>
<projet>
<logicaldesign baseid="1" generated="false" id="123"
name="Design3"  version="1">
				<connectivity baseid="2" id="234" modified="6">
					<device baseid="3" id="456"  name="sdevice1"
nameindex="-1" parent_id="234"
sharedsource="UIDc6eff5-fda2a9da1b-7e46659e4bd09213c638466382babfa0">
						
					</device>
					<device baseid="3" id="678"  name="sdevice1"
nameindex="-1" parent_id="234"
sharedsource="UIDc6eff5-fda2a9da1b-7e46659e4bd09213c638466382babfa0">
						
					</device>

				</connectivity>
				<designsharedusagemgr baseid="123" id="8"/>
			</logicaldesign>
</projet>


regards,
Ranjan

--- "M. David Peterson" <m.david@xxxxxxxxxx> wrote:
> you need to either add a * to complete your shortcut
for 
> "descendant-or-self" reference....
> 
> <xsl:variable name="sharedcount1"
> select="count(connectivity//*[@*[not(local-name() = 
> 'sharedsource')]])"/>
> 
> Good luck!
> 
> <M:D/>
> 
> 
> Ranjan K. Baisak wrote:
> 
> > Hello David,
> >             This looks only "bar" element under
> "foo"
> > but under foo there might be other elements too. I
need some generic 
> > xpath which can give me the
> count. I
> > am using <xsl:variable name="sharedcount1"
> > select="count(connectivity//[@*[not(local-name() =

> > 'sharedsource')]])"/> but this did not work. Do I
> need
> > to modify something?
> > 
> > regards,
> > Ranjan
> > --- "M. David Peterson" <m.david@xxxxxxxxxx>
> wrote:
> > 
> >>select="count(foo/bar[@*[not(local-name() =
'bar')]])"
> >>
> >>Ranjan K. Baisak wrote:
> >>
> >>
> >>>Hello List,
> >>>           Can anybody suggest me how to find out
number of elments 
> >>>which does not have a
> particular
> >>>attribute?
> >>>
> >>>regards,
> >>>Ranjan
> >>>
> >>>
> >>>		
> >>>__________________________________
> >>>Do you Yahoo!?
> >>>Yahoo! Mail - 50x more storage than other
> >>
> >>providers!
> >>
> >>>http://promotions.yahoo.com/new_mail
> >>
> >>
> > 
> > 
> > 
> > 
> > 		
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail - 50x more storage than other
> providers!
> > http://promotions.yahoo.com/new_mail
> 
> 



		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

Current Thread