Subject: Re: [xsl] finding position in list of siblings From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 09 Jul 2004 15:57:58 -0400 |
I'm trying to find the context node's position relative to a list of identically named nodes. For example, given the following XML:
<?xml version="1.0" encoding="UTF-8"?> <FAMILY> <SISTER/> <SISTER/> <BROTHER/> <BROTHER/> <BROTHER/> </FAMILY>
I would like the 3 BROTHER nodes to show their position as 1,2,3 respectively rather than 3,4,5.
<xsl:template match="BROTHER"> <xsl:value-of select="count(BROTHER/preceding-sibling::*)" /> <xsl:value-of select="count(preceding-sibling::node()[.='BROTHER'])" /> </xsl:template>
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx 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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] finding position in list of s, John C Cartwright | Thread | Re: [xsl] finding position in list , David Carlisle |
Re: [xsl] finding position in list , John C Cartwright | Date | RE: Re: [xsl] finding position in l, cknell |
Month |