This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Re: topological sort


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]