forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin <>
Subject Re: skinconf text elements in group.svg
Date Thu, 07 Apr 2005 18:21:26 GMT

Ross Gardler wrote:

> Kevin wrote:
>> Kevin wrote:
>>> Thorsten Scherler wrote:
>>>> Hi Kevin,
>>>> Rick commited some code to make
>>>> forrest/trunk/main/webapp/resources/stylesheets/project2text.xsl more
>>>> generic.
>>> Thank you for your help. I'll look at how project2text.xsl is
>>> called so I understand things correctly. I appreciate your ideas
>>> below and will use the new svn version.
>>> Kevin.
>>>> If you make an svn up your problem may be already solved. ;-)
>>>> Changing the stopping color may be easier to change directly in the
>>>> *.svg code.
> ...
>> I have looked at project2text.xsl and if I understand right it
>> outputs the values of document (skinconf.xml) children not all
>> descendants?
> It does work on all descendants because of the copyover import at the 
> head of the file.

Hi Ross,

I will have to look at that again. I was trying to access
skinconf.xml child elements eg. group-svg/font:

     <text>KEG Group</text>

     <text>Work Project</text>

But anyway with your help below and this being my second attempt
to understand xmaps I have implemented another way of generating
project and group logos along the lines of the corner images.

In resources.xmap

1) New pipeline match:
        <map:match pattern="images/**.png">
             <map:select type="exists">

                   <map:call resource="pipe-svg2png-logo-resource">
                     <map:parameter name="path" 
value="{forrest:context}/skins/common/images/{1}.svg.xslt" />
                     <map:parameter name="logo" value="{1}" />

                <map:when test="{project:content.xdocs}/images/{1}.svg">

Look for a custom whateverlogo.svg.xslt at the moment group.svg.xslt
and project.svg.xslt are the same as they generate the same (drop
shadow effect + gradient) logo.

2) New resource:
      <map:resource name="pipe-svg2png-logo-resource">
         <map:generate src="cocoon://skinconf.xml" />
         <map:transform src="{path}">
           <map:parameter name="logo" value="{logo}"/>
         <map:serialize type="svg2png" />

3) The logo parameter passed to the xslt will be used to get to
the correct skinconf element and child elements etc.

eg. skinconf/project-svg/font

then substitute elements or attributes in the generated svg.

Is there a performance hit doing it this way, opposed to the
project2txt.xsl and aggregate way if I get that working?

Anyway Ross thanks for your input. I finally got to understand
a couple of resource.xmap generations and did one of my own :)
Well with a lot of borrowing!


>> Also I am confused to how project2text.xsl works. I understand
>> the xml file is group.svg and transformed with project2text.xsl
>> replacing <for:element /> in the svg somehow with elements from
>> another xml ie. skinconf.xml possibly after it's own transform
>> with skin and common skinconf.xsl files. It's this:
>> <xsl:variable name="config" select="//skinconfig"/>
>> how does it hook into the <skinconf> tree. "//skinconfig" means
>> all "skinconfig" descendants of the document element? I'm wrong
>> in my understanding :
> The control for all generation is in our *.xmap file in 
> FORREST_HOME/main/webapp.
> If you search the xmap files for occurrences of project2text.xsl you 
> will see a series of matches in resources.xmap. As you get used to how 
> forrest works you will learn where these files are used. The 
> resources.xmap file is used to process requests for resources such as 
> graphics, scripts and CSS.
> Anyway, looking at where project2text.xsl is used in resources.xmap you 
> see a few of pipelines like this:
>       <map:resource name="pipe-aggregate-svg2png-resource">
>          <map:call resource="generate-aggregate-resource">
>            <map:parameter name="path" value="{path}" />
>          </map:call>
>          <map:call resource="transform-project2text"/>
>          <map:transform src="{forrest:stylesheets}/extract-svg.xsl"/>
>          <map:serialize type="svg2png" />
>       </map:resource>
> The two resources in this pipleline are:
>       <map:resource name="generate-aggregate-resource">
>         <map:aggregate element="resource">
>           <map:part src="cocoon://skinconf.xml" />
>           <map:part src="{path}"/>
>         </map:aggregate>
>       </map:resource>
> and:
>       <map:resource name="transform-project2text">
>          <map:transform src="{forrest:stylesheets}/project2text.xsl"/>
>       </map:resource>
> So we can now see that the above pipeline does the following:
> - aggregate skinconf.xml and another document indicated by the path 
> variable.
> - transform it using project2text.xsl
> - serialise it using the svg2png serialiser
> (if you don't understand how this works you need to learn about Cocoon 
> xmap files there are some links to documentation at 
> )
> So, to get answer your question of "how does <xsl:variable name="config" 
> select="//skinconfig"/> it into the <skinconf> tree. " You were right 
> that "//skinconfig" means all skinconfig elements in the document, but I 
> suspect you did not realise that skinconf.xml is aggregate with the 
> document you are processing before the stylesheet gets to work.
> Ross

View raw message