Well it's not the utterly coherent prose of your blog articles but it definitely helps :)
I think I just want to use a different presentation XSLT depending where you are in the site hierarchy. It's not so much about the navigation, though that may come up.
Do you have an example of how you match where you are in the hierarchy. I'm still wrapping my head around XPath. Everytime I think I understand it, I see something new that makes me scratch my head.
Yikes, sorry about that Sean. Perhaps I was half-asleep when I wrote it? Hmm, perhaps I was doing something else? Ah well, let's try this again.
OK, so hopefully the homepage thing is clear, but let's try a quick example. Here's the default pipeline:
<map:pipeline>
<!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
<map:match pattern="lenyabody-*/*/*/*/**">
<map:aggregate element="cmsbody">
<map:part src="cocoon://navigation/{2}/{3}/breadcrumb/{5}.xml"/>
<map:part src="cocoon://navigation/{2}/{3}/tabs/{5}.xml"/>
<map:part src="cocoon://navigation/{2}/{3}/menu/{5}.xml"/>
<map:part src="cocoon://navigation/{2}/{3}/search/{5}.xml"/>
<map:part src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}"/ >
</map:aggregate>
<map:transform src="xslt/page2xhtml-{4}.xsl">
<map:parameter name="root" value="{page-envelope:context-prefix}/{2}/{3}"/>
<map:parameter name="url" value="{5}"/>
<map:parameter name="document-id" value="{page-envelope:document-id}"/>
<map:parameter name="document-type" value="{page-envelope:document-type}"/>
</map:transform>
<map:select type="parameter">
<map:parameter name="parameter-selector-test" value="{1}"/>
<map:when test="view">
<map:transform type="link-rewrite"/>
</map:when>
</map:select>
<map:serialize type="xml"/>
</map:match>
</map:pipeline>
OK, so, the 4th asterisk in the match is for doctypes. Well, by default, a doctype is assigned to the home page of the default publication. So, see the transform part? It uses the doctype as part of the filename for the XSLT file you should use. So, in this case, you would modify the file pubname/xslt/page2xhtml-homepage.xsl to whatever you need for the layout of the home page. Right now, all that file does is import the main page2xhtml.xsl file, but you can change it to whatever you want.
So, onto the secondary vs. tertiary navigation. Here's what I do (sorta - some details have been changed to protect my stupidity):
In page2xhtml.xsl, I add this in the XSLT file:
... some stuff up here ...
<xsl:template match="cmsbody">
<html>
<head>
<meta content="Apache Lenya" name="generator"/>
<title><xsl:value-of select="//lenya:meta/dc:title"/></title><xsl:apply-templates select="xhtml:link"/>
</head>
<body>... more stuff down here ...
So, basically, I removed the default call to the stylesheet and replaced it with a call to a file under pubname/lenya/xslt/navigation/ which generates the link statement for me. That's part 1. Part 2 of the process means creating that file pubname/lenya/xslt/navigation/style.xsl (let's just call it that for fun). Then, in the file, I have the following:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:nav="http://apache.org/cocoon/lenya/navigation/1.0"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="nav"
><xsl:template match="nav:site"> <style type="text/css" media="screen">
<xsl:for-each select="//nav:node">
<!-- loop through all nodes and find the current one, and when you do,
check to see if there is any navigation below that -->
<xsl:if test="@current = 'true'">
<!-- we found it, now does it have any descendants? -->
<xsl:choose>
<xsl:when test="((descendant::nav:node) and (parent::nav:node) and (count(child::nav:[EMAIL PROTECTED] = 'true']) > 0)) or ((descendant::nav:node) and (@visibleinnav = 'false') and (count(child::nav:[EMAIL PROTECTED] = 'true']) > 0))">
<link rel="stylesheet" type="text/css" href="/css/tertiary.css" media="all" />
</xsl:when>
<xsl:otherwise>
<link rel="stylesheet" type="text/css" href="/css/secondary.css" media="all" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
So walking through this quickly, (I can't claim this is good programming, by the way, but it does work), I loop through all nodes and test each one to see if it is current. If it is, then I test to see if there are any descendants. Basically, my test is:
Group 1:
1. If you have descendants, and
2. If you have a parent, and
3. If the number of children for this node whose visibility in the navigation is not hidden is greater than 0, or
Group 2:
1. If you have descendants, and
2. If the current node is not visible, and
3. If the number of children for this node whose visibility in the navigation is not hidden is greater than 0, then
I will display the stylesheet for the tertiary layout. Otherwise, I can just use the secondary layout stylesheet. You might have to think about why I did what I did on the second group of checks. Use the Future students section of http://www.hiram.edu to see how the tertiary navigation appears on the right side. So, maybe this will help out even more, or make things worse.
Jon
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
