RE: [xsl] Is this a legal XPath Expression?

Subject: RE: [xsl] Is this a legal XPath Expression?
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 14 Mar 2001 21:30:46 -0000
> Subject: [xsl] Is this a legal XPath Expression?

> select=".[not(.=preceding::TR/TD[15]/node())]"
>

No, it isn't legal. "." is an AbbreviatedStep, as such it is a Step, and a
Step cannot be followed by a Predicate.

Write select="self::node()[not(.=preceding::TR/TD[15]/node())]"

Or in the context where you are using it,

<xsl:template match="TR/TD[15]">
		<xsl:variable name="subject"
                           select="not(.=preceding::TR/TD[15]/node())"/>
		<xsl:if test="$subject">
		<tr>
			<td>
				<a href="{.}.html"><xsl:value-of select="."/></a>
			</td>
		</tr>
		</xsl:if>
</xsl:template>

I'm suspicious about that TR[15]/node() as well: what if it's a comment?

Mike Kay
Software AG


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


Current Thread