Re: [xsl] position() in templates

Subject: Re: [xsl] position() in templates
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 08 Feb 2002 12:22:24 -0500

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])">
jian<b><xsl:value-of select="substring(last-modified,1,8)"/>@@@<xsl:value-of select="last-modified"/></b>
<xsl:apply-templates select="/items/item/last-modified" mode="a">
<xsl:with-param name="inner" select="$last"/>
<xsl:sort select="."/>

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 Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. 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:

Current Thread