/ Published in: XSLT
For foo node, if the node includes URL, link it.
e.g.
before: <foo>bar http://example.com</foo>
after: bar <a href="http://example.com">http://example.com</a>
Expand |
Embed | Plain Text
<xsl:template match="foo"> <xsl:choose> <xsl:when test="contains(., 'http://')"> <xsl:value-of select="substring-before(., 'http://')"/> <a><xsl:attribute name="href">http://<xsl:value-of select="substring-after(., 'http://')"/></xsl:attribute>http://<xsl:value-of select="substring-after(., 'http://')"/></a> </xsl:when> <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise> </xsl:choose> </xsl:template>
You need to login to post a comment.
