This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Recursively link XML blocks


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]