title: Error while assigning XML attribute value in XSLT
body: <p>My input XML is as below:</p>
  
  <pre><code>&lt;MessageOutput Status="2"&gt;
      &lt;Source&gt;External&lt;/Source&gt;
      &lt;Error&gt;Server not reachable&lt;/Error&gt;
      &lt;LineNo&gt;0&lt;/LineNo&gt;
  &lt;/MessageOutput&gt;
  </code></pre>
  
  <p>My requirement is to write XSLT and check if <code>&lt;Error&gt;</code> tag has value "Server not reachable" and if yes then change the <code>Status</code> attribute value to "3".</p>
  
  <p>I wrote below code but getting error:</p>
  
  <blockquote>
    <p>"XSLT Error: Open quote is expected for attribute "{1}" associated
    with an element type "Status"."</p>
  </blockquote>
  
  <p>Please assist.</p>
  
  <pre><code>&lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
      &lt;xsl:output method="xml" encoding="ISO-8859-1"/&gt;
  
      &lt;xsl:variable name="Des" select="'Server not reachable'"/&gt;
      &lt;xsl:variable name="Err" select="MessageOutput/Error"/&gt;
  
      &lt;xsl:template match="*"&gt;
          &lt;xsl:copy&gt;
          &lt;xsl:copy-of select="@*" /&gt;
          &lt;xsl:apply-templates /&gt;
          &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="/MessageOutput"&gt;
          &lt;xsl:choose&gt;
              &lt;xsl:when test="$Des=$Err"&gt;
                  &lt;MessageOutput Status="3"&gt;
                      &lt;xsl:apply-templates/&gt;
                  &lt;/MessageOutput&gt;
               &lt;/xsl:when&gt;
               &lt;xsl:otherwise&gt;
                  &lt;MessageOutput Status=&lt;xsl:value-of select="@Status"/&gt;&gt;
                      &lt;xsl:apply-templates/&gt;
                  &lt;/MessageOutput&gt;
               &lt;/xsl:otherwise&gt;
          &lt;/xsl:choose&gt;
      &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>