|
Subject: [xsl] Was Tokenizing From: "Carsten Klein" <carstenklein@xxxxxxxx> Date: Mon, 15 Apr 2002 14:19:47 +0200 |
Well,
I have lost the thread locally and the thread did not make it into
the archives
yet, I hope the original author get this...
You asked about how to tokenize a string using
java.util.StringTokenizer,
and I presented you a elaborate yet complicated method to reach your
goal =)
But that's what you asked for in the first place...
Okay, back to the point, XPath and XQuery offer functions you may
use as well, namely xf:translate() and xf:normalize-space
If your source string is not too complex, and already is sort of
well-structured, as it
is if you use StringTokenizer to split the string, _and_ your
processor does support the basic string functions, you may use it as
well, in combination with any of the string normalization functions
to remove additional characters not needed for the tokenization.
e.g. your string contains
"User Michael, Nachname Müller, Status Geek, ..."
and you want to tokenize this to
"User Michael Nachname Müller Status Geek"
you may use the translate function to replace all occurences of ","
with " "
translate($string, ",", " ")
and then pass this directly to the recursive template I presented in
the earlier
article.
But this depends on the complexity of your input string. Using
StringTokenizer is not that complicated either, but since the
processor needs to compile this function of yours at least at the
first invocation of your stylesheet, the use of native functions may
leave you with better results considering performance.
Bye
Carsten
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] displaying only certain p, Michael Kay | Thread | [xsl] Binary image output from XSL, Venkatasubbaiah Chen |
| Re: [xsl] Re: Combining stylesheets, Daniel Brockman | Date | [xsl] Binary image output from XSL, Venkatasubbaiah Chen |
| Month |