[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Re: Re: How to match a element + part of an immediate text sibling?

Subject: [xsl] Re: Re: How to match a element + part of an immediate text sibling?
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Wed, 14 Jan 2004 21:27:05 +0100

"Wendell Piez" <wapiez@xxxxxxxxxxxxxxxx> wrote in message
> At 04:59 AM 1/14/2004, Mike wrote:
> >...
> >Secondly, there is nothing in XSLT 1.0 that allows you to split a string
> >into its component words. You can do it yourself using a recursive
> >template (there are examples in my book XSLT Programmers Reference), or
> >you can use a vendor- or third-party extension function xx:tokenize().
> This may seem obvious and gratuitous (for which I apologize), but I hasten
> to add that this is only a *particular* notion of what a "word" is (a
> substring delimited by white space), which may not be robust enough for
> purposes. For example, if your input reads
> <p> the quick <em>brown</em> fox, ears up, jumps </p>
> you may want your output to read not
> <p> the <em>quick brown fox,</em> ears up, jumps </p>
> but
> <p> the <em>quick brown fox</em>, ears up, jumps </p>
> which will require a more sophisticated definition of the concept of a
> "word", and which will not be so tractable using basic substringing around
> whitespace (or a simple tokenize function either, FTM).
> This kind of thing is not impossible to work around in most real-world
> cases, but since XSLT 1.0 is not designed for up-conversion, it can get
> pretty hairy.

For such cases the usefulness of the "str-split-to-words" template from FXSL
has been well established.

 FXSL deals successfully with the "heariness" of most such problems.

Dimitre Novatchev.
FXSL developer

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread