Vishwamohan

Welcome to Vishwa's blog - Technology, Spirituality and More...

HREF in XSLT

You may come across a situation where you might have to embed a static or Dynamic URL with a query string, it becomes tricky, but here is the simple solution

Static URL with Dynamic Querystring

<xsl:if test="(string-length(/Response/ID) > 0)"> 
    <a target="_new"><xsl:attribute name="href">https://www.domain.com/ShowItem.aspx?ID=<xsl:value-of select="/Response/ID"/></xsl:attribute>Show Item</a> 
</xsl:if>

Dynamic URL

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

Happy Coding

Loading