You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by cr...@apache.org on 2002/06/18 14:47:18 UTC
cvs commit: xml-forrest/src/resources/skins/basic/xslt/html book2menu.xsl document2html.xsl site2xhtml.xsl tab2menu.xsl
crossley 2002/06/18 05:47:18
Modified: src/resources/skins/basic/xslt/html book2menu.xsl
document2html.xsl site2xhtml.xsl tab2menu.xsl
Log:
Fine-tune the basic skin. Trying to get really basic.
Revision Changes Path
1.2 +5 -6 xml-forrest/src/resources/skins/basic/xslt/html/book2menu.xsl
Index: book2menu.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/basic/xslt/html/book2menu.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- book2menu.xsl 29 May 2002 16:44:55 -0000 1.1
+++ book2menu.xsl 18 Jun 2002 12:47:18 -0000 1.2
@@ -11,22 +11,21 @@
</menu>
</xsl:template>
- <xsl:template match="project">
- </xsl:template>
-
+<!--
<xsl:template match="menu[position()=1]">
<xsl:apply-templates/>
</xsl:template>
+-->
<xsl:template match="menu">
- <br/><b><xsl:value-of select="@label"/></b> ;
+ <br/><b><xsl:value-of select="@label"/></b> 
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="menu-item">- 
<xsl:if test="not(@type) or @type!='hidden'">
<xsl:choose>
- <xsl:when test="@href=$resource">
+ <xsl:when test="starts-with(@href, $resource)">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:otherwise>
@@ -38,7 +37,7 @@
<xsl:template match="external">
<xsl:if test="not(@type) or @type!='hidden'"> -
- <a href="{@href}"><xsl:value-of select="@label"/></a> ;
+ <a href="{@href}" target="_blank"><xsl:value-of select="@label"/></a> 
</xsl:if>
</xsl:template>
1.2 +118 -226 xml-forrest/src/resources/skins/basic/xslt/html/document2html.xsl
Index: document2html.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/basic/xslt/html/document2html.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- document2html.xsl 29 May 2002 16:44:55 -0000 1.1
+++ document2html.xsl 18 Jun 2002 12:47:18 -0000 1.2
@@ -1,241 +1,133 @@
<?xml version="1.0"?>
-
-<xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
-
-<!-- ====================================================================== -->
-<!-- document section -->
-<!-- ====================================================================== -->
-
- <xsl:template match="/">
- <!-- checks if this is the included document to avoid neverending loop -->
- <xsl:if test="not(book)">
- <document>
- <xsl:choose>
- <xsl:when test="document/header/title">
- <title><xsl:value-of select="document/header/title"/></title>
- </xsl:when>
- <xsl:otherwise>
- <title>NO TITLE</title>
- </xsl:otherwise>
- </xsl:choose>
- <body>
- <xsl:apply-templates/>
- </body>
- </document>
- </xsl:if>
-
- <xsl:if test="book">
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!-- FIXME: still need to deal with all <header> elements
+ subtitle?, version?, type?, authors?, notice*, abstract?
+-->
+
+<!-- document -->
+ <xsl:template match="document">
+<!-- header -->
+ <div class="header">
+ <xsl:if test="normalize-space(header/title)!=''">
+ <h1>
+ <xsl:value-of select="header/title"/>
+ </h1>
+ </xsl:if>
+ <xsl:if test="normalize-space(header/subtitle)!=''">
+ <h3>
+ <xsl:value-of select="header/subtitle"/>
+ </h3>
+ </xsl:if>
+ </div>
<xsl:apply-templates/>
- </xsl:if>
</xsl:template>
-
-<!-- ====================================================================== -->
-<!-- header section -->
-<!-- ====================================================================== -->
-
- <xsl:template match="header">
- <!-- ignore on general document -->
- </xsl:template>
-
-<!-- ====================================================================== -->
-<!-- body section -->
-<!-- ====================================================================== -->
-
- <xsl:template match="section">
-
- <xsl:variable name = "level" select = "count(ancestor::section)+1" />
-
- <xsl:choose>
- <xsl:when test="$level=1">
- <h2><xsl:value-of select="@title"/></h2>
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:when test="$level=2">
- <h3><xsl:value-of select="@title"/></h3>
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:when test="$level=3">
- <h4><xsl:value-of select="@title"/></h4>
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:otherwise>
- <h5><xsl:value-of select="@title"/></h5>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:template>
-
-<!-- ====================================================================== -->
-<!-- footer section -->
-<!-- ====================================================================== -->
-
- <xsl:template match="footer">
- <!-- ignore on general documents -->
- </xsl:template>
-
-<!-- ====================================================================== -->
-<!-- paragraph section -->
-<!-- ====================================================================== -->
-
- <xsl:template match="p">
- <p><xsl:apply-templates/></p>
+<!-- body -->
+ <xsl:template match="body">
+ <div class="content">
+ <xsl:apply-templates/>
+ </div>
</xsl:template>
-
- <xsl:template match="note">
- <p><i><xsl:apply-templates/></i></p>
+<!-- section -->
+ <xsl:template match="section">
+ <xsl:variable name="level" select="count(ancestor::section)+1"/>
+ <xsl:if test="normalize-space(@id)!=''">
+ <a name="{@id}"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$level=1">
+ <h2><xsl:value-of select="title"/></h2>
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="$level=2">
+ <h3><xsl:value-of select="title"/></h3>
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="$level=3">
+ <h4><xsl:value-of select="title"/></h4>
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:otherwise>
+ <h5><xsl:value-of select="title"/></h5>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+<!-- others -->
+ <xsl:template match="note | warning | fixme">
+ <div class="frame {local-name()}">
+ <div class="label">
+ <xsl:choose>
+ <xsl:when test="local-name() = 'note'">Note</xsl:when>
+ <xsl:when test="local-name() = 'warning'">Warning</xsl:when>
+ <xsl:otherwise>Fixme (
+ <xsl:value-of select="@author"/>
+
+ )</xsl:otherwise>
+ </xsl:choose>
+ </div>
+ <div class="content">
+ <xsl:apply-templates/>
+ </div>
+ </div>
+ </xsl:template>
+ <xsl:template match="link">
+ <a href="{@href}">
+ <xsl:apply-templates/>
+ </a>
+ </xsl:template>
+ <xsl:template match="jump">
+ <a href="{@href}" target="_top">
+ <xsl:apply-templates/>
+ </a>
+ </xsl:template>
+ <xsl:template match="fork">
+ <a href="{@href}" target="_blank">
+ <xsl:apply-templates/>
+ </a>
</xsl:template>
-
<xsl:template match="source">
- <pre><xsl:apply-templates/></pre>
+ <pre class="code">
+ <xsl:apply-templates/>
+ </pre>
</xsl:template>
-
- <xsl:template match="fixme">
- <!-- ignore on documentation -->
+ <xsl:template match="anchor">
+ <a name="{@id}"/>
+ </xsl:template>
+ <xsl:template match="icon">
+ <img src="{@src}" alt="{@alt}">
+ <xsl:if test="@height">
+ <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@width">
+ <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
+ </xsl:if>
+ </img>
+ </xsl:template>
+ <xsl:template match="figure">
+ <div align="center">
+ <img src="{@src}" alt="{@alt}" class="figure">
+ <xsl:if test="@height">
+ <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@width">
+ <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
+ </xsl:if>
+ </img>
+ </div>
</xsl:template>
-
-<!-- ====================================================================== -->
-<!-- list section -->
-<!-- ====================================================================== -->
-
- <xsl:template match="ul|ol|dl">
- <blockquote>
- <xsl:copy>
- <xsl:apply-templates/>
- </xsl:copy>
- </blockquote>
- </xsl:template>
-
- <xsl:template match="li">
- <xsl:copy>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="sl">
- <ul>
- <xsl:apply-templates/>
- </ul>
- </xsl:template>
-
- <xsl:template match="dt">
- <li>
- <strong><xsl:value-of select="."/></strong>
- <xsl:text> - </xsl:text>
- <xsl:apply-templates select="dd"/>
- </li>
- </xsl:template>
-
-<!-- ====================================================================== -->
-<!-- table section -->
-<!-- ====================================================================== -->
-
<xsl:template match="table">
- <table>
- <caption><xsl:value-of select="caption"/></caption>
+ <table class="table" cellpadding="4" cellspacing="1">
<xsl:apply-templates/>
</table>
</xsl:template>
-
- <xsl:template match="tr">
- <tr><xsl:apply-templates/></tr>
+<!-- already used -->
+ <xsl:template match="section/title">
</xsl:template>
-
- <xsl:template match="th">
- <td colspan="{@colspan}" rowspan="{@rowspan}">
- <b><xsl:apply-templates/></b> 
- </td>
- </xsl:template>
-
- <xsl:template match="td">
- <td colspan="{@colspan}" rowspan="{@rowspan}">
- <xsl:apply-templates/> 
- </td>
- </xsl:template>
-
- <xsl:template match="tn">
- <td colspan="{@colspan}" rowspan="{@rowspan}">
-  
- </td>
- </xsl:template>
-
- <xsl:template match="caption">
- <!-- ignore since already used -->
+<!-- copy -->
+ <xsl:template match="node()|@*" priority="-1">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:apply-templates/>
+ </xsl:copy>
</xsl:template>
-
-<!-- ====================================================================== -->
-<!-- markup section -->
-<!-- ====================================================================== -->
-
- <xsl:template match="strong">
- <b><xsl:apply-templates/></b>
- </xsl:template>
-
- <xsl:template match="em">
- <i><xsl:apply-templates/></i>
- </xsl:template>
-
- <xsl:template match="code">
- <code><xsl:apply-templates/></code>
- </xsl:template>
-
-<!-- ====================================================================== -->
-<!-- images section -->
-<!-- ====================================================================== -->
-
- <xsl:template match="figure">
- <p>
- <xsl:choose>
- <xsl:when test="string(@width) and string(@height)">
- <img src="{@src}" alt="{@alt}" width="{@width}" height="{@height}"/>
- </xsl:when>
- <xsl:otherwise>
- <img src="{@src}" alt="{@alt}"/>
- </xsl:otherwise>
- </xsl:choose>
- </p>
- </xsl:template>
-
- <xsl:template match="img">
- <img src="{@src}" alt="{@alt}"/>
- </xsl:template>
-
- <xsl:template match="icon">
- <img src="{@src}" alt="{@alt}"/>
- </xsl:template>
-
-<!-- ====================================================================== -->
-<!-- links section -->
-<!-- ====================================================================== -->
-
- <xsl:template match="link">
- <a href="{@href}"><xsl:apply-templates/></a>
- </xsl:template>
-
- <xsl:template match="connect">
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="jump">
- <a href="{@href}#{@anchor}"><xsl:apply-templates/></a>
- </xsl:template>
-
- <xsl:template match="fork">
- <a href="{@href}" target="_blank"><xsl:apply-templates/></a>
- </xsl:template>
-
- <xsl:template match="anchor">
- <a name="{@id}"><xsl:comment>anchor</xsl:comment></a>
- </xsl:template>
-
-<!-- ====================================================================== -->
-<!-- specials section -->
-<!-- ====================================================================== -->
-
- <xsl:template match="br">
- <br/>
- </xsl:template>
-
</xsl:stylesheet>
1.3 +30 -18 xml-forrest/src/resources/skins/basic/xslt/html/site2xhtml.xsl
Index: site2xhtml.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/basic/xslt/html/site2xhtml.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- site2xhtml.xsl 3 Jun 2002 17:26:06 -0000 1.2
+++ site2xhtml.xsl 18 Jun 2002 12:47:18 -0000 1.3
@@ -1,28 +1,40 @@
<?xml version="1.0"?>
-<xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
-<xsl:template match="/">
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!-- FIXME: not yet dealing with <tabs>
+-->
+
+<xsl:template match="site">
<html>
<head>
- <title><xsl:value-of select="/site/document/title"/></title>
- <link rel="stylesheet" type="text/css" href="skin/style.css" />
+ <title><xsl:value-of select="div[@class='header']/h1"/></title>
+ <link rel="stylesheet" href="skin/style.css" type="text/css"/>
</head>
<body>
- <a href="@group-logo.href@"><img src="@group-logo.src@"/></a>
- <a href="@project-logo.href@"><img src="@project-logo.src@"/></a>
-
- <h1>
- <xsl:value-of select="/site/document/title"/>
- </h1>
-
- <hr/><xsl:copy-of select="/site/menu/node()|@*"/>
- <hr/><xsl:copy-of select="/site/document/body/node()|@*"/>
-
- <hr/><p><i>Copyright © @year@ @vendor@. All Rights Reserved.</i></p>
+ <p>
+ <a href="@group-logo.href@"><img src="@group-logo.src@" width="220" height="65" alt="@group-logo.alt@" /></a>
+ <a href="@project-logo.href@"><img src="@project-logo.src@" width="220" height="65" alt="@project-logo.alt@" /></a>
+ </p>
+ <h1><xsl:value-of select="div[@class='header']/h1"/></h1>
+<!--FIXME: what to do with the sub-heading -->
+ <h3><xsl:value-of select="div[@class='header']/h3"/></h3>
+ <p>
+ <xsl:copy-of select="menu/node()|@*"/>
+ </p>
+ <hr/>
+ <xsl:apply-templates select="div[@class='content']"/>
+ <hr/>
+ <p><i>Copyright © @year@ @vendor@. All Rights Reserved.</i></p>
<hr/>
</body>
</html>
-</xsl:template>
+ </xsl:template>
+
+ <xsl:template match="node()|@*" priority="-1">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
</xsl:stylesheet>
1.2 +4 -27 xml-forrest/src/resources/skins/basic/xslt/html/tab2menu.xsl
Index: tab2menu.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/basic/xslt/html/tab2menu.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tab2menu.xsl 7 Jun 2002 20:25:15 -0000 1.1
+++ tab2menu.xsl 18 Jun 2002 12:47:18 -0000 1.2
@@ -3,43 +3,20 @@
<xsl:param name="resource"/>
<xsl:template name="spacer">
- <td width="8">
- <img src="skin/images/spacer.gif" width="8" height="8" alt=""/>
- </td>
+ <td> | </td>
</xsl:template>
<xsl:template name="not-selected">
- <td valign="bottom">
- <table cellspacing="0" cellpadding="0" border="0" height="25" summary="non selected tab">
- <tr>
- <td bgcolor="#B2C4E0" width="5" valign="top"><img src="skin/images/tab-left.gif" alt="" width="5" height="5" /></td>
- <td bgcolor="#B2C4E0" valign="middle">
- <a href="/xml-forrest/{@dir}"><font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of select="@label"/></font></a>
- </td>
- <td bgcolor="#B2C4E0" width="5" valign="top"><img src="skin/images/tab-right.gif" alt="" width="5" height="5" />
- </td>
- </tr>
- </table>
- </td>
+ <td> <a href="/{@dir}"><xsl:value-of select="@label"/></a> </td>
</xsl:template>
<xsl:template name="selected">
- <td valign="bottom">
- <table cellspacing="0" cellpadding="0" border="0" height="30" summary="selected tab">
- <tr>
- <td bgcolor="#4C6C8F" width="5" valign="top"><img src="skin/images/tabSel-left.gif" alt="" width="5" height="5" /></td>
- <td bgcolor="#4C6C8F" valign="middle">
- <font face="Arial, Helvetica, Sans-serif" size="2" color="#ffffff"><b><xsl:value-of select="@label"/></b></font>
- </td>
- <td bgcolor="#4C6C8F" width="5" valign="top"><img src="skin/images/tabSel-right.gif" alt="" width="5" height="5" /></td>
- </tr>
- </table>
- </td>
+ <td> <b><xsl:value-of select="@label"/></b> </td>
</xsl:template>
<xsl:template match="tabs">
<div class="tab">
- <table cellspacing="0" cellpadding="0" border="0" summary="tab bar">
+ <table cellspacing="0" cellpadding="2" border="0" summary="tab bar">
<tr>
<xsl:apply-templates/>
</tr>