Hi stavros No, no - I completely understand your method. And it is solid too. I just happen to follow another method - going through the <head> <title> tag and than looking for content title. But than I stumbled across the namespace problem, and thought you or someone else might have an Idea. I understand the namespace is a delicate issue, and now looking harder to find the best namespace place for every declaration.
Thank you again for your explanations ! They help me tremendously to better understand Cocoon! Elad -----UrsprÃngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 12. April 2005 09:07 An: users@cocoon.apache.org Betreff: Re: AW: AW: AW: AW: AW: Design note - Building a template mechanism yOn Mon, 11 Apr 2005, Messing, Elad wrote: > Hello stavros > Thanks for the fast reply, just seen it.... > > I understand that not all is implemented, this is why I thought about > adding this functionality - and came to the problem of Xpath and namespaces. > > Also - I thought about the solution you offered in the Email first, >but it have the problem that every content page should define ><osm:title-copy/> tag. And I wanted to allow the default "home" >tag to remain if there is no "<osm:title-copy/>" in the content page. hi elad sorry if i was not so clear. you have to put <osm:title-copy/> only in your "theme" file (main.layout.xhtml) this tag get the title from your content page(/head/title/text()) and put it in the generated page if you want some logic doing this you can touch <xsl:template name="getTitle"> and put a xsl:if there to check if you will apply the titlte or not based in your contitions >This is why I chose the other solution - which deals with this scenario. >(see below). >But then I had some problems with the fact that the <head> tag had a >default name space. > > Is there a way around it ? I couldn't find the Xpath expression to > resolve the head tag.. What do you think ? > > Thanks > i dont have something specific in my mind, i have some namespace based problems in the past solved just puting in the rigth place the namespace declaration regards -stavros > Elad > > -----UrsprÎÎngliche Nachricht----- > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Gesendet: Freitag, 8. April 2005 19:10 > An: users@cocoon.apache.org > Betreff: Re: AW: AW: AW: AW: Design note - Building a template mechanism > > > > > hi elad > > i tell you again that i have not decide yet how many steps (tranformation) i > need to get the final stuff > > to get the title for the momend you have to touch > > > main.layout.xhtml: > ... > > <head> > <title> > <osm:title-copy/> > </title> > </head> > > ... > > > and > apply-layout.xsl: > here you must set instruction of you to handle <osm:title-copy/> > > > adding 2 match pattern: > ... > > <xsl:template match="osm:title-copy"> > <xsl:call-template name="getTitle"/> > </xsl:template> > > > <xsl:template name="getTitle"> > <xsl:apply-templates select="//osm:page-title/text()"/> > </xsl:template> > > > ... > > > another one point in sitemap that you have to fix is to add this > transformation > > <map:transform src="osml/core/load-layout.xsl"/> > > in > > <map:match pattern="xml/**.*"> > > so this match will lokk like the one above it (xml/*.*) > > > i will make a try to find some time to clean up the code in the next days > > > > On Fri, 8 Apr 2005, Messing, Elad wrote: > > > Hello stavros and all > > Stavros - I am continuing with my questions regarding your example. > > Currently, the title of each page is hard coded in the layout.xhtml > > file. (home). > > > > I was looking at a way to use the already present > > " > > <head> > > <title>website title</title> > > </head> > > " > > tag in the content files, and replace the title in the layout. > > > > What I did is to add to the "apply_layout.xsl" file this match : > > " > > <!-- if page-title is defined in the content page, I am using it to > > replace the HTML title--> > > <xsl:template match="head/title"> > > <xsl:choose> > > <xsl:when test="//osm:page-title"> > > <title><xsl:value-of > > select="//osm:page-title"/></title> > > </xsl:when> > > <xsl:otherwise> > > <title><xsl:apply-templates/></title> > > </xsl:otherwise> > > </xsl:choose> > > </xsl:template> > > " > > In order to - when going through the title - look if there is a > > specific title to use - and use it. > > > > However - I am having problems with this match '<xsl:template > > match="head/title">' . > > > > This is because of namespaces. In this phase of the transformation, the > > relevant XML looks like : > > " > > <?xml version="1.0" encoding="ISO-8859-1"?> <site><layout> > > > > <head xmlns="http://www.w3.org/1999/xhtml" > > xmlns:osm="http://osmosis.gr/osml/1.0" > > xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"> > > <title>Home</title> > > <meta http-equiv="Content-Style-Type" content="text/css"/> > > <META HTTP-EQUIV="Content-Type" CONTENT="text/html; > > charset=utf-8"/> > > > > <LINK HREF="layout-resources/styles/style.css" TYPE="text/css" > > REL="stylesheet"/> > > </head> > > " > > > > Because the 'aggregate' (in the sitemap.xml) removed the root element, > > the namespace moved to the next item - the "header" item - and the template > > match for "head/title" doesnÎÂÎâÂÎâÊt match. I am not an Xpath > > expert - But I think this is a default namespace problem. > > > > Do you know what Xpath expression I need to use here ? Or maybe this is > > the wrong way ? > > > > Thanks !! > > > > Elad > > > > > > -----UrsprÎâÎÂngliche Nachricht----- > > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Gesendet: Dienstag, 5. April 2005 14:20 > > An: users@cocoon.apache.org > > Betreff: Re: AW: AW: AW: Design note - Building a template mechanism > > > > On Tue, 5 Apr 2005, Elad Messing wrote: > > > > > Hi again. > > > I have added the fixes. I am not sure that they are all correct, as I > > > am quite a newbie.. They do however make it work :) > > > Feel free to remove what is not needed. > > > > > > Hope it will help somebody someday - like it helped me.. > > > > > > Elad > > > > thnx > > > > i'll post the link for the demo site in this thread afternoon > > > > > > > > --stavros > > > > > > > > > > > -----UrsprÎÂÎâÂÎÂÎÂngliche Nachricht----- > > > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Gesendet: Dienstag, 5. April 2005 13:26 > > > An: users@cocoon.apache.org > > > Betreff: Re: AW: AW: Design note - Building a template mechanism > > > > > > On Tue, 5 Apr 2005, Elad Messing wrote: > > > > > > > I understand. > > > > So - I would very much like to learn the new implementation ! A demo > > > > site could be great ! > > > > > > > > In Parallel - I am going through the example in the wiki and finding > > > > some errors in code. What do you think about me adding the fixes to > > > > make the example work by copy paste ? Is it needed ? > > > > > > > > Elad > > > > > > > > > > > > > your comments/fixes are welcome > > > > > > :-) > > > > > > > > > > -----UrsprÎÂÎÂÎâÎâÂÎÂÎÂÎâÎÂngliche Nachricht----- > > > > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > > Gesendet: Dienstag, 5. April 2005 12:22 > > > > An: users@cocoon.apache.org > > > > Betreff: Re: AW: Design note - Building a template mechanism > > > > > > > > On Tue, 5 Apr 2005, Elad Messing wrote: > > > > > > > > > Hello Stavros and all > > > > > Thanks for the reply. I think I understand the usage of it as > > > > > you explained in the "TemplateBasedWebSite" wiki page. > > > > > I also found the Othello example in the Scratchpad. > > > > > > > > > > Currently I am studying the wiki example, trying to build the > > > > > same in my environment. > > > > > > > > > > Do you think the wiki example is still valid today, or you > > > > > would have done this in a different way in Cocoon 2.1.7 ? This > > > > > is actually my question :) > > > > > > > > > > Thanks > > > > > > > > > > Elad > > > > > > > > > > > > > the idea described in wiki is the same, the impementation has > > > > changed > > > > > > > > (more features, cleaner code etc) > > > > > > > > > > > > > > > > > > > > > > > > > > > -----UrsprÎÂÎÂÎâÎÂÎÂÎââÎâÎÂngliche Nachricht----- > > > > > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > > > Gesendet: Dienstag, 5. April 2005 11:38 > > > > > An: users@cocoon.apache.org > > > > > Betreff: Re: Design note - Building a template mechanism > > > > > > > > > > > > > > > hi elad > > > > > > > > > > i'm using this approach to create static web static web sites the > > > > > goals are: > > > > > - yu have one layout file (.xhtml). then i get the content form > > > > > each request (requested web page) and put it inside this layout > > > > > (now i'm close to have pages (web requests) that make an > > > > > exception and use an alternative > > > > > layout) > > > > > > > > > > - you can define blocks with static content (html fragments) > > > > > that can be reused in any page > > > > > > > > > > - you can define your own elements that are translated to > > > > > complex html > > > > > > > > > > - there is a simple html 2 pdf transformation, so you are able > > > > > to server content pages as simple pdfs > > > > > > > > > > - you can change the theme for your site > > > > > > > > > > all this out of the box without to touch the sitemap.xmap > > > > > > > > > > there is a sample in cocoon sample /scratchpad called Othello > > > > > than demostrate all this but it's quite old > > > > > > > > > > i have a new version with many modification but i dont have > > > > > found time to make a pacth in bugzilla > > > > > > > > > > if you want i can pack my working directory with some demo site > > > > > to take a look > > > > > > > > > > > > > > > regards > > > > > -stavros > > > > > On Tue, 5 Apr 2005, Elad Messing wrote: > > > > > > > > > > > Hello All ! > > > > > > I am now in the design phase of the web-application I am > > > > > > working on. > > > > > > The application will have a fixed structure - header, footer, > > > > > > content in the middle, and menu on the side - and I am looking > > > > > > for the > > > > > best > > > > > > practice to build this template mechanism in Cocoon. > > > > > > > > > > > > I have found in the wiki this page > > > > > > :http://wiki.apache.org/cocoon/TemplateBasedWebSite but - It > > > > > > is from > > > > > 10.2003 > > > > > > - and mention working with version 2.0.4. > > > > > > I was wondering whether this is still a best practice or > > > > > > maybe a new better feature allows for another practice - which is > > > > > > better. > > > > > > (might be > > > > > that > > > > > > the Xinclude is involved ? Not sure).. > > > > > > > > > > > > Thanks in advance. > > > > > > > > > > > > Elad Messing > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------- > > > > > ---- > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > ---------------------------------------------------------------- > > > > > ---- > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------ > > > > --- To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > ------------------------------------------------------------------ > > > > --- To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > -------------------------------------------------------------------- > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]