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

Re: Preserve ancestors/discard children

Subject: Re: Preserve ancestors/discard children
From: "Nikolai Grigoriev" <grig@xxxxxxx>
Date: Sun, 19 Dec 1999 23:46:49 +0300
Re: Preserve ancestors/discard children
John Robert Gardner <jrgardn@xxxxxxxxx> wrote:


>For the following XML, I'm trying to "shave off" all the <ul>'s, each of
>of which has only a "class="L"" attribute to distinguish its <li>'s.  In
>other I only want to have everything from <li class="T"> UPWARD,
>with _none_ of the sub-ul's therein.

This can be done by adding just one line to your stylesheet:

<xsl:template select="li[@class='T']//*" precedence="1"/>

It suppresses all element descendants of any <li class="T"> element.
The precedence value of 1 guarantees that this rule cannot be overridden
by rules with default precedence.

The rule just does nothing, thus making every trace of the matching
element disappear from the output. Text children of the <li class="T">
itself are not matched, and processed in a regular way.

There are some caveats in this approach, e.g. you should care about
not to override this rule by incautious use of <xsl:for-each>. But in
regular situations, when most of the tree navigation is done by calls
to <xsl:apply-templates>, this should work.

Regards,

Nikolai



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.