This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE : RE : XPath position of character in element
- From: "Nicolas Mazziotta" <Nicolas dot Mazziotta at ulg dot ac dot be>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 17 Apr 2002 16:42:26 +0200
- Subject: RE : RE : [xsl] XPath position of character in element
- Reply-to: xsl-list at lists dot mulberrytech dot com
thank you.
> -----Message d'origine-----
> De : owner-xsl-list@lists.mulberrytech.com [mailto:owner-xsl-
> list@lists.mulberrytech.com] De la part de Jarno.Elovirta@nokia.com
> Envoyé : mercredi 17 avril 2002 16:35
> À : xsl-list@lists.mulberrytech.com
> Objet : RE: RE : [xsl] XPath position of character in element
>
> > I was not accurate enough:
> >
> > what in
> >
> > <tag>eabcdefg</tag>, the positions of e is 1 and 6.
> >
> > and
> >
> > <tag>eab<tag2>cdef<tag2>g</tag>, the positions of e in <tag>
> > is 1 and 6?
>
> Why didn't you say you needed multiple positions in the first place?
>
> <xsl:template match="/" name="p">
> <xsl:param name="s" select="tag" />
> <xsl:param name="c" select="'e'" />
> <xsl:param name="i" select="1" />
>
> <xsl:choose>
> <xsl:when test="contains($s, $c)">
> <xsl:variable name="_i"
select="string-length(substring-before($s,
> $c)) + $i" />
> <xsl:value-of select="$_i" /><xsl:text> </xsl:text>
> <xsl:call-template name="p">
> <xsl:with-param name="s" select="substring-after($s, $c)" />
> <xsl:with-param name="c" select="$c" />
> <xsl:with-param name="i" select="$_i + 1" />
> </xsl:call-template>
> </xsl:when>
> <xsl:otherwise>
>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
>
> Cheers,
>
> Santtu
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list