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

RE: position() test for processing boundaries

Subject: RE: position() test for processing boundaries
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 19 Nov 2004 15:55:53 -0500
xsl copy required nodes only
Hey Ron,

To add to what Mike says, if you don't have the option of using XPath 2.0, you could work around the difficulty he describes with xsl:copy-of by using xsl:apply-templates instead (probably with a mode), and using the templates then applied to further constrain exactly what you want to happen. Maybe you want to use xsl:copy instead of copy-of (which will do a "shallow copy" of the current node only, not a "deep copy") -- which you could do in any templates matching in the applied mode.

It's nice to see all those apps and rdgs.

Cheers,
Wendell

At 08:47 AM 11/19/2004, Mike wrote:
The test is the same in both cases. The third item in .//* is the <rdg
n="3"> element. The two elements before this are the <q n="1"> element and
the <app n="2"> element, and you have obtained deep copies of these two
elements, just as you requested.

However, this isn't going to help with your problem. Doing xsl:copy-of gives
you a deep copy of all the selected nodes, and therefore xsl:copy-of
select=".//*" is going to contain many duplicated nodes: each element will
be copied once its own right, and once as a side-effect of copying its
parent, once when copying its grandparent, and so on.

This kind of problem becomes much easier with the << and >> operators in
XPath 2.0. Select the first and last nodes you want to process (say A and
B), and then you can process all the required nodes using

select="$A | //*[. >> $A and . << $B] | $B"

Michael Kay
http://www.saxonica.com/


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

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.