Re: Inserting snippets

Subject: Re: Inserting snippets
From: Sebastian Rahtz <sebastian.rahtz@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Jan 2000 10:05:22 +0000 (GMT)
Oliver Cope writes:
 > <snippet name="s1">apples</snippet>
 > <snippet name="s2">bananas</snippet>
 > 	. . .
 > <p>
 > 	I like <insert-snippet name="s1" />, but I hate <insert-snippet
 > name="s2" />.
 > </p>
 > ...and I'm looking for an XSL transformation that will give me this:
 > '<p>I like apples, but I hate bananas.</p>"

<xsl:template match="insert-snippet">
 <xsl:value-of select="//snippet[name=current()/@name]"/>

though it would be faster to use 

<xsl:template match="insert-snippet">
 <xsl:value-of select="id(@name)/@name"/>

if <snippet>'s `name' is declared as of type ID in a DTD.

<xsl:template match="snippet"/>

will be needed if you run from the top with an apply-templates


 XSL-List info and archive:

Current Thread