I would like to create a TemplateTransformer that is immenently easier
for designers to use than for them to learn XSLT. This is so that we
can leverage our current investment in standard web site design products.
There are a couple of issues. It is easy to embed includes, but it is
much more difficult to reference the incomming SAX stream as it is
comming in.
The way it would work is you place your XHTML in a file, and you have
a namespace to tell when the XHTML wants elements from the input SAX
stream. It would be something as simple as this:
<template:body/>
The TemplateTransformer would specify its information like this:
<map:transform type="template" src="site.xhtml">
<map:parameter name="title" value="xpath:/document/head/title"/>
<map:parameter name="menu" value="cocoon://menu.xml"/>
</map:transform>
For an example of what happens, let me declare a simple XHTML template:
<html>
<head>
<title><template:title/></title>
</head>
<body>
<h1><template:title/></h1>
<table>
<tr>
<td><template:menu/></td>
<td><template:body/></td>
</tr>
</table>
<body>
</html>
As you can see, <template:body/> has a specific predefined meaning
(the SAX stream). The other <template:foo/> elements have a meaning
defined in parameters. The major thing is resolving an xpath on the
incomming SAX stream. I really only want to support simple XPATH
expressions that refer to elements or attributes--but I want to do
it in a performant manner.
Does anyone have any suggestions? I was thinking about caching the
SAX stream until I found the value(s) I needed and then begin serializing
SAX events. However, I don't really like this approach unless I can
serialize once I know I have the XPATH expressions I need.
S/MIME Cryptographic Signature