title: Xpath 1.0 nodelist based on node names
body: <p>I don't like to ask for help, but this time I'm getting totally stuck with a xpath query.</p>
  <p>Please have a look at this XML:</p>
  <pre><code>&lt;doc&gt;
    &lt;car&gt;
      &lt;property id=&quot;color&quot;&gt;
        &lt;attribute id=&quot;black&quot; /&gt;
        &lt;attribute id=&quot;white&quot; /&gt;
        &lt;attribute id=&quot;green&quot; /&gt;
      &lt;/property&gt;
      &lt;property id=&quot;size&quot;&gt;
        &lt;attribute id=&quot;small&quot; /&gt;
        &lt;attribute id=&quot;medium&quot; /&gt;
        &lt;attribute id=&quot;large&quot; /&gt;
      &lt;/property&gt;
    &lt;/car&gt;
    &lt;attributes&gt;
      &lt;color&gt;white&lt;/color&gt;
      &lt;size&gt;small&lt;/size&gt;
    &lt;/attributes&gt;
  &lt;/doc&gt;
  </code></pre>
  <p>The car/properties should be output according to the attributes nodenames. The desired output is:</p>
  <pre><code>&lt;property id=&quot;color&quot;&gt;&lt;attribute id=&quot;white&quot; /&gt;&lt;/property&gt;
  &lt;property id=&quot;size&quot;&gt;&lt;attribute id=&quot;small&quot; /&gt;&lt;/property&gt;
  </code></pre>
  <p>The xpath</p>
  <pre><code>/doc/car/property[@id=name(/doc/attributes/*)]/attribute[@id=/doc/attributes/*/text()]
  </code></pre>
  <p>results only the first node, because the name() function returns only the name of the first element.</p>
  <p>Who can help me to find out a working xpath (XSLT 1.0)? Many thanks for your help in advance!</p>