title: How can I create lists with Parent items of child attributes using E4X?
body: <p>I'm having trouble getting the results I want using E4X to dig into my XML document. For exampleWhat I want to do, using the XML below, is find all of the <strong>d_locations</strong> that have the <strong>d_type</strong> SW, and then create a list of all the SW d_types that includes the code and the <strong>hfloor</strong> number - which is a level above the <strong>d_type</strong>.</p>
  
  <p>So to illustrate the example, I want to output a list like this:</p>
  
  <p><strong>TYPE: SW</strong></p>
  
  <p><strong>Floor 18: SW18.10N</strong></p>
  
  <p><strong>Floor 15: SW15.W2</strong></p>
  
  <p><strong>Floor 15: LB12</strong></p>
  
  <p><strong>Floor 15: LB17</strong></p>
  
  <p><strong>Floor S2: SWS2.3</strong></p>
  
  <p>How can I do that using E4X? Thanks so much!</p>
  
  <p>Mattynabib</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;bldg&gt;
  
  &lt;hfloor number="18"&gt;
  &lt;d_location d_code="SW18.10N" d_type="SW" description="Ferbludgit thingamabob"&gt;
          &lt;d_image&gt;3e_pic1&lt;/d_image&gt;
      &lt;d_image&gt;3e_pic2&lt;/d_image&gt;
          &lt;d_image&gt;3e_pic3&lt;/d_image&gt;
          &lt;d_image&gt;3e_pic4&lt;/d_image&gt;
          &lt;d_image&gt;3e_pic5&lt;/d_image&gt;
          &lt;d_video&gt;3e_vid_1&lt;/d_video&gt;
          &lt;d_video&gt;3e_vid_2&lt;/d_video&gt;
          &lt;d_video&gt;&lt;/d_video&gt;
  &lt;/d_location&gt;
  &lt;/hfloor&gt;
  
  &lt;hfloor number="15"&gt;
  &lt;d_location d_code="W1" d_type="PSW" description="Broken fetzer valve"&gt;
          &lt;d_image&gt;3s_pic1&lt;/d_image&gt;
  &lt;/d_location&gt;
  &lt;d_location d_code="SW15.W2" d_type="SW" description="Broken fetzer valve"&gt;
          &lt;d_image&gt;3s_pic1&lt;/d_image&gt;
  &lt;/d_location&gt;
  &lt;d_location d_code="W3" d_type="LB" description="Broken fetzer valve"&gt;
          &lt;d_image&gt;3s_pic1&lt;/d_image&gt;
  &lt;/d_location&gt;
      &lt;d_location d_code="LB12" d_type="SW" description="Screwed up whosamadingy"&gt;
          &lt;d_image&gt;media/lb15_12/LB-12 LOOKING NORTH.png&lt;/d_image&gt;
      &lt;d_image&gt;media/lb15_12/LB-12 LOOKING SOUTH.png&lt;/d_image&gt;
          &lt;d_image&gt;media/lb15_12/Pages from Level_15_Link_Beam_12.png&lt;/d_image&gt;
      &lt;d_image&gt;media/lb15_12/Pages from Level_15_Link_Beam_12-2.png&lt;/d_image&gt;
      &lt;d_image&gt;media/lb15_12/Post Demo from CITC018306365-2.png&lt;/d_image&gt;
          &lt;d_image&gt;media/lb15_12/Rebuilt from CITC018306365.png&lt;/d_image&gt;
      &lt;d_image&gt;media/lb15_12/WEI LB 12 level 15.png&lt;/d_image&gt;
          &lt;d_video&gt;Video 1&lt;/d_video&gt;
          &lt;d_video&gt;Video 2&lt;/d_video&gt;
          &lt;d_video&gt;Video 3&lt;/d_video&gt;
  &lt;/d_location&gt;
  
  &lt;d_location d_code="LB17" d_type="SW" description="Broken fetzer valve"&gt;
          &lt;d_image&gt;3s_pic1&lt;/d_image&gt;
  &lt;/d_location&gt;
  &lt;d_location d_code="LB8" d_type="EB" description="Broken fetzer valve"&gt;
          &lt;d_image&gt;3s_pic1&lt;/d_image&gt;
  &lt;/d_location&gt;
  &lt;d_location d_code="W14" d_type="CB" description="Broken fetzer valve"&gt;
          &lt;d_image&gt;3s_pic1&lt;/d_image&gt;
  &lt;/d_location&gt;
  &lt;/hfloor&gt;
  
  
  &lt;hfloor number="S2"&gt;
  &lt;d_location d_code="W3" d_type="LB" description="Broken fetzer valve"&gt;
          &lt;d_image&gt;3s_pic1&lt;/d_image&gt;
  &lt;/d_location&gt;
  &lt;d_location d_code="SWS2.3" d_type="SW" description="Whacked flogatron"&gt;
          &lt;d_image&gt;media/sw_s2_3/CITC000155966.png&lt;/d_image&gt;
      &lt;d_image&gt;media/sw_s2_3/CITC000155983.png&lt;/d_image&gt;
          &lt;d_image&gt;media/sw_s2_3/CITC000155996.png&lt;/d_image&gt;
          &lt;d_image&gt;media/sw_s2_3/CITC000156003.png&lt;/d_image&gt;
          &lt;d_image&gt;media/sw_s2_3/Screen shot 2012-04-19 at 5.54.42 PM.png&lt;/d_image&gt;
          &lt;d_image&gt;media/sw_s2_3/WEI SWS2.3.png&lt;/d_image&gt;
          &lt;d_video&gt;lbs.6e vid&lt;/d_video&gt;
          &lt;d_video&gt;&lt;/d_video&gt;
          &lt;d_video&gt;&lt;/d_video&gt;
  &lt;/d_location&gt;
  &lt;d_location d_code="LB17" d_type="ES" description="Broken fetzer valve"&gt;
          &lt;d_image&gt;3s_pic1&lt;/d_image&gt;
  &lt;/d_location&gt;
  &lt;d_location d_code="LB8" d_type="SW" description="Broken fetzer valve"&gt;
          &lt;d_image&gt;3s_pic1&lt;/d_image&gt;
  &lt;/d_location&gt;
  &lt;/hfloor&gt;
  
  &lt;/bldg&gt;
  </code></pre>