title: assigning a variable in xslt
body: <p>I have the following xsl with me</p>
  
  <pre><code>&lt;Root&gt;
      &lt;child&gt;
         &lt;Book name="Title" value="hailey" /&gt;
         &lt;Book name="Title" value="After death" /&gt;
         &lt;Book name="Price" value="100" /&gt;
      &lt;/child&gt;
      &lt;child&gt;
         &lt;Book name="Title" value="After death" /&gt;
         &lt;Book name="genre" value="fiction" /&gt;
      &lt;/child&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>I want to iterate through the "child" node and if "Title" is appearing (atleast once), i want a variable to be set. I am using the following code in xslt</p>
  
  <pre><code>&lt;xsl:variable name="flag"&gt;
          &lt;xsl:for-each select="/Root/Child" &gt;
              &lt;xsl:for-each select="./Book" &gt;
                     &lt;xsl:if test="./@name = 'Title'"&gt;
                      &lt;xsl:value-of select="'true'"/&gt;                     
                  &lt;/xsl:if&gt;
              &lt;/xsl:for-each&gt;
          &lt;/xsl:for-each&gt;
  
  
  &lt;/xsl:variable&gt;
  </code></pre>
  
  <p>The problem is i the value if variable "flag" is set as "truetruetrue", whereas i want it to be just "true". Any help is appreciated</p>