Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to output/display modified text value using xslt
    text
    copied!<p>I need to display modified texts using xlst.</p> <p>part of code.</p> <p><strong>Case1:</strong></p> <pre><code>&lt;tu&gt; &lt;tuv xml:lang="en-us" changedate="20110216T070945Z"&gt; &lt;seg&gt; &lt;ut&gt;# 302 &lt;/ut&gt;The gradient of the objective function cannot be &lt;ph x="1" type="inldel"&gt;! &lt;/ph&gt;computed at the starting point&lt;/seg&gt; &lt;/tuv&gt; &lt;/tu&gt; </code></pre> <p><strong>Case2</strong></p> <pre><code>&lt;tuv xml:lang="zh-cn" changedate="20110216T070945Z"&gt; &lt;seg&gt; &lt;ut&gt;# 302 &lt;/ut&gt;The gradient of the; objective function cannot be &lt;ph x="2" type="inldel"&gt;! &lt;/ph&gt;computed at the starting point&lt;/seg&gt; &lt;/tuv&gt; </code></pre> <p><strong>Requests:</strong> 1. when there are linebreaks\returns in text field, replace the returns with spaces and display\output the new string. In case1, The gradient of the objective function cannot be computed at the starting point.</p> <ol> <li>when there are semi-colons, replace them with colons. In case2, The gradient of the: objective function cannot be computed at the starting point.</li> </ol> <p><strong>My current solution for case2:</strong></p> <pre><code>*&lt;xsl:if test="tuv[@xml:lang='en-us']/seg/text()"&gt; &lt;xsl:choose&gt; &lt;xsl:when test="contains(tuv[@xml:lang='en-us']/seg/text(),';')"&gt; &lt;xsl:text&gt;translate(tuv[tuv[@xml:lang='en-us']/seg/text(),';',':')&lt;/xsl:text&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:apply-templates select="tuv[@xml:lang='en-us']/seg/text()"/&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:if&gt;* </code></pre> <p>But the output doesn't show the returned vaule of Translate function, instead, it display "translate(tuv....)".</p> <p>I'm new to xslt and suppose this is not a difficult question for experts:) Can anybody help? thanks</p>
 

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