forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin <forr...@kegcl.demon.co.uk>
Subject New user of views.
Date Wed, 07 Sep 2005 17:12:09 GMT
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

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. 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. I noticed the new pelt view uses
alternative stylesheets (which will look good with some javascript to
switch between :) Though I haven't tried adding a <forrest:css> to
a fv and check what happens.

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?

<!--
  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>

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. 

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.

Kevin





Mime
View raw message