This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gettin value of a node


Hi folks,

I have an xml like this which
<a>
<b1>
<x>1</x>
<y>hi</y>
<z>hello</z>
</b1>
<b2>
<x>1</x>
<y>hi</y>
<z>hello</z>
</b2>
<b3>
<x>2</x>
<y>u</y>
<z>king</z>
</b3>
<b4>
<x>3</x>
<y>hi</y>
<z>queen</z>
</b4>
</a>

when i transform i have to get a result like this

<group>
<b4>
<x>1</x>
<y>hi</y>
<z>hello</z>
</b4>
<b4>
<x>2</x>
<y>u</y>
<z>king</z>
</b4>
<b4>
<x>3</x>
<y>hi</y>
<z>queen</z>
</b4>
</group>

for this i used an xpath like this
								<xsl:for-each select="//x[not(. = following::x)]">
<xsl:variable name="pos">
   <xsl:value-of select="."/>
</xsl:variable>

which gets me all the unique x values
now when i write a statement like the below
								<xsl:value-of select="//y[//x=$pos]"/>

this statement does not work for me it gives me the same value for all the 
y's like it gives me
<group>
<b4>
<x>1</x>
<y>hi</y>
<z>hello</z>
</b4>
<b4>
<x>2</x>
<y>hi</y>
<z>king</z>
</b4>
<b4>
<x>3</x>
<y>hi</y>
<z>queen</z>
</b4>
</group>

can anyone tell me what is wrong please...

Thanx
Spencer




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]