You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@jakarta.apache.org by di...@apache.org on 2002/01/23 03:41:50 UTC

cvs commit: jakarta-site2/xdocs/stylesheets site.xsl

dion        02/01/22 18:41:50

  Modified:    xdocs/stylesheets site.xsl
  Log:
  Fixed url handling so that it supported relative (e.g. "index.html"),
  absolute (e.g. "http://jakarta.apache.org/commons/") or
  site ("/site/tags.html")
  
  Revision  Changes    Path
  1.3       +12 -6     jakarta-site2/xdocs/stylesheets/site.xsl
  
  Index: site.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-site2/xdocs/stylesheets/site.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- site.xsl	4 Jan 2002 12:38:37 -0000	1.2
  +++ site.xsl	23 Jan 2002 02:41:50 -0000	1.3
  @@ -6,10 +6,6 @@
   
   <!-- Outstanding Compatibility Issues (with Anakia-based stylesheets):
   
  -* Calculation of the hyperlink for navigation menu items (site.xsl prefixes
  -  with relative path unconditionally; needs conditional logic like the
  -  "projectanchor" macro).
  -
   * Handling of the <image> element to insert relative path prefixes
   
   * Special table formatting of the <table>, <tr>, and <td> tags.  (I don't
  @@ -21,7 +17,7 @@
   -->
   
   
  -<!-- $Id: site.xsl,v 1.2 2002/01/04 12:38:37 husted Exp $ -->
  +<!-- $Id: site.xsl,v 1.3 2002/01/23 02:41:50 dion Exp $ -->
   
   <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     version="1.0">
  @@ -155,7 +151,17 @@
     <!-- Process a menu item for the navigation bar -->
     <xsl:template match="item">
       <xsl:variable name="href">
  -      <xsl:value-of select="$relative-path"/><xsl:value-of select="@href"/>
  +      <xsl:choose>
  +            <xsl:when test="starts-with(@href, 'http://')">
  +                <xsl:value-of select="@href"/>
  +            </xsl:when>
  +            <xsl:when test="starts-with(@href, '/site')">
  +                <xsl:text>http://jakarta.apache.org</xsl:text><xsl:value-of select="@href"/>
  +            </xsl:when>
  +            <xsl:otherwise>
  +                <xsl:value-of select="$relative-path"/><xsl:value-of select="@href"/>
  +            </xsl:otherwise>    
  +      </xsl:choose>
       </xsl:variable>
       <li><a href="{$href}"><xsl:value-of select="@name"/></a></li>
     </xsl:template>
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>