Re: [xsl] configuring a conditional

Subject: Re: [xsl] configuring a conditional
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 24 May 2005 12:22:12 -0400
Bruce,

At 12:22 PM 5/24/2005, you wrote:
That's what I have:

<xsl:message>
<xsl:value-of select="$cite-ref/@linkend"/>:
<xsl:if test="$cite-ref is key('refs',$cite-ref/@linkend)[1]">FIRST</xsl:if>
</xsl:message>


Result is:

TimesP2001a:

Veer1996a:

Tilly2000a:

Tilly2002a:

NW2000-0207:

NW2000-0424a:

Tremblay2001a:

Thrift1990a:

Tilly2000a:

Well if the @linkend is correct, the next things to check are the key declaration and the document context. Since I gather your call to key() is happening in a document context that doesn't contain your $cite-ref (the mods:mods current node is in a separate tree), you'll need to establish the correct context for your call to key().


In the old days this would have been

<xsl:for-each select="$cite-ref">
  <xsl:if test="count(.|key('refs',@linkend)[1])=1">FIRST</xsl:if>
</xsl:for-each>

But since you're using that newfangled 2.0-thang, you could do

<xsl:if
test="$cite-ref is key('refs',$cite-ref/@linkend,$cite-ref)[1]">FIRST</xsl:if>


Note the third argument to establish the document context for key().

I hope that helps,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread