[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Recursively link XML blocks


Subject: Re: [xsl] Recursively link XML blocks
From: ronald heller <ronald@xxxxxxxxxxx>
Date: Wed, 21 Nov 2001 11:06:53 +0100

Hi,

would this suffice?

XML:
<document>
<element_A>
     textA textA textA
     <insert>element_B</insert>
     textA textA textA
</element_A>

<element_B>
     textB textB textB
     <insert>element_C</insert>
     textB textB textB
</element_B>

<element_C>
     textC textC textC
     textC textC textC
</element_C>
</document>

XSLT:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	
	<xsl:template match="document">
	<xsl:apply-templates select="*[1]"/>
	</xsl:template>
	
	<xsl:template match="insert">
		<xsl:variable name="element" select="."/>
		<xsl:apply-templates select="/document/*[name()=$element]"/>
	</xsl:template>
</xsl:stylesheet>


Cheers, RH


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




Current Thread