Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi, maybe this is a silly question, but I need an IndexOf() function inside an XSLT and can't find it anywhere...
What puzzles me is that umbraco.library() provides a LastIndexOf() function but not IndexOf(), so I guess it should be available somehow...
Any hint?
Marco
Hi Marco,
You can use native XPath (1.0) functions to achieve an IndexOf(), like this:
<xsl:value-of select="string-length(substring-before('123456789', '4'))" />
Cheers, Lee.
Could I use this to check if a link had 'http://' in it as I currently have this problem - Client has some links with http:// some with out and there are 1000's to check manually! So would like to do a conditional check in the XSLT?
Lee,
think you can use this if you write
<xsl:if test="substring-before($url, '://') = 'http'">...</xsl:if>
Cheers,
/Dirk
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
IndexOf() in XSLT
Hi, maybe this is a silly question, but I need an IndexOf() function inside an XSLT and can't find it anywhere...
What puzzles me is that umbraco.library() provides a LastIndexOf() function but not IndexOf(), so I guess it should be available somehow...
Any hint?
Marco
Hi Marco,
You can use native XPath (1.0) functions to achieve an IndexOf(), like this:
Cheers, Lee.
Could I use this to check if a link had 'http://' in it as I currently have this problem - Client has some links with http:// some with out and there are 1000's to check manually! So would like to do a conditional check in the XSLT?
Lee,
think you can use this if you write
Cheers,
/Dirk
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.