W3C home > Mailing lists > Public > xsl-editors@w3.org > April to June 1999

Re: Simple suggestion for XSLT

From: Laurent M. <laurent_m@hotmail.com>
Date: Sun, 9 May 1999 11:58:49 -0700
Message-ID: <19990509190049.79766.qmail@hotmail.com>
To: "James Clark" <jjc@jclark.com>
Cc: <xsl-editors@w3.org>, <xsl-list@mulberrytech.com>
> Why would this be useful given that
>
> substring-after(substring-after("1999/04/01", "/"), "/") returns "01"
>
> and
>
> substring-before(substring-after("1999/04/01", "/"), "/") returns "04"
>
> and
>
> concat(substring-before("1999/04/01", "/"),
>        "/",
>        substring-before(substring-after("1999/04/01", "/"), "/"))
> returns "1999/04"
>
> ?

Apologies for not having been clear the first time. I reused the date
example to make my description match the documentation, but I was really
trying to get to this:

"C:\some\thing\some\thing\some\thing\IdontKnowAnymoreTheDepthOfThePath\This
IsThePart.IAmLookingFor

I thought that a SINGLE

reverse-substring-after(stringAbove, "\")
     returns "ThisIsThePart.IAmLookingFor"

would be ELEGANT and fast.


This comes from a project I am working-on, where I have to generate n
individual HTML files from one single XML source. So I currently address
this with some java postprocessing on the tree before generating the output
files.
This is also how I addressed the requirement for "multiple output 'page' "
(as James Tauber said in message <371E999B.F2485B9A@jtauber.com>). So like
James, I pray that one mechanism can be developed.


Regards,
LaurentM

>
> "Laurent M." wrote:
> >
> > I don't know if it is worth a dime, but here it is:
> >
> > 6.2.5 Strings
> >
> > The functions substring-before() and substring-after() only work with
the
> > FIRST occurrence of the first argument, wouldn't it be interesting to
have
> > a symmetrical couple of functions working on the LAST occurrence.
> > Something like
> >
> > reverse-substring-before()
> > Returns the substring of the first argument that precedes the LAST
> > occurrence ...
> > ex: reverse-substring-before("1999/04/01", "/") returns "1999/04"
> >
> > and
> >
> > reverse-substring-after()
> > Returns the substring of the first argument that follows the LAST
> > occurrence ...
> > ex: reverse-substring-before("1999/04/01", "/") returns "01"
> >
> > I understand the functionality could be implemented using extension
> > functions, but a 'native' version would be available across all XSLT
> > implementations.
> >
> > What about also accessing the "04" (in "1999/04/01") ?
> >
> > Apologies if someone already made the same suggestion (I found no
evidence
> > of it the xsl-editors list).
> >
> > A good day to everyone, and a big kudos for the great work.
>
>
Received on Sunday, 9 May 1999 15:00:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:49 GMT