This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: position() in templates
- From: Wendell Piez <wapiez at mulberrytech dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 08 Feb 2002 12:22:24 -0500
- Subject: Re: [xsl] position() in templates
- Reply-to: xsl-list at lists dot mulberrytech dot com
Jian,
I'm afraid I didn't have time to dig into your code and figure out exactly
what you need to do (partly since I'd have to guess exactly what you want
to do!), but....
It seems to be that where you say:
><xsl:template match="*">
> <xsl:variable name="last" select="substring(last-modified,1,8)"/>
> <xsl:if
> test="not(preceding-sibling::item[substring(last-modified,1,8)=$last])">
> <tr><td>
> jian<b><xsl:value-of
> select="substring(last-modified,1,8)"/>@@@<xsl:value-of
> select="last-modified"/></b>
> </td></tr>
> <xsl:apply-templates select="/items/item/last-modified" mode="a">
> <xsl:with-param name="inner" select="$last"/>
> <xsl:sort select="."/>
> </xsl:apply-templates>
> </xsl:if>
></xsl:template>
That xsl:apply-templates could be causing behavior such as you are
complaining about. The template it appears inside of matches any element,
but in practice (given the other templates' logic), only item elements. Yet
for each (item) element matched, you apply templates to all last-modified
elements in the document. Are you sure you don't want simply
<xsl:apply-templates select="last-modified"/> to apply a template just to
this item's last-modified?
If I'm not reading correctly and this doesn't put you on the right track,
could you please post again with:
1. A simpler demonstration of the problem (strip your code and example down
to the minimum that shows what's happening), and
2. A statement, preferably with example code, of exactly what output you want?
In that case it'd probably be easier for one of us to help you.
Good luck,
Wendell
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.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