You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Berin Loritsch <bl...@apache.org> on 2001/07/10 16:35:43 UTC

A TemplateTransformer

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.

Re: A TemplateTransformer

Posted by Davanum Srinivas <di...@yahoo.com>.
There was a thread on XML-DEV. Here's a summary:
http://www.xml.com/pub/a/2001/03/07/xpathapi.html

Thanks,
dims

--- Berin Loritsch <bl...@apache.org> wrote:
> 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.

> ATTACHMENT part 2 application/x-pkcs7-signature name=smime.p7s



=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org