title: XSLT Choose - testing attribute value
body: <p>I'm strugling with a Choose statement and the corresponding Test-Clause.</p>
  
  <p>If have the following XML (just an extract) which represents an datamodel exportet from Enterprise Architect as XMI:</p>
  
  <pre><code>&lt;xmi:XMI xmi:version="2.1" xmlns:uml="http://schema.omg.org/spec/UML/2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:thecustomprofile="http://www.sparxsystems.com/profiles/thecustomprofile/1.0" xmlns:EAUML="http://www.sparxsystems.com/profiles/EAUML/1.0"&gt;       &lt;xmi:Documentation exporter="Enterprise Architect" exporterVersion="6.5"/&gt;      &lt;uml:Model xmi:type="uml:Model" name="EA_Model" visibility="public"&gt;            &lt;packagedElement xmi:type="uml:Package" xmi:id="EAPK_F3388CFE_57A7_4d84_8866_3FB3AADE565A" name="Data Model - SQLServer2012" visibility="public"&gt;
                  &lt;packagedElement xmi:type="uml:Artifact" xmi:id="EAID_B62341D4_41C6_4c83_A60A_4CA65C2E185E" name="Database SQLServer2012" visibility="public"/&gt;
                  &lt;packagedElement xmi:type="uml:Package" xmi:id="EAPK_BA7676C5_40BC_4bd9_A0F5_F6B15E534E8E" name="Logical Model" visibility="public"&gt;
                      &lt;packagedElement xmi:type="uml:Class" xmi:id="EAID_2DC36189_CCFB_40bf_A1CB_CD4FB08FE8B5" name="AnamneseStatus" visibility="public"&gt;
                          &lt;ownedAttribute xmi:type="uml:Property" xmi:id="EAID_9BBF5184_37F8_4729_9DC1_7ED3B4D8FC98" name="RCHIUNET05_ContextKey" visibility="public" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="true" isUnique="false" isDerivedUnion="false"&gt;
                              &lt;lowerValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI000001_37F8_4729_9DC1_7ED3B4D8FC98" value="1"/&gt;
                              &lt;upperValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI000002_37F8_4729_9DC1_7ED3B4D8FC98" value="1"/&gt;
                              &lt;type xmi:idref="EASQL_Server_2012_nvarchar"/&gt;
                          &lt;/ownedAttribute&gt;
                          &lt;ownedAttribute xmi:type="uml:Property" xmi:id="EAID_BC1F93D0_A7F4_474c_A27E_26D3ABCCFB7B" name="MRNCmpdId" visibility="public" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="true" isDerivedUnion="false"&gt;
                              &lt;lowerValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI000003_A7F4_474c_A27E_26D3ABCCFB7B" value="1"/&gt;
                              &lt;upperValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI000004_A7F4_474c_A27E_26D3ABCCFB7B" value="1"/&gt;
                              &lt;type xmi:idref="EASQL_Server_2012_nvarchar"/&gt;
                          &lt;/ownedAttribute&gt;
  ..........
  </code></pre>
  
  <p>So with my XSL I will loop throug the relevant nodes and extract the tablenames and attributes. this works without problem. Now I need to translate the EA datatype into another datatype definition.</p>
  
  <p>Lets say: EASQL_Server_2012_nvarchar needs to become System.String</p>
  
  <p>The XSL doing this looks like this (since there are other datatypes the Choose Statement will be longer than showed here):</p>
  
  <pre><code>    &lt;xsl:for-each select="ownedAttribute[@xmi:type='uml:Property']"&gt;
      &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;&lt;/xsl:text&gt;
      &lt;xsl:value-of select="'Element Name=&amp;quot;'"/&gt;
      &lt;xsl:value-of select="@name"/&gt;
      &lt;xsl:value-of select="'&amp;quot; '"/&gt;
  
      &lt;xsl:choose&gt;
        &lt;xsl:when test="@xmi:idref = 'EASQL_Server_2012_nvarchar'"&gt;
          &lt;xsl:value-of select="'Type=&amp;quot;'"/&gt;
          &lt;xsl:value-of select="'System.String'"/&gt;
          &lt;xsl:value-of select="'&amp;quot; '"/&gt;
          &lt;xsl:value-of select="'MaxLength=&amp;quot;'"/&gt;
          &lt;xsl:value-of select="'400'"/&gt;
          &lt;xsl:value-of select="'&amp;quot; '"/&gt;
        &lt;/xsl:when&gt;
        &lt;xsl:when test="@xmi:idref = 'EASQL_Server_2012_int'"&gt;
          &lt;xsl:value-of select="'Type=&amp;quot;'"/&gt;
          &lt;xsl:value-of select="'System.Int32'"/&gt;
          &lt;xsl:value-of select="'&amp;quot; '"/&gt;
        &lt;/xsl:when&gt;
  ......
  </code></pre>
  
  <p>Now my problem is, that it will not hit the test conditions and always run into the "otherwise" statement.</p>
  
  <p>Does somebody see why the test condition is not working?</p>
  
  <p>Thank you for any help on this.</p>
  
  <p>Cheers
  Sandro</p>