How to copy parts of an var into another ?

Subject: How to copy parts of an var into another ?
From: Jan Kohnert <J.Kohnert@xxxxxxxxxxx>
Date: Fri, 18 Jun 2004 11:18:24 +0200
Hello List,

I have a var:

<xsl:variable name="foo">
	<item name="a item">
		<value>1</value>
	</item>
	<item name="another item">
		<value>2</value>
	</item>
</xsl:variable>

at one point in the stylesheet, I want so select one part of the var. That
is Necessary because in reality the var is MUCH bigger, and I want to avoid
using Xpathes from here to moscow each time...

I tried:

<xsl:variable name="partoffoo">
	<xsl:value-of select="$foo/item[@name = 'a item']"/>
</xsl:variable>

And tried to get the value by using:

<xsl:value-of select="$partoffoo/item/value"/>

to get the item of foo that has the name attribute "a item".
But it did not work. 

Important is, that I also want to get every node that is child of the
selected <item>.

I tried copy and copy-of, but only got the var copied into the output
document.

Is there a way to solve this problem?

Thanks!

Current Thread