Thanks Aaron! I couldn't figure out how to get that to work for more than one string, but yours works great!
Eric
From:
aarondamommio@gmail.com [mailto:
aarondamommio@gmail.com] On Behalf Of Aaron DaMommio
Sent: Wednesday, April 10, 2013 5:30 PM
To: Eric Nordlund
Cc:
docbook-apps@lists.oasis-open.orgSubject: Re: [docbook-apps] Trying to remove some elements from an XML file with XSLT
My approach was to set up a base template that copies everything over, and then add one template that catches entry elements that don't match either of the two String element values you specified, writing nothing out for them.
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="entry[not(String[ . = 'XML options'] or String[.='Diff options'])]"/>
</xsl:stylesheet>
The results I got when I ran your input through that XSL were:
<serialized version="14.2" xml:space="preserve">
</serialized>
On Wed, Apr 10, 2013 at 6:48 PM, Eric Nordlund <
nordlund@cray.com<mailto:
nordlund@cray.com>> wrote:
Hello, I'm trying to filter a massive XML preferences file to only keep certain elements I want, and remove the rest. The file looks like this:
<serialized version="14.2" xml:space="preserve">
</serialized>
How can I apply an XSLT that will keep the <entry> blocks for "XML options" and "Diff options" and the parent structure but get rid of the other <entry> blocks?
Thanks,
Eric Nordlund
Customer Documentation and Training
Cray Inc.
901 5th Ave
Seattle, WA 98164
(206)701-2232<tel:%28206%29701-2232>
--
--------------------------------------
Aaron DaMommio: Husband, father, writer, juggler, and expert washer of dishes.
- My blog:
http://aarondamommio.blogspot.com- Need a juggler?
http://amazingaaronjuggler.blogspot.com/=======================================