[stringtemplate-interest] stripping newlines in attributes..

Kay Roepke kroepke at classdump.org
Sat Oct 14 05:30:46 PDT 2006


Hi Robert!

On 14. Oct 2006, at 1:22 Uhr, Robert Hill wrote:

> Does <strip(attr)> work?

strip is for stripping null values in lists, not newlines. I don't  
think ST will ever support anything like
newline stripping.
strip() is most useful for use with length(), which gives you the  
length of a multivalued attribute,
but length counts nulls, too. So if you want the length without  
counting nulls, you strip it before applying length.

> I get a runtime error of
> I've tried various forms and placements, but I only ever seem to  
> get the
> error below :(
>
> Exception in thread "main" java.lang.IllegalArgumentException:  
> Can't find
> template strip.st; context is [select anonymous]
> 	at
> org.antlr.stringtemplate.StringTemplateGroup.lookupTemplate 
> (StringTemplateGr
> oup.java:485)

strip is a function implemented in Java, not a template. This error  
indicates that your version of ST
doesn't support the strip function yet. It came in in a late 2.3b  
version, 3.0 definitely has it.
Which version are you using?

HTH,
-k



More information about the stringtemplate-interest mailing list