« XSLT to replace substring | Home | XSLT to strip HTML »

XSLT to remove the first word of the string

<!--remove_starting_the
removes the first "The" from an string
-->

<xsl:template name="remove_starting_the">
<xsl:param name="value"/>
<xsl:choose>
<xsl:when test="contains($value,'The ')"><xsl:value-of select="substring-after($value,'The ')"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
</xsl:choose>
</xsl:template>

Topics: XSLT | Submitter: admin

Comments

You must be logged in to post a comment.

Keep on coding