Note that there are some explanatory texts on larger screens.

plurals
  1. POis there a way to emulate correctly replace function on XPATH 1?
    primarykey
    data
    text
    <p>I have this function which tries to replace dots and/or - with _</p> <p>I'm limited to use xpath 1 so replace function is NOT an option. The template works not to much fine because if I use something like this:</p> <p>FOO-BAR.THING-MADRID.html</p> <p>it gives me out on screen this thing:</p> <p>FOO-BAR.THING-MADRID.html</p> <p>the middle dot is not replaced.</p> <p>Someone could help me?</p> <pre><code> &lt;xsl:template name="replaceDots"&gt; &lt;xsl:param name="outputString"/&gt; &lt;xsl:variable name="target"&gt;.&lt;/xsl:variable&gt; &lt;xsl:variable name="source"&gt;-&lt;/xsl:variable&gt; &lt;xsl:variable name="replacement"&gt;_&lt;/xsl:variable&gt; &lt;xsl:choose&gt; &lt;xsl:when test="contains($outputString,$source)"&gt; &lt;xsl:value-of select="concat(substring-before($outputString,$source),$replacement)" disable-output-escaping="yes"/&gt; &lt;xsl:call-template name="replaceDots"&gt; &lt;xsl:with-param name="outputString" select="substring-after($outputString,$source)"/&gt; &lt;/xsl:call-template&gt; &lt;/xsl:when&gt; &lt;xsl:when test="contains($outputString,$target)"&gt; &lt;xsl:value-of select="concat(substring-before($outputString,$target),$replacement)" disable-output-escaping="yes"/&gt; &lt;xsl:call-template name="replaceDots"&gt; &lt;xsl:with-param name="outputString" select="substring-after($outputString,$target)"/&gt; &lt;/xsl:call-template&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:value-of select="$outputString" disable-output-escaping="yes"/&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:template&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload