xsl-list
[Top] [All Lists]

Re: runaway template application

2003-02-10 16:17:36
Terence,

At 05:22 PM 2/10/2003, you wrote:
As it happens, when I have

<xsl:template match="context[position() mod 3 = 1]" mode="group">
<td>
    <xsl:apply-templates select="." mode="leaf"/>
    <xsl:apply-templates select="following-sibling::node()[1]" mode="leaf"/>
    <xsl:apply-templates select="following-sibling::node()[2]" mode="leaf"/>
</td>
</xsl:template>
...

 However, when I use

<xsl:template match="context[position() mod 3 = 1]" mode="group">
<td>
    <xsl:apply-templates select="." mode="leaf"/>
    <xsl:apply-templates select="following-sibling::context[1]"
mode="leaf"/>
    <xsl:apply-templates select="following-sibling::context[2]"
mode="leaf"/>
</td>
</xsl:template>

As suggested by Jeni, I get what I want.

Remember that the node() node test matches *any* node, including text nodes, including whitespace-only text nodes. The presence of such nodes will throw off your count, if you haven't figured them in. Specifying following-sibling::context[1] picks only the first <context> following sibling, not the first following sibling of any node type, so the count is more dependable.

Cheers,
Wendell




======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
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
======================================================================


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



<Prev in Thread] Current Thread [Next in Thread>