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

Re: Recursively link XML blocks

Subject: Re: Recursively link XML blocks
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 20 Nov 2001 10:15:03 +0000
find element recursively in xml
Hi Costantino,

> In other words, I would like to "link" elements to other elements,
> and compose a new document "recursively".

When the processor comes across an insert element, it needs to get the
content of that insert element and find an element at the same level
as this one with that name, and apply templates to it. You can find an
element at the same level as this one with a particular name with:

  ../*[name() = $name]

So the template should look like:
  
<xsl:template match="insert">
  <xsl:variable name="name" select="." />
  <xsl:apply-templates select="../*[name() = $name]" />
</xsl:template>

If you apply templates directly to element_A to start off the process,
then you should get the output that you want:

  <xsl:apply-templates select="element_A" />

This relies on the default templates, such that when you apply
templates to element_A or element_B (and so on) the processor
automatically applies templates to their child text nodes and insert
elements.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.