Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If it is just the "(MHC)" at the end of the string you want to remove, this would do:</p> <pre><code>&lt;xsl:value-of select=" substring-before( concat(Name, '(MHC)'), '(MHC)' ) " /&gt; </code></pre> <p>If you want to replace dynamically, you could write a function like this:</p> <pre><code>&lt;xsl:template name="string-replace"&gt; &lt;xsl:param name="subject" select="''" /&gt; &lt;xsl:param name="search" select="''" /&gt; &lt;xsl:param name="replacement" select="''" /&gt; &lt;xsl:param name="global" select="false()" /&gt; &lt;xsl:choose&gt; &lt;xsl:when test="contains($subject, $search)"&gt; &lt;xsl:value-of select="substring-before($subject, $search)" /&gt; &lt;xsl:value-of select="$replacement" /&gt; &lt;xsl:variable name="rest" select="substring-after($subject, $search)" /&gt; &lt;xsl:choose&gt; &lt;xsl:when test="$global"&gt; &lt;xsl:call-template name="string-replace"&gt; &lt;xsl:with-param name="subject" select="$rest" /&gt; &lt;xsl:with-param name="search" select="$search" /&gt; &lt;xsl:with-param name="replacement" select="$replacement" /&gt; &lt;xsl:with-param name="global" select="$global" /&gt; &lt;/xsl:call-template&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:value-of select="$rest" /&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:value-of select="$subject" /&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:template&gt; </code></pre> <p>Which would be callable as:</p> <pre><code>&lt;xsl:call-template name="string-replace"&gt; &lt;xsl:with-param name="subject" select="Name" /&gt; &lt;xsl:with-param name="search" select="'(MHC)'" /&gt; &lt;xsl:with-param name="replacement" select="''" /&gt; &lt;xsl:with-param name="global" select="true()" /&gt; &lt;/xsl:call-template&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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