title: XSLT unable to find XPATH for for-each
body: <p>I am trying to debug an issue related to xpath. I created a variable $MetaData in my XSLT assigning a xml document but for some reason, foreach loop didn't able to locate its child and I couldn't able to get inside foreach loop.</p>
  
  <p>XSLT:</p>
  
  <pre><code>&lt;!-- language: lang-xslt --&gt;
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet
      version="1.0"
      xmlns="http://www.w3.org/TR/xhtml1/strict"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxsl="urn:schemas-microsoft-com:xslt"&gt;
  
    &lt;xsl:variable name="_MetaData"&gt;
      &lt;MetaData&gt;
        &lt;EmployeeId&gt;1233&lt;/EmployeeId&gt;
        &lt;EmployeeName&gt;abcd&lt;/EmployeeName&gt;
      &lt;/MetaData&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:variable name="MetaData" select="msxsl:node-set($_MetaData)"&gt;&lt;/xsl:variable&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="*[local-name()='MetaDataTag']"&gt;
      &lt;xsl:copy&gt;
  
        &lt;MetaData VocabularyOwner="acme.com" Vocabulary="MetaData"&gt;
          &lt;xsl:for-each select="$MetaData//MetaData/*"&gt;
            &lt;xsl:element name="Occurrence"&gt;
              &lt;xsl:attribute name="Id"&gt;
                &lt;xsl:value-of select="local-name(.)"/&gt;
              &lt;/xsl:attribute&gt;
              &lt;xsl:attribute name="Value"&gt;
                &lt;xsl:value-of select="string(.)"/&gt;
              &lt;/xsl:attribute&gt;
            &lt;/xsl:element&gt;
          &lt;/xsl:for-each&gt;
        &lt;/MetaData&gt;
  
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>XML:
  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;Envelope&gt;
    &lt;MetaDataTag /&gt;
  &lt;/Envelope&gt;
  </code></pre>
  
  <p>If I remove xmlns xmlns="http://www.w3.org/TR/xhtml1/strict" namespace, everything seems working fine and I am able to get inside the loop.
  I am not sure how can I resolve this issue without removing xmlns="http://www.w3.org/TR/xhtml1/strict" namespace.</p>