Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since you haven't provided us much info, this is the best answer I can give.</p> <p>As shown in <a href="https://stackoverflow.com/a/8835958/327179">this answer</a>:</p> <blockquote> <p>A more general XPath 1.0 expression that produces the string $s1 if $val is "x" and produces the string $s2 if $val is "y" :</p> </blockquote> <pre><code>concat(substring($s1, 1 div ($val = "x")), substring($s2, 1 div ($val = "y")) ) </code></pre> <p>If I understand your question correctly, this principle can be used to generate the expected answer. To see this, look at the following sample:</p> <p><strong>Assumptions:</strong></p> <ul> <li>A value of <code>"yes"</code> should output the character <code>"a"</code> </li> <li>A value of <code>""</code> should output the character <code>"b"</code> </li> </ul> <p><strong>When this XSLT (which uses the aforementioned XPath):</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; &lt;xsl:output omit-xml-declaration="yes" indent="yes" method="text"/&gt; &lt;xsl:strip-space elements="*"/&gt; &lt;xsl:template match="e"&gt; &lt;xsl:text&gt;The value is: &lt;/xsl:text&gt; &lt;xsl:value-of select="concat(substring('a', 1 div (@fldNm = 'yes')), substring('b', 1 div (@fldNm = '')) )"/&gt; &lt;xsl:text/&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p><strong>...is applied to the following sample XML:</strong></p> <pre><code>&lt;t&gt; &lt;e fldNm="yes"/&gt; &lt;e fldNm=""/&gt; &lt;/t&gt; </code></pre> <p><strong>...the wanted result is produced:</strong></p> <pre><code>The value is: a The value is: b </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. VO
      singulars
      1. This table or related slice is empty.
    2. 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