Subject: RE: [xsl] Siblings From: <Jarno.Elovirta@xxxxxxxxx> Date: Tue, 14 Dec 2004 09:48:57 +0200 |
Hi, > I need to offset a sibling match for an offset of X. Example: > > <elements> > <element item="1">APPLE</element> > <element item="2">ORANGE</element> > <element item="3">GRAPE</element> > <element item="4">WATERMELON</element> > <element item="5">CRANBERRY</element> > </elements> > > If the offset were 0, then the result would be "APPLE", if > the offse were 2, > then the result would be "ORANGE" -correction- [GRAPE]. > > The template is always applied in order of the item, but the > look up is > based on this offset value. > > So, the big challenge: if the current item was 5 and the > offset was 2, then > the result would be "ORANGE". > > Any ideas? Do you need more input? <xsl:variable name="count" select="count(../element)"/> <xsl:variable name="total-offset" select="@item + $offset"/> <xsl:value-of select="../element[$total-offset mod $count]"/> Cheers, Jarno
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] sum() function giving str, Arun Sinha | Thread | [xsl] Siblings, Karl Stubsjoen |
RE: [xsl] sum() function giving str, Arun Sinha | Date | RE: FW: [xsl] Siblings, Arun Sinha |
Month |