Mat, you do want last() to identify the last menu. For example, with your
input (below), this XSL:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy>
</xsl:template>
<xsl:template match="menu[not(*) and position() = last()]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="last">1</xsl:attribute>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Produces:
<?xml version="1.0" encoding="UTF-8"?>
<menudata>
<menu name="link1">
<menu name="link1a"/>
<menu name="link1b"/>
<menu name="link1c" last="1"/>
</menu>
<menu name="link2">
<menu name="link2a"/>
<menu name="link2b"/>
<menu name="link2c" last="1"/>
</menu>
</menudata>
--A
From: Mat Bergman <matbergman(_at_)yahoo(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Can't identify last ancestor node
Date: Tue, 28 Jun 2005 09:20:23 -0700 (PDT)
This is close to what I need, but I need to be more
clear. In this case, the context node is
/menudata/menu/menu. I want to apply unique output for
the last <menu> nodes in /menudata/menu/menu. For
instance:
<menudata>
<menu name="link1">
<menu name="link1a"/>
<menu name="link1b"/>
<menu name="link1c"/>
</menu>
<menu name="link2">
<menu name="link2a"/>
<menu name="link2b"/>
<menu name="link2c"/>
</menu>
</menudata>
_________________________________________________________________
Don?t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--