You could create an Xslt Extension for this. Search for XSLT Extension on the forum or watch this video, the first free minutes are free. With an Xslt Extension you can create a method that contains the functionality you want. I don't have Visual Studio on this machine, I can create a example tomorrow if you prefer that.
But now would have gone your route if the above didn't work out. And what's funny, now that you bring it up, I had completely forgotten this option! Oh well.
Equivalent XSLT 2.0 ends-with function?
Anyone know of an equivalent ends-with function? As can't use XSLT 2.0's version.
Will a sub template help? See codes below.
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output method = "text" />
<xsl:template match = "/" >
<xsl:call-template name = "print" >
<xsl:with-param name = "A" >11</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name = "print" >
<xsl:param name = "A" />
<xsl:value-of select = "$A" />
</xsl:template>
</xsl:stylesheet>
You can use c# end with function in your xml.
Take look here http://our.umbraco.org/wiki/reference/xslt/extend-your-xslt-with-custom-functions
Petr
No, looking more along the lines of:
<xsl:choose>
<xsl:when test="fn:ends-with(u:loc, 'something')">
...do something.
</xsl:when>
</xsl:choose>
Found an old forum link at http://forum.umbraco.org/yaf_postst2772_endswith-and-lowercase-xslt-functions.aspx but the answer is no longer available (and the exslt library doesn't have an equivalent ends-with function).
Hi,
You could create an Xslt Extension for this. Search for XSLT Extension on the forum or watch this video, the first free minutes are free. With an Xslt Extension you can create a method that contains the functionality you want. I don't have Visual Studio on this machine, I can create a example tomorrow if you prefer that.
Cheers,
Richard
Petr & Richard: thanks!
I ended up just doing something like:
<xsl:choose>
<xsl:when test="umbraco.library:LastIndexOf(u:loc, 'sometext') = -1">
....
But now would have gone your route if the above didn't work out. And what's funny, now that you bring it up, I had completely forgotten this option! Oh well.
is working on a reply...