[xsl] Getting the value of previous Sibling

Subject: [xsl] Getting the value of previous Sibling
From: "Animesh Sharma" <asharma@xxxxxxxxxxxxxxxx>
Date: Wed, 14 Jul 2004 16:19:12 +0530
Hi, 

I want to insert a value of previous sibling in the next. 
Basically there are two consecutive <input> tag. I want to insert the
"name", "value" attribute of first input tag in second one.

I tried with following template:

<xsl:template match="//input">
<xsl:if test="@type='radio'">
<xsl:copy>
     <xsl:variable name="name"><xsl:value-of
select="preceding-sibling::element[position()=1]/@name"
/></xsl:variable>
     <xsl:variable name="value"><xsl:value-of
select="preceding-sibling::element[position()=1]/@value"
/></xsl:variable>    	
	<xsl:apply-templates select="@*"/>
    <xsl:attribute name="onclick">$name,$value</xsl:attribute>
   <xsl:apply-templates select="*|text()"/>

</xsl:copy>
</xsl:template>

Can somebody help.

Thanks,
Animesh

Current Thread