Return to Snippet

Revision: 17270
at August 29, 2009 20:12 by mustam


Initial Code
<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>

Initial URL


Initial Description
For *foo* node, if the node includes URL, link it.

e.g.

*before*: <code>&lt;foo&gt;bar http://example.com&lt;/foo&gt;</code>  
*after*: <code>bar &lt;a href="http://example.com"&gt;http://example.com&lt;/a&gt;</code>

Initial Title
Link URL address of the text's tail in text nodes of xml file

Initial Tags


Initial Language
XSLT