title: How to make xsl show only images/captions from xml
body: <p>I have two images in my xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;description&gt;
      &lt;title&gt;Letter from Waldemar Schultze to Jennie Schultze&lt;/title&gt;
      &lt;creator type="author"&gt;
          &lt;name type="personal"&gt;Schultze, Waldemar&lt;/name&gt;
      &lt;/creator&gt;
      &lt;date&gt;1943-06-30&lt;/date&gt;
      &lt;source&gt;Special Collections and University Archives, W. E. B. Du Bois Library,
          University of Massachusetts Amherst.&lt;/source&gt;
      &lt;citation&gt;Robert and Waldemar Schultze Papers (MS 528). Special Collections and
          University Archives, W.E.B. Du Bois Library, University of
          Massachusetts Amherst.&lt;/citation&gt;
  &lt;/description&gt;
  
  &lt;text&gt;
  
      &lt;header type="letterhead"&gt;
  
          &lt;imageGroup&gt;
              &lt;image xlink:href="mums528-i001-001.png"/&gt;
              &lt;caption&gt;page 1&lt;/caption&gt;
          &lt;/imageGroup&gt;
          &lt;imageGroup&gt;
              &lt;image xlink:href="mums528-i001-002.png"/&gt;
              &lt;caption&gt;page 2&lt;/caption&gt;
          &lt;/imageGroup&gt;
  
          &lt;organization&gt;Unites States Disciplinary Barracks&lt;/organization&gt;
          &lt;location&gt;Fort Leavenworth, Kansas&lt;/location&gt;
          &lt;date format="M/DD/YY"&gt;6/30/43&lt;/date&gt;
          &lt;recipient&gt;
              &lt;name type="personal"&gt;Mrs. W.J. Schultze&lt;/name&gt;
              &lt;address&gt;875 Richmond Av., Buffalo, N.Y.&lt;/address&gt;
              &lt;relation&gt;Mother&lt;/relation&gt;
          &lt;/recipient&gt;
      &lt;/header&gt;
      &lt;body&gt;
          &lt;salutation&gt;Dear Mother,&lt;/salutation&gt;
          &lt;p&gt;&lt;line&gt;This is the first letter I have had&lt;/line&gt; 
              &lt;line&gt;an opportunity to write you since leaving Fort&lt;/line&gt; 
              &lt;line&gt;Jay, and I know you must be anxious to hear from me.&lt;/line&gt;&lt;/p&gt;
          &lt;p&gt;&lt;line&gt;Bob and I are both feeling as well as&lt;/line&gt; 
              &lt;line&gt;can be expected considering our present cir-&lt;/line&gt;
              &lt;line&gt;cumstances. We both have high blood&lt;/line&gt;
              &lt;line&gt;pressure, mine has been 160/100 for the past&lt;/line&gt; 
              &lt;line&gt;2 days, and Bob's 158/96, but my sinus&lt;/line&gt;
              &lt;line&gt;infection has not caused me quite so much&lt;/line&gt; 
              &lt;line&gt;trouble since leaving N.Y. State. I believe&lt;/line&gt; 
              &lt;line&gt;the air is dryer here and is responsible&lt;/line&gt; 
              &lt;line&gt;for any alleviation that has taken place.&lt;/line&gt;&lt;/p&gt;
          &lt;p&gt;&lt;line&gt;While a prisoner here remains in their&lt;/line&gt; 
              &lt;line&gt;so-called 1st grade, he is able to write&lt;/line&gt; 
              &lt;line&gt;twice a week, in second grade once a week,&lt;/line&gt; 
              &lt;line&gt;and in third grade once a month. These&lt;/line&gt; 
              &lt;line&gt;grades refer to classifications that ostensibly&lt;/line&gt;
              &lt;line&gt;are for conduct while here.  It is quite possible&lt;/line&gt; 
              &lt;line&gt;to lose a conduct rating, as I understand it,&lt;/line&gt; 
              &lt;line&gt;by not having a perpetually rusting tin cup polished&lt;/line&gt; 
              &lt;pb n="2"/&gt;
              &lt;line&gt;brightly for daily inspection, although the tin plating long ago dis-&lt;/line&gt;
              &lt;line&gt;appeared and the cup is rusty again within 2 hours after wetting.&lt;/line&gt;&lt;/p&gt;
          &lt;p&gt;&lt;line&gt;The food here is good and is well-cooked,&lt;/line&gt; 
              &lt;line&gt;with one exception, the gravy, which is nothing but&lt;/line&gt; 
              &lt;line&gt;flour, water, and bacon grease, Strangely enough, how-&lt;/line&gt;
              &lt;line&gt;ever, no condiments, not even salt, are provided on&lt;/line&gt; 
              &lt;line&gt;the table, to the detriment of otherwise very good&lt;/line&gt; 
              &lt;line&gt;meals.  While meat here is unrationed and is plentiful,&lt;/line&gt; 
              &lt;line&gt;toilet paper; believe it or not, is rationed.  A&lt;/line&gt; 
              &lt;line&gt;5¢ roll must last a prisoner 45 days, or else -- ?&lt;/line&gt;
              &lt;line&gt;Perhaps, however, a prisoner can purchase additional&lt;/line&gt; 
              &lt;line&gt;if it should be necessary.&lt;/line&gt;&lt;/p&gt;
          &lt;p&gt;&lt;line&gt;Please see that my subscriptions are transferred&lt;/line&gt; 
              &lt;line&gt;here as soon as possible from Fort Jay. Give Florence&lt;/line&gt; 
              &lt;line&gt;and Helen my regards, and thank Joe for his&lt;/line&gt; 
              &lt;line&gt;efforts in my behalf in managing my business.&lt;/line&gt; 
              &lt;line&gt;Find out from Joe how tube deliveries are at the&lt;/line&gt; 
              &lt;line&gt;present time, first to satisfy my curiosity; and&lt;/line&gt; 
              &lt;line&gt;also let me know if you are receiving your&lt;/line&gt;
              &lt;line&gt;remittance regularly from him.  If he is not&lt;/line&gt; 
              &lt;line&gt;taking care of your support in accordance with&lt;/line&gt; 
              &lt;line&gt;the instructions I left him, I wish to know it,&lt;/line&gt; 
              &lt;line&gt;so I can write, and correct the matter.&lt;/line&gt;  
              &lt;line&gt;You can tell Joe to subscribe to Electronics&lt;/line&gt; 
              &lt;line&gt;magazine for me and send it to this address&lt;/line&gt;
              &lt;line&gt;direct from the publisher.  He should also have a copy&lt;/line&gt; 
              &lt;line&gt;of Palmer's "Calculus for Home Study," sent me by the publisher,&lt;/line&gt; 
              &lt;line&gt;whose name he can obtain from Ulbrichs.  In future letters I'll&lt;/line&gt; 
              &lt;line&gt;copy the "Prisoner's Handbook" issued here, and the&lt;/line&gt; 
              &lt;line&gt;contents of the detached letter form stub.&lt;/line&gt; 
          &lt;/p&gt;
          &lt;valediction&gt;Love, Waldemar&lt;/valediction&gt;
      &lt;/body&gt;
  &lt;/text&gt;
  </code></pre>
  
  <p></p>
  
  <p>I want to transform the xml so that ONLY the images and their captions are displayed. Here's my xsl:</p>
  
  <p>
  </p>
  
  <pre><code>&lt;xsl:output method="xml" indent="yes"/&gt;
  
   &lt;xsl:template match="/"&gt;   
      &lt;html&gt;
          &lt;head&gt;
              &lt;link rel="stylesheet" type="text/css" href="letter.css"/&gt;
              &lt;title&gt;Letter&lt;/title&gt;
          &lt;/head&gt;
          &lt;body&gt;
              &lt;div&gt;
                  &lt;xsl:apply-templates/&gt;
              &lt;/div&gt;
          &lt;/body&gt;
      &lt;/html&gt;
   &lt;/xsl:template&gt;
  
  &lt;xsl:template match="//imageGroup"&gt;
      &lt;xsl:if test="//imageGroup"&gt;
          &lt;div class="image"&gt;
              &lt;xsl:for-each select="//imageGroup"&gt;
                  &lt;img src="{image/@xlink:href}"/&gt;
                  &lt;span class="caption"&gt;&lt;xsl:value-of select="caption"/&gt;&lt;/span&gt;
              &lt;/xsl:for-each&gt;
          &lt;/div&gt;
      &lt;/xsl:if&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p></p>
  
  <p>The problem is, my output still shows all the text, and my images are doubled. How do I fix it without changing anything in the xml?</p>