How to display value in xslt variable -


how can store element attributes xslt variable , display element through variable ?

example:

<element name="value1" attribute2="value2" /> 

i tried this:

<xsl:variable name="myvariable" select="../element[@name=value1]" /> 

and display:

<xsl:template match="..">     <xsl:value-of select="$myvariable" /> </xsl:template> 

and want display element given name attributes.

thanks

krp0

you have been missing qoutes around value1. access value of variable use xsl:copy-of copies element attributes.

<xsl:template match="/">   <xsl:variable name="myvariable" select="element[@name='value1']" />   <xsl:copy-of select="$myvariable" /> </xsl:template> 

Comments