[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: topological sort

Subject: Re: Re: topological sort
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 5 Jan 2001 10:35:40 +0000
topological sorting .c
Hi Joerg,

> Can one of the gurus please comment on the
> "count(field/type/ref)=count(...)"

I'm sure David C. will have posted by the time this gets out, but what
the hey. The full XPath is:

  struct[not($processed/name=name)
         and count(field/type/ref)=count(field/type/ref[$processed/name=.])]

and the bit that you want commenting on is:

  count(field/type/ref) = count(field/type/ref[$processed/name = .])

What this does is test whether the number of field/type/refs in the
struct is the same as the number of field/type/refs in the struct
whose content is the same as one of the $processed/names.  In other
words, do all the field/type/refs in the struct have a value equal to
one of the $processed/names.

This will be false if any of the field/type/refs in the struct have a
value that is not equal to one of the $processed/names.  Or, if there
are any field/type/refs in the set:

  field/type/ref[not(. = $processed/name)]

So your construct count be replaced by:

  not(field/type/ref[not(. = $processed/name)])

I'm not sure whether this will be more efficient - it probably depends
on the processor.  An optimised processor might be able to stop after
finding just one field/type/ref whose value isn't a processed name,
rather than having to collate all the field/type/refs for counting
once, then collecting all those that have been processed for counting
again.  Probably the best thing is to try and see.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.