[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Recursively link XML blocks
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|