reverse navigation through node-sets and xsl:copy-of vs. xsl:value-of

especially when using ancestor-or-self:: or ancestor::, reverse navigation
through a node-set should be possible.

example:
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- File: '_/langcodes.xml' -->
<langcodes>
	<img width="50" height="30">test1</img>
	<language code="de">
		<img src="/gfx/de.gif">test2</img>
		<name xml:lang="de">Deutsch</name>
		<name xml:lang="en">German</name>
	</language>
	<language code="en">
		<img src="/gfx/en.gif" width="60">test3</img>
		<name xml:lang="de">Englisch</name>
		<name xml:lang="en">English</name>
	</language>
</langcodes>

I'd like to retreive the image width from an image for a certain language
code based upon upwards navigation in the node-set tree of (let
@hreflang="en")
document('_/langcodes.xml')//language[@code=current()/@hreflang]/ancestor-or
-self::*/img.

Since it is an Attribute I have to create, I can use a documented behaviour
of XSLT: "Newer" Attributes override "Older" Attributes, so

<xsl:copy-of
select="document('_/langcodes.xml')//language[@code=current()/@hreflang]/anc
estor-or-self::*/img[@width]/@width"/>
creates an Attribute 'width="60"', obviously chosen from the nearest node
(inobiously copying all width-attributes in document order, where the last
overwrites the previous ones),
while
<xsl:value-of
select="document('_/langcodes.xml')//language[@code=current()/@hreflang]/anc
estor-or-self::*/img[@width]/@width"/>
returns "50", oviously chosen from the first matching node in document
order.

I was unable to find something in XSLT and / or XPath solving this problem
in a general, attribute-independant manner. Did I miss it on my search?

Greetings
--
Christian Wolfgang Hujer
IT-Consulting, Qualifying and Individual Solutions
Voc: +49 (089) 27 37 04 37
Fax: +49 (089) 27 37 04 39
Cel: +49 (0179) 29 26 58 0

Received on Sunday, 24 September 2000 09:42:57 UTC