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

Re: keeping source element after template applied?

Subject: Re: keeping source element after template applied?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 03 Dec 2002 17:57:12 -0500
Re:  keeping source element after template applied?
Kevin,

Apparently you're assuming that a node is "kept" or "gotten rid of" by the processor, but it isn't so. Rather, nodes in the source tree are always there -- the processor can always look at the source tree and none of it is ever thrown away. The processor's job is to *build* a result tree that starts with nothing in it (or actually, with nothing in it but a root node). What it adds to this result (the "tree" it "builds", in the topsy-turvy world of XML metaphors) depends on your stylesheet.

So your question can be reframed as "is it possible to apply more than one template to a node", leaving out whether the element is "removed". (It'll never be removed from the source tree. Whether a *copy* of it *ever* appears in the result, is up entirely to you. By default, the processor will copy text nodes, but not elements as such.)

If you could be more specific, or (better) show us a bit of code, we could make a better guess as to whether you would be best off:

(a) matching your element with a template that does something, then applies a second template, in another mode, to its own context node (thereby getting two different templates applied);
(b) using <xsl:call-template> to call a template by name from your matching template;
(c) splitting your stylesheet into pieces and using <xsl:apply-imports/>, which allows one stylesheet to invoke a "backup" template of a lower import precedence (matching the same element);
(d) something altogether different....


Cheers,
Wendell

At 05:41 PM 12/3/2002, you wrote:
Hi,

I have a document in which I'd like some elements to remain intact, after I've applied a transformation template to them.

The reason is that there's more than transformation that has to be made, by other matching templates, to this element before it can be removed.

I want to do:

xsl template match="myElement"
do one complex thing

xsl template match="myElement"
do another complex thing, and let element be removed

I'm not seeing any provision for this, is there a way to do so?

thanks
Kevin


======================================================================
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
======================================================================


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.