This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re: topological sort
- To: Joerg Pietschmann <joerg dot pietschmann at zkb dot ch>
- Subject: Re: [xsl] Re: topological sort
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Fri, 5 Jan 2001 10:35:40 +0000
- CC: XSL List <xsl-list at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <3A558A30.FA640420@zkb.ch>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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