[xsl] Removing the extra elements through template match

Subject: [xsl] Removing the extra elements through template match
From: "Thangavelu Srinivasan" <vasantry@xxxxxxxxx>
Date: Thu, 2 Nov 2006 18:06:27 +0530
How to remove the extra elements thru template match

Hi All,
I need help in resolving the problem for the below. I am using XSLT 1.0.
Any suggestions are welcome.


XML File


<?xml version="1.0" encoding="UTF-8"?>
<aaxml>
  <item name="control">
      <envelope>
          <try_id>Sample</try_id>
          <rec_no>2006092405020001815466</rec_no>
          <selector_code>2071</selector_code>
      </envelope>
  </item>
  <item>
      <story>
          <rec_no>2006092405020001815466</rec_no>
          <try_id>AP ONLINE</try_id>
          <selector_code>2071</selector_code>
          <slug>Sample</slug>
          <story_number>V7193</story_number>
          <requested_action>ADD</requested_action>
          <headline>Sample text</headline>
          <byline>s</byline>
          <dateline>a</dateline>
          <dateline1>b</dateline1>
          <dateline2>Co</dateline2>
          <timestamp>09/24/06 05:02</timestamp>
          <time_zone>EDT</time_zone>
          <story_text>"&lt;p>This is a sample text.&lt;/p>"</story_paragraph>
          <language>ENGLISH</language>
          <anpa_cat>s</anpa_cat>
          <update_timestamp>Sep 24 2006 5:04:00:000AM</update_timestamp>
          <sri_id>Sample</sri_id>
      </story>
      <subject>
          <subject_code>SELECTOR</subject_code>
          <subject_value>2071</subject_value>
      </subject>
  </item>
</aaxml>


XSL File


<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">

  <xsl:output method="xml" encoding="utf-8"
omit-xml-declaration="yes" indent="yes"/>

   <xsl:template match='story'>
      <rss version="2.0">
          <channel>
              <title><xsl:value-of select="try_id"/></title>
              </item>
          </channel>
      </rss>
  </xsl:template>

</xsl:stylesheet>


Question:


I don't want to display other than story element. How to give it in
the xsl in a single command for the removing the irrespective of the
tags not mentioned.

Regards
Srinivas

Current Thread