Introduction
This tutorial is intended to teach Velocity for use with Hannon Hill's Cascade Server CMS. This is a mirror of the content found at the W3Schools XSLT tutorial to be a side by side learning tool for moving from XSLT to Velocity. All examples use this xml data file - cdcatalog.xml
Velocity or Velocity Script is a language for transforming XML documents into XHTML documents or to other XML documents.
XPath is a language for navigating in XML documents.
What You Should Already Know
Before you continue you should have a basic understanding of the following:
- HTML / XHTML
- XML / XML Namespaces
- XPath
If you want to study these subjects first, find the tutorials on the W3Schools Home page.
What is Velocity?
- See the Velocity definition used in the Apache Veloctiy User's Guide
- Velocity transforms an XML document into another XML document or XHTML
- Velocity uses XPath to navigate in XML documents
- Hannon Hill has extended Velocity Script with some Velocity Tools available in Cascade.
Velocity Uses XPath
Velocity uses XPath to find information in an XML document. XPath is used to navigate through elements and attributes in XML documents.
If you want to study XPath first, please read the W3Schools XPath Tutorial.
How Does it Work?
In the transformation process, Velocity uses XPath to traverse parts of a source document that should match one or more predefined templates and mixes in scritping to produce an XML or XHTML output.
Resources
- Velocity: The Basics: Scripting with a $ here and a # to do [Kindle Edition] by James "Jamie" Arthur Johnson
- Velocity: The Basics: Scripting with a $ here and a # to do [Google Play] by James "Jamie" Arthur Johnson