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

Re: Re: Move (ascend) an element

Subject: Re: Re: Move (ascend) an element
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 09 Nov 2004 17:34:20 -0500
xsl move node
Hi Naomi,

At 04:27 PM 11/9/2004, you wrote:
I used a modification of the provided example to try
and move indexterms from inside /figure/title to just
above the title, but I seem to be losing my figure
attributes like id and role (because of a shallow
copy?)--doing it this way also for some reason takes
another indexterm from earlier in the xml file and
puts it right before the one I want moved (this, I
have no clue about):

<xsl:template
match="figure[child::title[child::indexterm]]">
   <xsl:copy>
     <xsl:copy-of select="//indexterm"/>

"//indexterm" translates to "/descendant-or-self::node()/child::indexterm", meaning all indexterms in the document, which is why you get them.


You want ".//indexterm", which collects all the indexterms inside the context node.

Not a big deal, but the conventional way to write your match expressions would probably be

match="figure[./title/indexterm]"

(short for child::figure[self::node()/child::title/child::indexterm])

and

match="figure/title/indexterm"

(instead of match="indexterm[parent::title[parent::figure]]")

They work the same as yours but are a bit easier to read for the XPath-fluent.

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

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.