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: xlink implementation


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


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