#csuc09 - Cascade Conference, New: Velocity Template Language Enhancements, 9/28/2009
Ross Williams, Services Trainer, Hannon Hill. “New: Velocity Template Language Enhancements.” Described new features added to Velocity in Cascade Service v. 6.2+
Velocity Template Language (VTL)
New Enhancements in Cascade Server 6.2+
More Velocity/Java Strings
String Tool
- Just like XSLT
set ( $original = “Three Blind Mice” )
foreach ( $word in $original.split (”p{space}) )
if ( $word.endsWith() )
$word.toUpperCase().concat(””)
#else
$word.concat(” “)
#end
#… // we’re going to need these slides
XPath Tool
- New way:
- #set ($sidebarItems – $_XPathTool.selectNodes($contentRoot, ‘calling-page/system-page/system-data-structure/sidebar/module’)))
*Old way: - #set ($sidebarItems = $contentRoot .getChild (‘calling-page’) .(‘system-page’)…)
- #set ($sidebarItems – $_XPathTool.selectNodes($contentRoot, ‘calling-page/system-page/system-data-structure/sidebar/module’)))
Serializer Tool
Sort Tool
Date Tool
That’s it for the slides, now Ross will share practical examples…
Velocity code is displayed inline (footer shown on example site)—no additional syntax displayed.
Example shown, page with data definition with repeating sections. Example shown uses sort and serializer tool. Simple script, only about ten lines long. As a script, it runs from top to bottom.
// Link to the Knowledge Base on Velocity/Script Formats
http://www.hannonhill.com/kb/Script-Formats/#velocity-tools
Velocity works really well for looping and reiterating.
User question: Velocity had issues with special characters (like ampersands)
Answer: Ross believes the ampersand issue has been fixed, but not sure if all the character escaping has been fixed—some may still be needed.
Ross says this is a good thing to bring up at the developer roundtable tomorrow
User question: does Velocity support an include function for other Velocity formts
Answer: as of 6.2 the answer is likely no (didn’t know)
…
Stopping notes—slides, done, examples shown. A bit over my head.
