A
adam bob
Hello, I'm struggling with an image mechanism I'm trying to build
which basically manipulates a URL string.
This is the sort URL that is gained from an InfoPath form
https://xxx-xxx.xxx.xxx.com/content/00000xxx/xxx/xxx.jpg
However I need to manipulate it so it also displays like this;
https://xxx-xxx.xxx.xxx.com/content/00000xxx/xxx/_t/xxx_JPG.jpg
As you can see it adds an '_t' and a '_JPG' into the URL string.
This is where I am up to now, which from what I can see adds a '_' in
front of the URL.
______________________________________________________________________________________
<xslutput method="html"/>
<xsl:template match="/">
<xsl:variable name="url" select="my:myFields/my:URL"/>
<xsl:call-template name="truncate">
<xsl:with-param name="string" select="$url"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="truncate">
<xslaram name="string"/>
<xslaram name="counter" select="3"/>
<xsl:if test="$string!='' and $counter!=0">
<xsl:text>_</xsl:text>
<xsl:choose>
<xsl:when test="contains($string, ' ')">
<xsl:value-of select="substring-before($string, '/')"/>
<xsl:call-template name="truncate">
<xsl:with-param name="string" select="substring-
after($string, '/')"/>
<xsl:with-param name="counter" select="$counter - 1"/>
</xsl:call-template>
</xsl:when>
<xsltherwise>
<xsl:value-of select="$string"/>
</xsltherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
__________________________________________________________________________________________
Please advise or show me some useful code.
Many thanks in advance
which basically manipulates a URL string.
This is the sort URL that is gained from an InfoPath form
https://xxx-xxx.xxx.xxx.com/content/00000xxx/xxx/xxx.jpg
However I need to manipulate it so it also displays like this;
https://xxx-xxx.xxx.xxx.com/content/00000xxx/xxx/_t/xxx_JPG.jpg
As you can see it adds an '_t' and a '_JPG' into the URL string.
This is where I am up to now, which from what I can see adds a '_' in
front of the URL.
______________________________________________________________________________________
<xslutput method="html"/>
<xsl:template match="/">
<xsl:variable name="url" select="my:myFields/my:URL"/>
<xsl:call-template name="truncate">
<xsl:with-param name="string" select="$url"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="truncate">
<xslaram name="string"/>
<xslaram name="counter" select="3"/>
<xsl:if test="$string!='' and $counter!=0">
<xsl:text>_</xsl:text>
<xsl:choose>
<xsl:when test="contains($string, ' ')">
<xsl:value-of select="substring-before($string, '/')"/>
<xsl:call-template name="truncate">
<xsl:with-param name="string" select="substring-
after($string, '/')"/>
<xsl:with-param name="counter" select="$counter - 1"/>
</xsl:call-template>
</xsl:when>
<xsltherwise>
<xsl:value-of select="$string"/>
</xsltherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
__________________________________________________________________________________________
Please advise or show me some useful code.
Many thanks in advance