I want to transform a url from xslt with this format:
[sitio]/PublishingImages/[nombreimagen].jpg
to this other:
[sitio]/PublishingImages/_t/[nombreimagen]_jpg.jpg
At first try to use replace, but you can not use it in version 1.0 so try it by other means trying to use this template:
<xsl:template name=“string-replace“>
<xsl:param name=“text“ />
<xsl:param name=“pattern“ />
<xsl:param name=“replace-with“ />
<xsl:choose>
<xsl:when test=“contains($text, $pattern)“>
<xsl:value-of select=“substring-before($text, $pattern)“ />
<xsl:value-of select=“$replace-with“ />
<xsl:call-template name=“string-replace“>
<xsl:with-param name=“text“ select=“substring-after($text, $pattern)“ />
<xsl:with-param name=“pattern“ select=“$pattern“ />
<xsl:with-param name=“replace-with“ select=“$replace-with“ />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=“$text“ />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Calling after the template like this:
<xsl:variable name="primerreplace">
<xsl:call-template name="string-replace">
<xsl:with-param name="text" select="$ImageUrl" />
<xsl:with-param name="pattern" select="PublishingImages" />
<xsl:with-param name="replace-with" select="PublishingImages/_t" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="segundoreplace">
<xsl:call-template name="string-replace">
<xsl:with-param name="text" select="$primerreplace" />
<xsl:with-param name="pattern" select=".jpg" />
<xsl:with-param name="replace-with" select="_jpg.jpg" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$segundoreplace">
But when loading the Web-Part I have the following error:
XSLT compile error.
at NPS.Styler.Webparts.Styler.b__0() at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.b__2() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at NPS.Styler.Webparts.Styler.get_XSLTDoc() at NPS.Styler.Webparts.Styler.GetHtmlXMLFormat()
I'm probably doing something wrong.