[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: RE : XPath position of character in element

Subject: RE: RE : XPath position of character in element
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 17 Apr 2002 17:34:52 +0300
character position in c
> 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.