|
Subject: RE: [xsl] filtering elements by single xpath From: "Tomas Kolaci" <kolaci@xxxxxxx> Date: Wed, 5 Apr 2006 17:59:14 +0200 |
> > I'm trying to fill variable filtered-items with elements item with
> "allowed"
> > name (= there is an element /root/item-filter/allow-items with attribute
> > @with-name containing same value as item's @name)*, but I don't know how
> to
> > reach current item on ??? position in my select (function current()
> points
> > to current body element).
>
> use current()/item-filter/allow-items/@with-name
Thanks andrew, but I don't know how I could use it (plus I think you have
missed that item-filter is not child of body but it's brother), could you
please write complete select for me?
> alternatively create a key
>
> <xsl:key name="allowed-items" match="allow-items" use="@with-name"/>
>
> and then check if the node exists in the key with that value
>
> select="item[key('allowed-items', @name)]"
Great, this works, thanks!
But xsl:key must be top-element, what if I had following structure:
<root>
<body>
<item pos="1" name="n1"/>
<item pos="2" name="n2"/>
<item pos="3" name="n2"/>
<item pos="4" name="n3"/>
<item pos="5" name="n4"/>
<item-filter>
<allow-items with-name="n2"/>
<allow-items with-name="n4"/>
</item-filter>
</body>
<body>
<item pos="1" name="n2"/>
<item pos="2" name="n3"/>
<item pos="3" name="n5"/>
<item-filter>
<allow-items with-name="n3"/>
</item-filter>
</body>
</root>
and wanted to filter items of each body element by it's own item-filter?
> cheers
> andrew
Br, Tomas
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] filtering elements by sin, andrew welch | Thread | Re: [xsl] filtering elements by sin, David Carlisle |
| Re: [xsl] Divide to pages, Paull | Date | Re: [xsl] filtering elements by sin, David Carlisle |
| Month |