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

RE: Remove text Up to Full Stop

Subject: RE: Remove text Up to Full Stop
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 22 Aug 2005 12:06:31 +0100
java string functions
> This is slightly off-topic, but does anyone know why there is no
> string function in XSL that does what the "last-index-of" Java String
> function does? (or is there one?) A recursive function seems rather
> slow for this kind of (common) operation.

The function library in XPath 1.0 was designed on minimalist principles: if
you could do something yourself, there was no need for another function.

XPath 2.0 support for regular expressions makes this kind of thing much
easier (and possibly more efficient, though I wouldn't guarantee it: there's
no intrinsic reason why recursion should be slow).

Michael Kay
http://www.saxonica.com/


> 
> Hans
> 
> On 8/22/05, David Carlisle <davidc@xxxxxxxxx> wrote:
> > 
> > > I have also noticed the hex - I use oxygen and it seems 
> to put in this hex
> > > in the strangest of places.
> > 
> > I think it's a microsoft-encoded left quote, whgich is OK 
> if you declare
> > a microsoft encoding in your xml (and xsl) files, and your 
> parser knows
> > that encoding. But it's not a lot of point posting fragments of xml
> > using that as if anyone tries to parse that using the default utf8
> > encoding tehy just get told the file is not well formed as 
> hex 85 isn't
> > a legal utf8 encoding of anything.
> > 
> > There are plenty of replace templates in the faq, something like
> > 
> > <xsl:template name="x">
> >  <xsl:param name="x" select="extract"/>
> >   <xsl:if test="contains($x,'.')">
> >   <xsl:value-of select="substring-before($x,'.')"/>
> >   <xsl:text>.</xsl:text>
> >   <xsl:call-template name="x">
> >    <xsl:with-param name="x" select="substring-after($x,'.')"/>
> >   </xsl:call-template>
> >  </xsl:if>
> > </xsl:template>
> > 
> > That discards everything after the the last . (and the 
> whole thing if
> > there isn't a ., so you just need to call that if there is a . in
> > extract. (untested)
> > 
> > David
> > 
> > 
> ______________________________________________________________
> __________
> > This e-mail has been scanned for all viruses by Star. The
> > service is powered by MessageLabs. For more information on 
> a proactive
> > anti-virus service working around the clock, around the 
> globe, visit:
> > http://www.star.net.uk
> > 
> ______________________________________________________________
> __________

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.