XTP (XML template pages) lets you ease into XML and XSLT (XML Stylesheet Tranformations). Your Serif pages can be almost identical to JSP pages and just use XSLT to eliminate repetitious error-prone patterns. XTP transforms XML or HTML documents into a XML or HTML output. In other words, it's an XML transformation. So each XTP page has four parts:
The easiest transformation is the identity transformation. The following stylesheet copies the input into the output.
Each contains a pattern and a . The match pattern is an expression. In the above example, the match pattern matches any element and any attribute. The replacement copies the current node and calls to recursively evaluate any children of the current node.You can put in the same directory as the xtp file, or you can put in WEB-INF/xsl, or you can put it in the classpath like WEB-INF/classes. The last option is useful if you want to create a jar of useful stylesheets and beans.Your XTP page may look something like:
The generated JSP is identical to the input, and the generated HTML just executes the JSP.
|