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

Re: [xsl] xlink implementation


Subject: Re: [xsl] xlink implementation
From: Oleg Tkachenko <olegt@xxxxxxxxxxxxx>
Date: Wed, 20 Feb 2002 17:14:17 +0200

Slava Sedov wrote:

<xsl:template match="item[@xlink:type='simple']">
<a><xsl:attribute name="href"><xsl:value-of
select="@xlink:href"/></xsl:attribute><xsl:value-of select="."/></a>
</xsl:template>

Why not just <a href="{@xlink:href}"><xsl:value-of select="."/></a>


It work fine. But now assume that "item" replaced to more abstract tissue as "node()" and <xsl:value-of select="."/> turned into <xsl:apply-templates select="."/>. As result - stack overflow (first template call itself because it have higher priority). Is here exist elegant way to solve this task?
You can explicitly assign priority to a template, but I think more safe and robust approach will be using modes:

<xsl:template match="item[@xlink:type='simple']">
	<a href="{@xlink:href}">
		<xsl:apply-templates select="." mode="proccess-me-again"/>
	</a>
</xsl:template>

<xsl:template match="item" mode="proccess-me-again">
	...
</xsl:template>

--
Oleg Tkachenko
Multiconn International, Israel


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




Current Thread