David Carlisle wrote:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:f="data:,f"
>
<xsl:function name="f:same" as="element()*">
<xsl:param name="n" as="element()"/>
<xsl:sequence select="$n,$n/../..[node-name(.)=node-name($n)]/f:same(.)"/>
</xsl:function>
<xsl:template match="y">
:<xsl:value-of select="count(f:same(../..)/name())"/>
</xsl:template>
These are very helpful examples--I find the select="x,f(x)" construct
quite elegant (and familiar now that I remember my old lisp/DSSSL training).
But I realize I didn't give the full story, which is that the number of
ancestors between a given list item and its parent list is variable, in
that DITA allows both:
<ol><li><ol><li>
and
<ol><li><p><ol><li>
So a simple "../.." won't be reliable. (Although one could argue that
the intervening <p> should restart the list sequence--I'm not sure the
DITA 1.1 spec is clear on that point.)
In thinking about it more I don't think there's a way to generalize this
to a query that is not DTD-specific since you have to know which
intervening elements to ignore and which to respect.
Thanks,
Eliot
--
Eliot Kimber
Senior Solutions Architect
"Bringing Strategy, Content, and Technology Together"
Main: 610.631.6770
www.reallysi.com
www.rsuitecms.com
--~------------------------------------------------------------------
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>
--~--