Jump to content

Xsl:attribute Name Problem


Recommended Posts

Hi, i have a problem with my xsl:attribute, i want the name of the attribute to be the name of the tag so here is what it would look like.

<xsl:attribute  name="[b]<xsl:value-of select='name()'/>[/b]">  blablabla		   	</xsl:attribute>

But of course we can't use "<" in a xsl tag wich is why xsl attribute was invented, to be able to use a select as a value but what am i supposed to do when its the name of the attribute that use a select.I thought about doing this but it doesn't work :).

<xsl:attribute><xsl:attribute name="name"><xsl:value-of select='name()'/></xsl:attribute>	 blablabla	   	</xsl:attribute>

Edited by bakunin
Link to comment
Share on other sites

You can use AVT inside the name attribute. "AVT" is basically an XPath expression in parenthesis... like so:

<xsl:attribute  name="{name()}">  blablabla			   </xsl:attribute>

Same goes for the <xsl:processing-instruction/> and <xsl:element/> elements.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...