|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








