Setting the href in XSLT & XML

I spent ages trying to figure out how to output the xml for a link’s href (i.e. <a href=”">) by trying to escape the double quotes of the href. For example:

<a href=\”<xsl:value-of select=”@url”/>\”><xsl:value-of select=”@url”/></a>

But that didn’t work.

Ended up to be a simple solution as it always is.

Assuming we have an xml file that has a node with the attribute “url”:

<a><xsl:attribute name=”href”><xsl:value-of select=”@url”/></xsl:attribute>My Link</a>

Leave a Reply