You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Sten Aksel Heien <sa...@objectnet.no> on 2004/04/13 14:27:35 UTC

Generating site.xml and tabs.xml

Hi,

I am hoping to generate the site.xml and tabs.xml  files dynamically by 
transforming from another xml source file.

Can this be done by editing some xmap files?

- sam


Re: Generating site.xml and tabs.xml

Posted by Ross Gardler <rg...@apache.org>.
Sten Aksel Heien wrote:
> I am hoping to generate the site.xml and tabs.xml  files dynamically by 
> transforming from another xml source file.

I currently have a woring skin that does this. It generates from IMS 
Manifests (Learning Objects if you are not familiar with it).

This actually works really well and provides a GUI editor for site.xml 
and tab.xml becasue we can use Learning Object management systems. I 
intend to propose its includion in Forrest when I have time to do the 
integration work (a couple of weeks away at least, busy polishing a 
delivery).

In the meantime here is the relevant changes in sitemap.xmap:

<map:match pattern="**tab-*.html">
   <map:select type="exists">
     <map:when test="{project:content.xdocs}tabs.xml">
       <map:generate src="{project:content.xdocs}tabs.xml" />
     </map:when>
     <map:otherwise>
       <map:generate src="{project:content.xdocs}imsmanifest.xml" />
       <map:transform 
src="{project:resources.stylesheets}/imsmanifest2tabs.xsl"/>
     </map:otherwise>
    </map:select>

    <map:transform type="linkrewriter" src="cocoon:/{1}linkmap-{2}.html"/>
    <map:call resource="skinit">
      <map:parameter name="type" value="tab2menu"/>
      <map:parameter name="path" value="{1}{2}.html"/>
    </map:call>
  </map:match>

What this does is, if there is a tabs.xml file present it uses that, if 
not it assumes there is an imsmanifest available and uses that to 
generate the tabs.xml file.

You also need to change menu.xmap as follows:

<map:match pattern="abs-menulinks">
   <map:select type="exists">
     <map:when test="{project:content.xdocs}site.xml">
       <map:generate src="{project:content.xdocs}site.xml" />
     </map:when>
     <map:when test="{project:content.xdocs}imsmanifest.xml">
       <map:generate src="{project:content.xdocs}imsmanifest.xml" />
       <map:transform 
src="{project:resources.stylesheets}/imsmanifest2site.xsl" />
       <map:serialize type="xml"/>
     </map:when>

     <map:transform src="{forrest:stylesheets}/absolutize-linkmap.xsl" />
     <map:transform 
src="{forrest:stylesheets}/site2site-normalizetabs.xsl" />
     <map:serialize type="xml"/>
   </map:select>
</map:match>


and...


<map:match pattern="**menulinks-*">

   <map:select type="exists">
     <map:when test="{project:content.xdocs}site.xml">
       <map:generate src="{project:content.xdocs}site.xml" />
       <map:transform src="{forrest:stylesheets}/absolutize-linkmap.xsl" />
     </map:when>
     <map:when test="{project:content.xdocs}imsmanifest.xml">
       <map:generate src="{project:content.xdocs}imsmanifest.xml" />
       <map:transform 
src="{project:resources.stylesheets}/imsmanifest2site.xsl" />
       <map:transform src="{forrest:stylesheets}/absolutize-linkmap.xsl" />
     </map:when>
   </map:select>


Any problems, let me know.

Ross


Re: Generating site.xml and tabs.xml

Posted by Ross Gardler <rg...@apache.org>.
Juan Jose Pablos wrote:
>> Can this be done by editing some xmap files?
> 
> 
> I guess so. Forward the xml source, and we will see what can we do about 
> it. The ideal situation is to generalize so it can be used in other 
> situations.

See my other post with modifications needed for this. Not totally 
general at this point as it requires and IMS manifest file.

How would you recomend generalising it? I am thinking along these lines:

Have a property in skinconf.xml to capture the name of the file to use 
as the source. Assume there is a pair of XSL shets in the skin to do 
necessary conversions (xxxx2site.xsl and xxxx2tabs.xsl).

If the property is empty then default to using site.xml and tabs.xml.

What do you think?

Ross


Re: Generating site.xml and tabs.xml

Posted by Sten Aksel Heien <sa...@objectnet.no>.
Juan Jose Pablos wrote:

> Sam,
>
>> I am hoping to generate the site.xml and tabs.xml  files dynamically 
>> by transforming from another xml source file.
>
>
> What type of xml source file? RDF?

It's just one xml file (a XCBL ProductCatalog file), and I have the xslt 
files (xcbl-products2site.xsl and xcbl-products2tabs.xsl

>
>
>>
>> Can this be done by editing some xmap files?
>
>
> I guess so. Forward the xml source, and we will see what can we do 
> about it. The ideal situation is to generalize so it can be used in 
> other situations.
>
> Cheers,
> Cheche

I guess many have edited some of the xmap files to dynamically generate 
the site.xml and tabs.xml  files from a database or another xml source. 
I just need some hints: should I modify sitemap.xmap or aggregate.xmap 
or linkmap.xmap ... or forrest.xmap ?
- sam



Re: Generating site.xml and tabs.xml

Posted by Juan Jose Pablos <ch...@che-che.com>.
Sam,

> I am hoping to generate the site.xml and tabs.xml  files dynamically by 
> transforming from another xml source file.

What type of xml source file? RDF?


> 
> Can this be done by editing some xmap files?

I guess so. Forward the xml source, and we will see what can we do about 
it. The ideal situation is to generalize so it can be used in other 
situations.

Cheers,
Cheche