On Tuesday, Nov 12, 2002, at 13:55 Europe/London, Alessio Sangalli wrote:

Jeremy Quinn wrote:

what I do to deal with this kind of thing is to have a menu.xml
structure, that is imported into all my pages via CInclude, then xslt
mh, I've never understood the difference between Xinclude and Cinclude...

Unfortunately (in 2.1) there are three (?) versions, CachingCIncludeTransformer, CIncludeTransformer and XIncludeTransformer. They all basically do the same job, but have different options.

The XInclude on uses the W3c XInclude standard tags and includes the XPointer syntax, the CInclude 'family' use Cocoon-specific tags.

(having been provided with the 'id' of the page via the sitemap) makes
two structures from the menu.xml, 1) my html navigation 2) the meta
links you mention.
yes, cool; I would like to prepare accurate documentation about the way my website was built. This could also be a useful how-to for cocoon newbies. If you want to contribute, I'd accept some pieces of code from your xsl-transformations...!
Well that is tricky, mine works with my data, I cannot guarantee this even works as it stands ........ my data is more complex than this, I hope the xslt below works properly with the simplified case, it is not tested!

My menus look something like this:

<menu>
<meta>
<title>A Menu</title>
<desc>this is a sample</desc>
</meta>
<title>Home Page</title>
<href>index</href>
<item>
<title>Page One</title>
<href>one/index</href>
</item>
<item>
<title>Page Two</title>
<href>two/index</href>
<item>
<title>Page Two/One</title>
<href>two/one</href>
</item>
<item>
<title>Page Two/Two</title>
<href>two/two</href>
</item>
</item>
etc ......
</menu>

This is my xslt for making <link/>s (in it's present design, it works on the <menu/> being the only content). This does not deal with the internal links within documents.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

<xsl:param name="res"/> <!-- 'res' param in the form "two/index" -->

<xsl:variable name="me" select="//*[href = $res]"/>
<xsl:variable name="mum" select="$me/parent::*"/>
<xsl:variable name="psibs" select="$me/preceding-sibling::item"/>
<xsl:variable name="fsibs" select="$me/following-sibling::item"/>
<xsl:variable name="kids" select="$me/item"/>

<xsl:template match="menu">
<xsl:for-each select="$mum">
<link href="{href}" title="{title}" rel="Up"/>
</xsl:for-each>
<xsl:for-each select="$psibs[1]">
<link href="{href}" title="{title}" rel="First"/>
</xsl:for-each>
<xsl:for-each select="$psibs[last()]">
<link href="{href}" title="{title}" rel="Prev"/>
</xsl:for-each>
<xsl:for-each select="$fsibs[1]">
<link href="{href}" title="{title}" rel="Next"/>
</xsl:for-each>
<xsl:for-each select="$fsibs[last()]">
<link href="{href}" title="{title}" rel="Last"/>
</xsl:for-each>
<xsl:for-each select="$psibs">
<link href="{href}" title="{title}" rel="Section"/>
</xsl:for-each>
<xsl:for-each select="$me[1]">
<link href="{href}" title="{title}" rel="Section"/>
</xsl:for-each>
<xsl:for-each select="$fsibs">
<link href="{href}" title="{title}" rel="Section"/>
</xsl:for-each>
<xsl:for-each select="$kids">
<link href="{href}" title="{title}" rel="SubSection"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


Hope this helps

regards Jeremy


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>



Reply via email to