forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject Re: New user of views.
Date Wed, 07 Sep 2005 18:24:14 GMT
On Wed, 2005-09-07 at 18:12 +0100, Kevin wrote:
> Hi,
> 
> I've dipped my toe in the water using views and thought I'd ask
> here before raising a jira. Also this is my first thread on dev
> as a user so please bear with me.
> 
> 1) Following instructions:
> 
> forrest/whiteboard/plugins/org.apache.forrest.plugin.internal.view/build/site/howItWork.html
> RESUME part b)
> ...
> copy the default.fv
> from the viewHelper implementation to your ${project.conf-dir}
> 
> I found it should go in
> src/documentation/content/xdocs
> 

That documentation is not actual anymore. We changed it a while ago.
Sorry for that confusion instruction, we are in the middle of
refactoring the view prototype. 

You will need to place it in your xdocs-dir.

Please follow
http://forrest.apache.org/docs_0_80/howto/howto-view-dsl.html
instead.


> 2) Next I wanted to use my own css in that fv using <forrest:css> so
> in my xdocs/default.fv
> 
> <forrest:views xmlns:forrest="http://apache.org/forrest/templates/1.0" >
>     <forrest:view type="xhtml">
>         <forrest:css url="default.css"/>
>         <forrest:css url="nav-main-hook.css"/>
> ...
> 
> (I had successfuly implemented my own nav-main contract implementation)
> 
> forrest site
> 
> Will produce *.html with stylesheets with different titled <link>
> elements:
> 
> <link href="skin/default.css" title="default.css" rel="stylesheet"
> type="text/css" />
> <link href="skin/nav-main-hook.css" title="nav-main-hook.css" rel="stylesheet" type="text/css"
/>
> 
> So my nav-main-hook.css won't cascade.

What do you mean?

>  I've used @title before with
> alternative stylesheets. So to get it to work I removed the @title. Or
> ensure they have the same name.

Actually I reckon that is a bug, I am not sure, that part is new. 

>  I noticed the new pelt view uses
> alternative stylesheets (which will look good with some javascript to
> switch between :) 

:) Yeah should be simple to write a contract for that. ;-)

> Though I haven't tried adding a <forrest:css> to
> a fv and check what happens.

¿? Your example above has forrest:css in the default.fv.

> 
> 3) How I see contracts at the moment are an override method of hooking
> into leather-dev xslt. A well defined interface but to what resolution
> can you go without knowing the internals? To explain what I mean, below
> is the addition to my custom nav-main.ft. If I wanted to get to the <a>
> element and define class="my-base-selected" it looks as if I'd have to
> borrow more from the leather-dev skin to get calculate-tab-href?
> 

The menu part is created from the book2menu.xsl of leather-dev, the tab
part of tab2menu.xsl. We are in the middle of refactoring that as well.
Anyway you will have to pick up what comes out of this transformation
and apply your custom transformation to it.

> <!--
>   Get rid of <ul> and <li> inline children and just leave <a> to style.
>   HTML output like:
> 
>   <div id="tabs">
>     <div id="nav-main">
>       <a class="base-not-selected" href="tab1.html">Tab 1</a>
>       <a class="base-selected" href="tab2.html">Tab 2</a>
>     </div>
>   </div>
> -->
> <xsl:template match="ul[@id='nav-main']">
> <div id="nav-main">
>   <xsl:apply-templates select="li"/>
> </div>
> </xsl:template>
> 
> <xsl:template match="li[@class='current']">
> <a class="base-selected">
>       <xsl:attribute name="href">
>       <!--
>         Need calculate-tab-href? How did param $path get here?
>         <xsl:call-template name="calculate-tab-href">
>           <xsl:with-param name="tab" select="."/>
>           <xsl:with-param name="path" select="$path"/>
>         </xsl:call-template>
>       -->
>         <xsl:value-of select="$path"/>
>       </xsl:attribute>
>       <xsl:value-of select="."/>
> </a>
> </xsl:template>
> 
> <xsl:template match="li[not(@class)]">
>   <xsl:apply-templates/>
> </xsl:template>

Looks good. Yes, views are still heavily borrow stuff from the skins.
$path is in one of the imports that happens in the background.

> 
> At the moment the first match="li[@class='current']" works but probably
> by luck as I have no subdirs. I'd be interested in the correct way or
> am I off track. Anyway I don't need to do this it is just an exercise.
> 
> I just do <xsl:apply-templates/> as in the second match and let the
> leather-dev xsl work it out. 
> 

Hmm, actually leather-dev is before view comes into place. Views is
simply overriding the stuff from leather. You can see the page that is
coming in as input by using the *.page extension. That is plain xml and
actually the document that then get transformed by views.

try localhost:8888/index.page

> Thinking about it I'd just need to override class="base-selected" etc.
> in css.
> 
> Well that was more than a toe in the water as I first thought :) Let me
> know if there are any valid points to raise a jira [1 & 2] above. 3 is
> just a workshop for me as a beginner in views and xsl too.
> 

:)

Welcome to views.

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Mime
View raw message