Note that there are some explanatory texts on larger screens.

plurals
  1. POConditionally Display 1 of 2 char.s based on xsl:value-of
    text
    copied!<p>I have a value coming from SharePoint as <code>&lt;xsl:value-of select="@fldNm" /&gt;</code></p> <p>This will have 1 of 2 possible values: an empty string, or 'yes.' This is within <code>&lt;xsl:template name="dvt_1.rowedit"&gt;</code> of a SharePoint display form.</p> <p>If the value is an empty string, I want to dislpay one character, but if it is 'yes' I want to display a different character.</p> <p>I am putting a tag inline with the HTML, and using <code>document.write()</code>. But I am having no luck making the actions respond to the value of fldNm.</p> <p>I have found a lot of examples, but they are so different than what I am trying to do that I can't make sense of them.</p> <p>This is the situation:</p> <p>When you create a SharePoint Custom List, 3 .aspx pages are created for you: newForm, editForm and dispForm.</p> <p>These .aspx pages are loaded with all kinds of xsl and xslt functionality. Several xsl templates are created, one of which holds the HTML that will show when the .aspx is used. That template is named by SharePoint as 'dvt_1.' That template is then called in a <code>&lt;xsl:for-each select="$Rows"&gt;</code> xsl structure.</p> <p>Within that called template on the dispForm page, each datum is shown through the use of</p> <pre><code> &lt;td&gt; &lt;div&gt; &lt;xsl:value-of select="@fieldName" /&gt; &lt;/div&gt; &lt;/td&gt; </code></pre> <p>When the page is rendered, that 'value-of' tag is replaced with the contents of whatever field was psecified (of course).</p> <p>In my case, because of the Design Requirements document, the field I am asking about will contain 'yes' or ''.</p> <p>If it is yes, I want to use a put a single character there indicating the 'yes.' Otherwise I want to put a <i>different</i> character there, indicating 'not yes.'</p> <p>I cannot figure out how to get the rendered value into a choice-making construct.</p> <p>I tried something like</p> <pre><code> &lt;td&gt; The answer is: &lt;script&gt; if (&lt;xsl:value-of select="@fieldName" /&gt; == 'yes') { document.write('A'); } else { document.write('B'); } &lt;/script&gt; &lt;/td&gt; </code></pre> <p>but the xsl tag was not recognized as such.</p> <p>I am very new to xsl, and though I am starting to see how the syntax accomplishes things, it is still very mysterious to me.</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