5 users online. Create an account or sign in to join them.Users
substring functions question
This is an open discussion with 4 replies, filed under General.
Search
You could try the EXSLT str:tokenize function to split up the string with / as delimiter.
From the top of my head, without any testing:
<xsl:template name="basename">
<xsl:param name="text" />
<xsl:choose>
<xsl:when test="contains($text,'/')">
<xsl:call-template name="basename">
<xsl:with-param name="text" select="substring-after($text,'/')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
nice one :-)
Cool!
I forgot to mention though, can this be done with one line of xpath? I need it for a Reflection Field. :o)
Create an account or sign in to comment.
I have a string:
that I need to get the filename (minus the extension) from. I know how to get the string minus the extension:
substring-before('stringhere', '.j')but I don’t know how to
substring-afterthe last /Any XSLT Ninjas out there?