[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How to remove the extra elements thru template mat

Subject: RE: How to remove the extra elements thru template match
From: cknell@xxxxxxxxxx
Date: Thu, 02 Nov 2006 10:26:04 -0500
mat templates
<?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='/'>
       <xsl:apply-templates select="aaxml/item/story" />
     </xsl:template>

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

</xsl:stylesheet>

-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Thangavelu Srinivasan <vasantry@xxxxxxxxx>
Sent:     Thu, 2 Nov 2006 17:06:45 +0530
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:   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>"<p>This is a sample text.</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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.