Hi Charles,

>Hello List!
>     Has anyone figured out a good way to generate breadcrumb navigation
>links using XSL and Cocoon?  Like the ones at the top of Yahoo! pages. 
>We plan on doing this and I don't want to reinvent the wheel.  I'd
>rather not do it with sessions or cookies . . .

I included the breadcrumb stylesheet and the sitemap that I use for
cocooncenter.org. It's not documented, but maybe it helps.

Greetings,
Andreas



>
>Charles
>
>
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
>To unsubscribe, e-mail: <[EMAIL PROTECTED]>
>For additional commands, e-mail: <[EMAIL PROTECTED]>


<?xml version="1.0"?>

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

<xsl:param name="base-path"/>
<xsl:param name="document-root"/>
<xsl:param name="uri"/>
  
<xsl:template name="breadcrumb">
  
<!--  <img src="{$base-path}/images/breadcrumb-arrow.gif"/>&#160;&#160; -->
  <xsl:if test="$uri != 'home/index.html'">
    <a href="{$base-path}/documents/home/index.html">Home</a>
  </xsl:if>
  <xsl:call-template name="breadcrumb-section">
    <xsl:with-param name="uri-before" select="'/'"/>
    <xsl:with-param name="uri-remaining" select="$uri"/>
  </xsl:call-template>
</xsl:template>

<xsl:template name="breadcrumb-section">
  <xsl:param name="title"/>
  <xsl:param name="uri-before"/>    <!-- starting with / -->
  <xsl:param name="uri-remaining"/> <!-- not starting with / -->
  
  <xsl:variable name="uri-current" select="substring-before($uri-remaining, '/')"/>
  <xsl:variable name="uri-next" select="substring-after($uri-remaining, '/')"/>
  
  <xsl:variable name="document-uri" select="concat(
        $document-root,
        $uri-before,
        $uri-current, '/', 'index.xml'
  )"/>
  <xsl:if test="$uri != 'home/index.html'">
    &#160;<img src="{$base-path}/images/breadcrumb-arrow.gif"/>&#160;
  </xsl:if>

  <xsl:choose>
    <xsl:when test="contains($uri-next, '/')">

      <a href="{$base-path}/documents{$uri-before}{$uri-current}/index.html">
        <xsl:value-of select="document($document-uri)/document/header/title"/>
      </a>
      <xsl:call-template name="breadcrumb-section">
        <xsl:with-param name="uri-before" select="concat($uri-before, $uri-current, '/')"/>
        <xsl:with-param name="uri-remaining" select="$uri-next"/>
      </xsl:call-template>
      
    </xsl:when>
    
    <xsl:otherwise>
      <strong>
        <xsl:value-of select="document($document-uri)/document/header/title"/>
      </strong>
    </xsl:otherwise>
    
  </xsl:choose>
  
</xsl:template>

</xsl:stylesheet>
<?xml version="1.0"?>

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

<xsl:param name="base-path"/>
<xsl:param name="document-root"/>
<xsl:param name="uri"/>
  
<xsl:template name="breadcrumb">
  
<!--  <img src="{$base-path}/images/breadcrumb-arrow.gif"/>&#160;&#160; -->
  <xsl:if test="$uri != 'home/index.html'">
    <a href="{$base-path}/documents/home/index.html">Home</a>
  </xsl:if>
  <xsl:call-template name="breadcrumb-section">
    <xsl:with-param name="uri-before" select="'/'"/>
    <xsl:with-param name="uri-remaining" select="$uri"/>
  </xsl:call-template>
</xsl:template>

<xsl:template name="breadcrumb-section">
  <xsl:param name="title"/>
  <xsl:param name="uri-before"/>    <!-- starting with / -->
  <xsl:param name="uri-remaining"/> <!-- not starting with / -->
  
  <xsl:variable name="uri-current" select="substring-before($uri-remaining, '/')"/>
  <xsl:variable name="uri-next" select="substring-after($uri-remaining, '/')"/>
  
  <xsl:variable name="document-uri" select="concat(
        $document-root,
        $uri-before,
        $uri-current, '/', 'index.xml'
  )"/>
  <xsl:if test="$uri != 'home/index.html'">
    &#160;<img src="{$base-path}/images/breadcrumb-arrow.gif"/>&#160;
  </xsl:if>

  <xsl:choose>
    <xsl:when test="contains($uri-next, '/')">

      <a href="{$base-path}/documents{$uri-before}{$uri-current}/index.html">
        <xsl:value-of select="document($document-uri)/document/header/title"/>
      </a>
      <xsl:call-template name="breadcrumb-section">
        <xsl:with-param name="uri-before" select="concat($uri-before, $uri-current, '/')"/>
        <xsl:with-param name="uri-remaining" select="$uri-next"/>
      </xsl:call-template>
      
    </xsl:when>
    
    <xsl:otherwise>
      <strong>
        <xsl:value-of select="document($document-uri)/document/header/title"/>
      </strong>
    </xsl:otherwise>
    
  </xsl:choose>
  
</xsl:template>

</xsl:stylesheet>
<?xml version="1.0"?>

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

<xsl:import href="mainmenu.xsl"/>
<xsl:import href="breadcrumb.xsl"/>
<xsl:import href="document.xsl"/>
<xsl:import href="menu.xsl"/>
<xsl:import href="comment.xsl"/>

<xsl:param name="base-path"/>
<xsl:param name="text"/>
  
<xsl:template match="/">
  <html>
    <head>
      <xsl:if test="document/header/title">
        <title>cocooncenter - Your Guide to Apache Cocoon</title>
<!--        <title>cocooncenter - <xsl:value-of select="document/header/title"/></title> -->
		    <meta name="keywords" content="Apache, Cocoon, Apache Cocoon, Forum, Tutorial, Tutorials, FAQ, Howto, how-to, XML, XSLT, Content Management, CMS, XSL, Discussion"/>
      </xsl:if>
  		<link rel="stylesheet" href="{$base-path}/css/default.css"/>
    </head>
<!--    <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0"> -->
<!--    <body leftmargin="20" marginwidth="20" topmargin="20" marginheight="20"> -->
    <body leftmargin="10" marginwidth="10" topmargin="0" marginheight="0">

<table border="0" cellpadding="10" cellspacing="0" width="100%" bgcolor="White">
	<tr>
		<td>

<!-- =========================== -->
          <table border="0" cellpadding="0" cellspacing="0" width="100%">
						<tr>
							<td width="91">
							  <img border="0" height="10" width="10" src="{$base-path}/images/trans1x1.gif"/>
							  <img src="{$base-path}/images/cocoon_02_top.jpg" width="81" height="85" border="0"/>
							</td>
							<td valign="bottom">
								<table width="100%" cellspacing="0" cellpadding="0" border="0">
									<tr>
										<td valign="bottom">
										  <a href="{$base-path}/documents/home/index.html">
										    <img src="{$base-path}/images/logo_11.gif" width="190" height="27" border="0"/>
										  </a>
										</td>
										<td align="right" valign="bottom">
<!-- -->
                      <xsl:call-template name="main-menu"/>
										</td>
										<td><img border="0" height="5" width="20" src="{$base-path}/images/trans1x1.gif"/></td>
									</tr>
								</table>
								<table width="100%" cellspacing="0" cellpadding="0" border="0">
									<tr>
										<td valign="bottom" align="center">
										  <img border="0" height="5" width="1" src="{$base-path}/images/trans1x1.gif"/>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>

					<table bgcolor="Gold" width="100%" cellspacing="0" cellpadding="0" border="0">
						<tr>
							<td align="left">
					<table cellspacing="0" cellpadding="0" border="0">
						<tr>
							<td valign="bottom" align="left" width="91">
							  <img border="0" height="10" width="10" src="{$base-path}/images/trans1x1.gif"/>
							  <img src="{$base-path}/images/cocoon_02_bottom.jpg" width="81" height="30" border="0"/>
							</td>
							<td valign="middle" align="left">
							  <font color="Red" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">
							    <b><i>You are here:</i></b>
							    </font><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">
				          &#160;<xsl:call-template name="breadcrumb"/></font>
				      </td>
						</tr>
					</table>
				      </td>
						</tr>
					</table>
<!-- =========================== -->

<!--    <xsl:value-of select="$text"/> -->
<!--
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
		  <tr>
		    <td valign="bottom">
		      <a href="{$base-path}/documents/home/index.html">
		      <img src="{$base-path}/images/logo_01.gif" hspace="20" vspace="5" border="0"/>
		      </a>
		    </td>
		    <td align="right"><xsl:call-template name="main-menu"/></td>
		    <td><img src="{$base-path}/images/trans1x1.gif" width="20" height="5" border="0"/></td>
		  </tr>
    </table>
    
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td align="center" valign="bottom">
				<img src="{$base-path}/images/trans1x1.gif" width="1" height="5" border="0"/>
				</td>
			</tr>
		</table>

		<table border="0" cellpadding="5" cellspacing="0" width="100%" bgcolor="Gold">
			<tr>
				<td align="left" valign="bottom">
				  <font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" color="Red">
				    <b><i>&#160;You are here:</i></b>
				  </font>
				  <font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">
				    &#160;<xsl:call-template name="breadcrumb"/>
				  </font>
				</td>
			</tr>
		</table>

-->
	
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td align="center" valign="bottom">
				  <img src="{$base-path}/images/trans1x1.gif" width="1" height="10" border="0"/>
				</td>
			</tr>
		</table>

		
		<!-- ==================================== -->
		<!-- main table -->
		<!-- ==================================== -->
		<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
		  <tr>
		  
    		<!-- ==================================== -->
    		<!-- menu -->
    		<!-- ==================================== -->
		    <td width="170" valign="top">
		      <table width="100%" border="0" cellpadding="0" cellspacing="0">
		        <tr><td>
    		      <xsl:call-template name="local-menu"/>
		          <br/><img src="{$base-path}/images/trans1x1.gif" width="150" height="1" border="0"/>
            </td></tr>
		      </table>
		    </td>

        <td><img width="10" src="{$base-path}/images/trans1x1.gif"/></td>
        <td width="1" background="{$base-path}/images/line_background.gif">
          <img width="1" src="{$base-path}/images/trans1x1.gif"/>
        </td>
        <td><img width="10" src="{$base-path}/images/trans1x1.gif"/></td>
		    <td valign="top">
		      <table width="100%" border="0" cellpadding="10" cellspacing="0">
		        <tr><td>
              <xsl:apply-templates/>
            </td></tr>
		      </table>
        </td>
      </tr>
    </table>
    
<!--
</td></tr></table>    
</td></tr></table>    
-->    
</td></tr></table>    
    
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>

Attachment: sitemap.xmap
Description: Binary data

Attachment: sitemap.xmap
Description: Binary data

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

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

Reply via email to