If you're using XSLT, I'd recommend setting up a key:
<xsl:key name="tents" match="base/tent" use="@key" />
You can then get the <tent>
within <base>
with a particular key
using
key('tents', $id)
Then you can do
key('tents', /root/bucket/tent/@key)/@color
or, if $bucket
is a particular <bucket>
element,
key('tents', $bucket/tent/@key)/@color
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…