[xsl] Finding the last ancestor of a list

Subject: [xsl] Finding the last ancestor of a list
From: "Fleetwood, Brett \(DCS\)" <fleetwood.brett2@xxxxxxxxxxxxxxxx>
Date: Thu, 26 Oct 2006 09:29:29 +0930
G'day all,

I've got a XHTML unordered list <ol> structure. Inside the <li> tags
there can potentially be many formatted tags such as <em>, <b>, etc.
When im matching on the <br> tag inside a <ol><li><...><...><br> I want
to find out if the ancestor <li> is the last of the <ol>. This is my
template that isn't working. I'm using fop-0.20.5

<xsl:template
match="br[generate-id()=generate-id(key('b',generate-id(ancestor::*[self
::li][1]))[last()])]">
    <xsl:if test="ancestor::li[position()=last()]">
        <fo:block><fo:leader/></fo:block>
    </xsl:if>
    ...
</xsl:template>

I'm not sure exactly how the expression ancestor::li works? Does it
match on all the <li> of the <ul> or just the one that is directly
related?



 Brett Fleetwood

Current Thread