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

RE: Removing elements based on contents

Subject: RE: Removing elements based on contents
From: cknell@xxxxxxxxxx
Date: Sat, 24 Jun 2006 10:41:17 -0400
xslt removing elements
Use this template for <Story> to achieve what you want.


<xsl:template match="Story">
    <xsl:choose>
    	<xsl:when test="text() = 'End Here'"></xsl:when>
    	<xsl:when test="following-sibling::Story[text() = 'End Here']"></xsl:when>
    	<xsl:otherwise><xsl:copy-of select="." /></xsl:otherwise>
    </xsl:choose>
  </xsl:template>
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Chad Chelius <cchelius@xxxxxxxxxxxxxxx>
Sent:     Sat, 24 Jun 2006 08:03:53 -0400
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:   Removing elements based on contents

I have an XML file that looks something like this:

<Root>
	<Story>Content</Story>
	<Story>More Content</Story>
	<Story>End Here</Story>
	<Story>Good stuff that I want</Story>
</Root>

My question is: Is there a way using XSLT to remove all elements up  
to and including the one who's content contains <Story>End Here</ 
Story> and leave the rest intact? Basically everything from the top  
of the XML file down to and including that tag is junk that I don't  
want to include in the file but the rest of it I want to keep. I  
don't think XSLT traverses I file in that way though. Does anyone  
have any ideas?

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.