/ Published in: XSLT
For *foo* node, if the node includes URL, link it.
e.g.
*before*: <code><foo>bar http://example.com</foo></code>
*after*: <code>bar <a href="http://example.com">http://example.com</a></code>
e.g.
*before*: <code><foo>bar http://example.com</foo></code>
*after*: <code>bar <a href="http://example.com">http://example.com</a></code>
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<xsl:template match="foo"> <xsl:choose> <xsl:when test="contains(., 'http://')"> <xsl:value-of select="substring-before(., 'http://')"/> </xsl:when> <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise> </xsl:choose> </xsl:template>