Subject: Re: xsl:when problem From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Fri, 18 Aug 2000 14:08:02 +0100 |
Eric, xsl:when and xsl:otherwise are meant to go inside xsl:choose. Your template should be: <xsl:template match="link"> <xsl:if test="@internal"> <xsl:choose> <xsl:when test=".[@internal = //bookmark/@name]"> <A> <xsl:attribute name="href">#<xsl:value-of select="@internal" /></xsl:attribute> <xsl:value-of select="@text"/> </A> </xsl:when> <xsl:otherwise> <xsl:value-of select="@text"/> </xsl:otherwise> </xsl:choose> </xsl:if> </xsl:template> I haven't tested this with the old version of MSXML. The test expression '.[@internal = //bookmark/@name]' tests to see whether there are any nodes that are the current node that have an 'internal' attribute with the same value as the 'name' attribute of any 'bookmark' element in the document. In effect, this is testing whether the 'internal' attribute of the current node has the same value as the 'name' attribute of any 'bookmark' element, and should probably just be '@internal = //bookmark/@name' to save a bit of processing. [Also, if you were using a more up-to-date version of MSXML, then you could use attribute value templates instead of xsl:attribute.] I hope that this helps, Jeni Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
xsl:when problem, Eric Taylor | Thread | Re: xsl:when problem, Miloslav Nic |
RE: Hiding the XSL ?, Chris Bayes | Date | Re: Conditional & Preceding-sibling, Jeni Tennison |
Month |