title: How to select the value from an attribute that has a colon in xslt?
body: <p>I am working with xslt to handle the results that are returned from a web service. I first need to determine which web service the results are for.  I know that the tag platformCore:record has the attribute "xsi:type="listRel:Contact or "xsi:type="listEmp:Employee".  I am trying to select the value that the attribute is storing, but the colon seems to be causing some issues when I attempt to select the value.  </p>
  
  <p>Here is what I tried, but fails to work.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
  &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" /&gt;
  &lt;xsl:template match="/"&gt;
  
  &lt;xsl:variable name="Type"&gt;&lt;xsl:value-of select="//*[local-name()='searchResponse']//*[local-name()='searchResult']//*[local-name()='recordList']//*[local-name()='record']@xsi:type"/&gt;&lt;/xsl:variable&gt;
  
  &lt;root&gt;
  &lt;test&gt;&lt;xsl:value-of select="$Type"/&gt;&lt;/test&gt;
  &lt;/root&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Here is a simple sample</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;searchResponse:searchResponse xmlns="urn:messages_2012_2.platform.webservices.itsthesuite.com" 
                                 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
                                 xmlns:searchResponse="urn:messages_2012_2.platform.webservices.itsthesuite.com"
                                 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;platformCore:searchResult xmlns:platformCore="urn:core_2012_2.platform.webservices.itsthesuite.com"&gt;
      &lt;platformCore:status isSuccess="true"/&gt;
      &lt;platformCore:totalRecords&gt;1&lt;/platformCore:totalRecords&gt;
      &lt;platformCore:recordList&gt;
        &lt;platformCore:record internalId="154098" xsi:type="listRel:Contact" xmlns:listRel="urn:relationships_2012_2.lists.webservices.itsthesuite.com"&gt;
          &lt;listRel:entityId&gt;John Smith&lt;/listRel:entityId&gt;
          &lt;listRel:firstName&gt;John&lt;/listRel:firstName&gt;
          &lt;listRel:lastName&gt;Smith&lt;/listRel:lastName&gt;
          &lt;listRel:phone&gt;(777) 777-7777&lt;/listRel:phone&gt;
          &lt;listRel:email&gt;john.smith@yormoms.com&lt;/listRel:email&gt;
        &lt;/platformCore:record&gt;
      &lt;/platformCore:recordList&gt;
    &lt;/platformCore:searchResult&gt;
  &lt;/searchResponse:searchResponse&gt;
  </code></pre>
  
  <p>I need the solution to work for this sample as well.</p>
  
  <p>Employee Sample</p>
  
  <pre><code>        &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;searchResponse xmlns="urn:messages_2012_2.platform.webservices.netsuite.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:searchResponse="urn:messages_2012_2.platform.webservices.netsuite.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  &lt;platformCore:searchResult xmlns:platformCore="urn:core_2012_2.platform.webservices.netsuite.com" &gt;
  &lt;platformCore:status isSuccess="true"/&gt;
  &lt;platformCore:totalRecords&gt;1&lt;/platformCore:totalRecords&gt;
  &lt;platformCore:recordList&gt;
  &lt;platformCore:record internalId="158778" xsi:type="listEmp:Employee" xmlns:listEmp="urn:employees_2012_2.lists.webservices.netsuite.com"&gt;
  &lt;listEmp:entityId&gt;331sfds Dipo  Chaponda&lt;/listEmp:entityId&gt;
  &lt;listEmp:salutation&gt;Mr.&lt;/listEmp:salutation&gt;
  &lt;listEmp:firstName&gt;Dipo&lt;/listEmp:firstName&gt;
  &lt;listEmp:lastName&gt;Chaponda&lt;/listEmp:lastName&gt;
  &lt;listEmp:email&gt;dchapond@youmm.com&lt;/listEmp:email&gt;
  &lt;/platformCore:record&gt;
  &lt;/platformCore:recordList&gt;
  &lt;/platformCore:searchResult&gt;
  &lt;/searchResponse&gt;
  </code></pre>