title: To compare two elements(string type) in XSLT?
body: <p>i am new to XSLT ,can any one please suggest to me how to compare two elements coming from xml as string their values are:</p>
  
  <pre><code>&lt;OU_NAME&gt;Vision Operations&lt;/OU_NAME&gt; --XML code
  &lt;OU_ADDR1&gt;90 Fifth Avenue&lt;/OU_ADDR1&gt; --XML code
  
  &lt;xsl:choose&gt;
      &lt;xsl:when test="OU_NAME='OU_ADDR1'"&gt; --comparing two elements coming from XML
          &lt;!--remove if  adrees already contain  operating unit name
              &lt;xsl:value-of select="OU_NAME"/&gt; &lt;fo:block/&gt;--&gt;
          &lt;xsl:if test="OU_ADDR1 !='' "&gt;
              &lt;xsl:value-of select="OU_ADDR1"/&gt;
              &lt;fo:block/&gt;
          &lt;/xsl:if&gt;
          &lt;xsl:if test="LE_ADDR2 !='' "&gt;
              &lt;xsl:value-of select="OU_ADDR2"/&gt;
              &lt;fo:block/&gt;
          &lt;/xsl:if&gt;
          &lt;xsl:if test="LE_ADDR3 !='' "&gt;
              &lt;xsl:value-of select="OU_ADDR3"/&gt;
              &lt;fo:block/&gt;
          &lt;/xsl:if&gt;
          &lt;xsl:if test="OU_TOWN_CITY !=''"&gt;
              &lt;xsl:value-of select="OU_TOWN_CITY"/&gt;,
              &lt;fo:leader leader-pattern="space" leader-length="2.0pt"/&gt;
          &lt;/xsl:if&gt;
          &lt;xsl:value-of select="OU_REGION2"/&gt;
          &lt;fo:leader leader-pattern="space" leader-length="3.0pt"/&gt;
          &lt;xsl:value-of select="OU_POSTALCODE"/&gt;
          &lt;fo:block/&gt;
          &lt;xsl:value-of select="OU_COUNTRY"/&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
          &lt;xsl:value-of select="OU_NAME"/&gt;
          &lt;fo:block/&gt;
          &lt;xsl:if test="OU_ADDR1 !='' "&gt;
              &lt;xsl:value-of select="OU_ADDR1"/&gt;
              &lt;fo:block/&gt;
          &lt;/xsl:if&gt;
          &lt;xsl:if test="LE_ADDR2 !='' "&gt;
              &lt;xsl:value-of select="OU_ADDR2"/&gt;
              &lt;fo:block/&gt;
          &lt;/xsl:if&gt;
          &lt;xsl:if test="LE_ADDR3 !='' "&gt;
              &lt;xsl:value-of select="OU_ADDR3"/&gt;
              &lt;fo:block/&gt;
          &lt;/xsl:if&gt;
          &lt;xsl:if test="OU_TOWN_CITY !=''"&gt;
              &lt;xsl:value-of select="OU_TOWN_CITY"/&gt;,
              &lt;fo:leader leader-pattern="space" leader-length="2.0pt"/&gt;
          &lt;/xsl:if&gt;
          &lt;xsl:value-of select="OU_REGION2"/&gt;
          &lt;fo:leader leader-pattern="space" leader-length="3.0pt"/&gt;
          &lt;xsl:value-of select="OU_POSTALCODE"/&gt;
          &lt;fo:block/&gt;
          &lt;xsl:value-of select="OU_COUNTRY"/&gt;
      &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  </code></pre>