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

Re: Copy all preceding-sibling except...

Subject: Re: Copy all preceding-sibling except...
From: Michael Nguyen <mnguyen@xxxxxxxxxx>
Date: Tue, 01 Feb 2005 15:02:00 -0800
xslt copy all except
You also might want to create an empty template that matches "Special". I think I read somewhere that on certain processors that might be more efficient if you are doing something like:

<xsl:apply-templates select="preceding-sibling::*" />
....

<xsl:template match="Special" />

This way you can add more emply templates in case you want to exclude other nodes later on. It might be easier to read if you were to come back to your xslt later on.


Wendell Piez wrote:


Becky,

At 04:24 PM 2/1/2005, you wrote:

I now have a situation where I take

<RootEle>
        <Alphabet>
                <A/>
                <B/>
                <D/>
                <Special/>
                <Break/>
                <H/>
        </Alphabet>
</RootEle>

What I want to come out with is:
<RootEle>
        <Alphabet>
                <A/>
                <B/>
                <D/>
                <Break/>
        </Alphabet>
</RootEle>

I've been playing with the solution to my previous problem to see if I
can work with it to solve this one, but I am unable figure out how to
copy all the preceding-siblings and exclude any nodes that match
"Special" at the same time.


To leave "Special" elements out, assuming the context node is your Break, use

preceding-sibling::*[not(self::Special)]

in XSLT 1.0.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


--
-------------------------------------------------
Michael Nguyen
Senior Software Engineer, SKOLAR
Wolters Kluwer Health - Clinical Tools
1860 Embarcadero Rd, Suite 215
Palo Alto, CA 94303
Phone: 650-354-3025
mnguyen@xxxxxxxxxx

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.