Re: How to embed Cform in larger web site layout

2006-02-01 Thread Peter . Neu
Hello Mark,

thanks for the thorough explenation of the problem. I'm still in the process
of making the transition from Struts to Cocoon. This a mighty 
change in terms of programming pradigms for me. I still have to get used
to writing more XSLT than Java and HTML Code. But I think things are now a
bit clearer. 

cheers,
Pete


-- 
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie


Re: How to embed Cform in larger web site layout

2006-01-31 Thread Mark Lundquist
Hi Peter,

On Jan 28, 2006, at 2:03 AM, [EMAIL PROTECTED] wrote:

I modeled a  cocoon form (based on the registration example in the docs)
which I would like to incoperate into a classic web site layout (header,
footer etc).

Right... we Do That All The Time™ :-)

When I have done all the cform transformations the form is already in html.

OK, as someone else has pointed out, your form is HTML in two distinct senses, (a) it is expressed in the HTML vocabulary, and (b) an HTML serialization has been created by the pipeline you show below:







As for (a), you will realize that the reason you have an XML document that uses HTML markup is that this comes from your JXTG template ("registration_template.xml"), and that if you don't want it to be HTML you can always write your template to generate some other kind of markup.  I am going to argue that you _do_ in fact want it to be HTML (in sense (a)), but the point is that nothing's forcing it to be that way.

As for (b), you just need to make sure that you wrap your "chrome" around the form before you invoke the serialization to HTML.  You do that with an XSLT that stylesheet converts the form template markup (HTML or whatever, see above and below!) into the final presentation HTML.
There are many ways to do this.  Most obviously, you could add another  for that XSLT to the pipeline shown above.  Better yet, you could have a common  that you would call at the end of the pipeline instead of serializing, and the resource comprises both the final transformation and the serialization, something like this (note, I write my sitemaps w/ a default namespace so that I don't have to write the 'map:' prefix all over the place):


	



and then instead of calling the serializer at the end of your forms pipeline, you say



... which you also call from other pipelines that serve your other content.

So it does already contain the  and  tags. Now I would like to
include the cform in a larger HTML document. But the problem is the cform is
already html so would have to write an XSLT Transformation which transforms
the HTML to another HTML document. This is clearly not a clean solution.

On the contrary, it's a very clean solution (remember we are talking about transforming HTML markup to HTML markup, not serialized HTML to... whatever).  You could invent your own little document language in XML, but why bother?  That's what HTML is for, and you already know HTML.  My sites typically have content that is written/generated in HTML that looks pretty much just like this:



A Fine Page This Is
 

Content, wonderful content.



and my site/page.xslt template turns that into something like this:



{... for stylesheets,   elements and all that crap, maybe some JS crap...}
FooBarCo, Inc. ::: A Fine Page This Is


{all kinds of layout/styling crap, masthead graphics, nav menus & whatever other "chrome" there may be}




So, you just write your form template to emit the same sort of simple, cut-down HTML as in the content example above, and then run it through the common styling template to get the chrome wrapped around it.

Finally, I recommend not talking and thinking in terms of HTML "fragments" :-).  Working with "fragments" is not a fundamental web programming task.  It's a specific idiom that is served by certain frameworks/languages.  When you are working with XSLT, the key thought is not "fragment" or "include", but "template". 

HTH,
—ml—


Re: How to embed Cform in larger web site layout

2006-01-29 Thread Andrew Timberlake

[EMAIL PROTECTED] wrote:
Thanks for the comments. So essentially I got this two options: 

1. Do a clean xhtml output of the cform pipeline 
2. Write a transformer that encapsulates the cform pipeline output.


The problem is that the cforms have their own custom transformer (xslt)
template which just outputs html. I wouldn't like to mess around with it in
order to keep things simple. 


Isn't there an easier way to do this? I mean working with html fragments is
one of the most basic web programming tasks. 


If there isn't how would I encapsulate my html output? A short code snippet
would help a lot. 


cheers,
Pete

  

Peter

The cform transformer outputs XML, not HTML. Although it may have the 
HTML,BODY etc elements, because it comes straight out of an XSLT 
process, it is XML.
You can therefore write a simple XSLT to strip the HTML and other 
elements you don't need to end with the fragment you need.


Andrew


Re: How to embed Cform in larger web site layout

2006-01-28 Thread Peter . Neu
Thanks for the comments. So essentially I got this two options: 

1. Do a clean xhtml output of the cform pipeline 
2. Write a transformer that encapsulates the cform pipeline output.

The problem is that the cforms have their own custom transformer (xslt)
template which just outputs html. I wouldn't like to mess around with it in
order to keep things simple. 

Isn't there an easier way to do this? I mean working with html fragments is
one of the most basic web programming tasks. 

If there isn't how would I encapsulate my html output? A short code snippet
would help a lot. 

cheers,
Pete

-- 
DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert:
GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl


Re: How to embed Cform in larger web site layout

2006-01-28 Thread Andrew Timberlake

[EMAIL PROTECTED] wrote:

Hello,

I alread posted this question in the user list and got no reply. So maybe
it's better to post the question here.

I modeled a  cocoon form (based on the registration example in the docs)
which I would like to incoperate into a classic web site layout (header,
footer etc).

When I have done all the cform transformations the form is already in html.







So it does already contain the  and  tags. Now I would like to
include the cform in a larger HTML document. But the problem is the cform is
already html so would have to write an XSLT Transformation which transforms
the HTML to another HTML document. This is clearly not a clean solution.  I
can't possible put the website layout into the cform template file this
would contradict the whole seperation on concerns concept.

So what is the right approach in this case?
 
Cheers,

Pete

  
Why not split the form generation into just generating an HTML fragment, 
add a transformer to wrap it in it's current HTML and then you have the 
fragment to insert into the other document


Andrew


Re: How to embed Cform in larger web site layout

2006-01-28 Thread Ralph Goers
This will work a lot better if you generate xhtml and serializing to xml 
in all your intermediate steps.  Only convert to html at the end of the 
main pipeline (if you really require html at all).


[EMAIL PROTECTED] wrote:


Hello,

I alread posted this question in the user list and got no reply. So maybe
it's better to post the question here.

I modeled a  cocoon form (based on the registration example in the docs)
which I would like to incoperate into a classic web site layout (header,
footer etc).

When I have done all the cform transformations the form is already in html.


   
   



So it does already contain the  and  tags. Now I would like to
include the cform in a larger HTML document. But the problem is the cform is
already html so would have to write an XSLT Transformation which transforms
the HTML to another HTML document. This is clearly not a clean solution.  I
can't possible put the website layout into the cform template file this
would contradict the whole seperation on concerns concept.

So what is the right approach in this case?

Cheers,
Pete