Subject: Re: [xsl] select first word From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Tue, 18 Dec 2007 18:11:36 +0100 |
Abel Braaksma wrote:
<xsl:value-of select="
translate(
substring-before(
substring-before(.,' '), ', '),
$from, $to)" />
If I am right (if I remember correctly) the input doesn't always have space or comma. So I would use the following instead (or the result could be empty):
translate(replace(., '([^, ]+).*', '$1'), $from, $to)
<!-- include comma, which is not matched, thus it will be deleted --> <xsl:variable name="from" select="'abcdehijklmnorstuvyz{|HIJKA@,'" /> <xsl:variable name="to" select="'aaaaaeeeeiiiioooooEEEEAA'" />
<!-- without space --> <xsl:template match="le"> <xsl:value-of select="translate(., $from, $to)" /> </xsl:template>
Cheers, -- Abel Braaksma
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] select first word, Florent Georges | Thread | RE: [xsl] select first word, Scott Trenda |
Re: [xsl] select first word, Florent Georges | Date | RE: [xsl] select first word, Scott Trenda |
Month |