Hey Toby
From: "Rademacher Tobias" <[EMAIL PROTECTED]>
> Hi Folks,
>
> Mhm. I want' to write a small jelly script for maven, but I need to
evaluate
> if a string ends with a specfic extension. (it's a file name).
For a variable 'foo' you can do things like
${foo.substring(12)}
or
<j:if test="${foo.endsWith('sometext')}">
...
There's a current Jexl limitation which should hopefully go soon that dots
inside variable names confuse it. So if your variable is called "a.b.c" then
something like this would work around Jexl's current limitation...
<j:if test="${context.getVariable('a.b.c').endsWith('sometext')}">
...
Or you could just reassign your variable to one without dots...
<j:set var="foo" value="${a.b.c}"/>
<j:if test="${foo.endsWith('sometext')}">
...
> Unfortunally I cannt apply the substring method on a given variable.
> Would be cool if the expression would support XPath functions, so I could
> use the substring-after function.
XPath support is available in the XML tag library. So you could do
<x:if test="substring-after($a.b.c, 'sometext')">
...
or whatever other XPath expression you want to use...
> Any other idea to evaluate string in jelly other than '=='? How do I
concate
> string into a variable?
You can concatenate via expressions
<j:set var="foo" value="something${expr}something${expr}something"/>
Or you can use other nested tags and expressions to set the value.
<j:set var="foo">
some text
<j:if test="...">...</j:if>
etc
${whatever}
something else
</j:set>
James
-------
http://radio.weblogs.com/0112098/
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: <mailto:turbine-maven-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-maven-user-help@;jakarta.apache.org>