Subject: Re: Identifying two tags that share some attribute names and values
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 6 May 2002 09:17:48 +0100
|
Hi Joerg,
> And my comments/questions to Jeni's stylesheet:
>
> >><xsl:template match="a">
> >> <xsl:variable name="a" select="." />
> >> <xsl:for-each select="$file2/b[@* = $a/@*]">
>
> I thought of a filter too, but I didn't find a sensible one. The
> above one isn't completely logical to me. What exactly does it mean?
> Maybe "all <b>s, whose all attributes are in <a> and don't have a
> different value"?
It means "all <b>s that have an attribute that has the same value as
at least one of <a>'s attributes". It's not a very strong filter, but
it means that if <a> is:
<a x="1" y="2" z="3" />
then you won't process <b> if it's:
<b x="4" y="5" />
but would process <b> if it was:
<b a="2" />
(and then discard it in the xsl:for-each).
Actually, given that the attributes on a have to be a subset of the
attributes on b (I think that's the way round it is now), then a
stronger filter would count the attributes as well:
$file2/b[@* = $a/@* and
count(@*) >= count($b/@*)]
There's a balance here between the amount of work that goes on in the
filter, and the amount of work that goes on within the xsl:for-each;
Zack should really test where the balance is to work out what filter
to use.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- Re: Identifying two tags that share some attribute names and values, (continued)
- Jeni Tennison - Sun, 5 May 2002 10:27:27 -0400 (EDT)
- Zack Brown - Sun, 5 May 2002 13:02:34 -0400 (EDT)
- Joerg Heinicke - Sun, 5 May 2002 14:09:54 -0400 (EDT)
- Zack Brown - Sun, 5 May 2002 15:14:21 -0400 (EDT)
- Jeni Tennison - Tue, 7 May 2002 12:53:13 -0400 (EDT) <=
- Zack Brown - Mon, 6 May 2002 00:57:23 -0400 (EDT)
- Joerg Heinicke - Mon, 6 May 2002 09:06:52 -0400 (EDT)
- Zack Brown - Mon, 6 May 2002 23:38:36 -0400 (EDT)
- Joerg Heinicke - Tue, 7 May 2002 06:21:48 -0400 (EDT)
|
|