Where these attributes point to?
This is an open discussion with 5 replies, filed under XSLT.
Search
The first @id points to the id
attribute's value of the entry
xml node. The second @id references the item
node's id
attribute's value.
So this value-of
selects all locations
entry
nodes with an id
value that is equal to the location/item
id
value.
The first @id:
Does it point to entry that template is matching? Or the locations/entry
? And the second one. Does it point to location child node of entry that template is matching?
If I use numeric value instead of location/item/@id
, this XPath works, but with that location/...
it doesn't work...
Edit: I need the location/item/@id
to point to entry that template is matching... The problem is, I think, to what they're relative to.
I got it working by making the second @id
variable and using it in comparison. But it would be good to know how to make this without variable.
Both @id
are in the context of /data/locations/entry
:
- The first
@id
points to/data/locations/entry
/@id
- The second
location/item/@id
points to/data/locations/entry
/location/item/@id
If you have to compare your @id
with the entry/@id
you are matching with your template, try this:
<xsl:value-of select="/data/locations/entry[@id = current()/location/item/@id]" />
current()
references your template context.
Thanks Nils, that worked.
Create an account or sign in to comment.
Hello,
if I have following XSL for example:
Where does the first @id point to? And the second one (location/...)?