Thread: [OpenE-dev] [cvs] opene/src/doc/style website.xsl
Status: Alpha
Brought to you by:
dblevins
From: David B. <dav...@vi...> - 2002-04-23 16:45:42
|
Added: src/doc/style website.xsl Log: XSLT for website By David Blevins, on 02d/02/04 23:09:45 Revision Changes Path 1.1 opene/src/doc/style/website.xsl Index: website.xsl =================================================================== <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" > <xsl:output method="html" indent="no"/> <xsl:include href="leftNav.xsl"/> <xsl:include href="keywords.xsl"/> <!-- Template for document --> <xsl:template match="/"> <xsl:variable name="project" select="document('../project.xml')/project"/> <html> <head> <xsl:apply-templates select="keywords"/> <!-- Place the Title --> <xsl:choose> <xsl:when test="/document/properties/title"> <title> <xsl:value-of select="/document/properties/title"/> <xsl:if test="/document/properties/sub-title"> -- <xsl:value-of select="/document/properties/sub-title"/> </xsl:if> </title> </xsl:when> <xsl:when test="/document/body/title"> <title><xsl:value-of select="/document/body/title"/></title> </xsl:when> <xsl:otherwise> <title><xsl:value-of select="$project/title"/></title> </xsl:otherwise> </xsl:choose> <!-- Link to the CSS --> <xsl:choose> <xsl:when test="/document/properties/style"> <xsl:element name="link"> <xsl:attribute name="rel">stylesheet</xsl:attribute> <xsl:attribute name="href"><xsl:value-of select="/document/properties/style"/></xsl:attribute> </xsl:element> </xsl:when> <xsl:otherwise> <link rel="stylesheet" href="default.css"/> </xsl:otherwise> </xsl:choose> </head> <body background="./images/Back003-14-1.gif" bgcolor="#ffffff" link="#6763a9" vlink="#6763a9" topmargin="0" bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0"> <a name="top"/> <table border="0" cellpadding="0" cellspacing="0" width="738"> <tr> <td valign="top" align="left" width="120"> <img src="./images/top-01.gif" width="120" height="185" border="0"/></td> <td valign="top" align="left" width="150"> <img src="./images/top-02.gif" width="150" height="185" border="0"/></td> <td valign="top" align="left" width="468"> <table border="0" cellpadding="0" cellspacing="0" width="468" height="185"> <tr> <td valign="top" align="left" width="468" height="60"> <A HREF="http://www.titan-books.net"> <img src="./images/titan_ad.gif" width="468" height="60" border="0"/> </A> </td> </tr> <tr> <td valign="top" align="left" width="468"> <img src="./images/top-03.gif" width="468" height="125" border="0"/> </td> </tr> </table> </td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="738"> <tr> <td rowspan="2" valign="top" width="20" align="left"> <img src="./images/dotTrans.gif" width="20" height="10" border="0"/> </td> <td valign="top" align="left" width="95"> <xsl:apply-templates select="$project/navSections"/> </td> <td rowspan="2" width="7" height="5" bgcolor="#C09EFE" valign="top" align="left"> </td> <!-- Main content window --> <td valign="top" align="left" width="616"> <table border="0"> <!-- First row is header information --> <tr> <td width="46" valign="top" align="left"> </td> <td width="490" valign="bottom"> <!-- Page title --> <xsl:choose> <xsl:when test="/document/body/title"> <span class="pageTitle"><xsl:value-of select="/document/body/title"/></span><br/> </xsl:when> <xsl:when test="/document/properties/title"> <span class="pageTitle"><xsl:value-of select="/document/properties/title"/></span><br/> <xsl:if test="/document/properties/sub-title"> <span class="pageSubTitle"><xsl:value-of select="/document/properties/sub-title"/></span><br/> </xsl:if> </xsl:when> </xsl:choose> <!-- Author Information --> <xsl:if test="/document/properties/author"> <p> <span class="author">by <xsl:value-of select="/document/properties/author"/></span><br/> </p> </xsl:if> <xsl:if test="document/body/header"> <br/> <xsl:apply-templates select="document/body/header"/> </xsl:if> </td> <td width="80" valign="top" align="left"> </td> </tr> <!-- Second row is body --> <tr> <td width="46" valign="top" align="left"> </td> <td width="490" height="5" valign="top" align="left"> <xsl:apply-templates select="document/body/mailing-list"/> <!-- build the page navigation first, section by section --> <xsl:choose> <xsl:if test="document[@toc='none']"></xsl:if> <xsl:if test="document[@toc='numeric']"> <xsl:for-each select="//section"> <span class="toc"> <xsl:choose> <xsl:if test="@ref-id"> <xsl:variable name="level" select="count(ancestor::*)"/> <xsl:choose> <xsl:when test='$level=2'> <a href="#{@ref-id}"> <xsl:number count="//section" format="1.1" /> <img src="images/dotTrans.gif" width="5" height="1" border="0"/> <xsl:value-of select="@title"/> </a><br/> </xsl:when> <xsl:when test='$level=3'> <img src="images/dotTrans.gif" width="15" height="1" border="0"/> <a href="#{@ref-id}"> <xsl:number count="//section" level="multiple" format="1.1" /> <img src="images/dotTrans.gif" width="5" height="1" border="0"/> <xsl:value-of select="@title"/> </a><br/> </xsl:when> <xsl:when test='$level=4'> <img src="images/dotTrans.gif" width="30" height="1" border="0"/> <a href="#{@ref-id}"> <xsl:number count="//section" level="multiple" format="1.1" /> <img src="images/dotTrans.gif" width="5" height="1" border="0"/> <xsl:value-of select="@title"/> </a><br/> </xsl:when> <xsl:otherwise> <img src="images/dotTrans.gif" width="45" height="1" border="0"/> <a href="#{@ref-id}"> <xsl:number count="//section" level="multiple" format="1.1" /> <img src="images/dotTrans.gif" width="5" height="1" border="0"/> <xsl:value-of select="@title"/> </a><br/> </xsl:otherwise> </xsl:choose> </xsl:if> <xsl:otherwise> <xsl:variable name="level" select="count(ancestor::*)"/> <xsl:choose> <xsl:when test='$level=2'> <a href="#{@title}"> <xsl:number count="//section" format="1" /> <img src="images/dotTrans.gif" width="5" height="1" border="0"/> <xsl:value-of select="@title"/> </a><br/> </xsl:when> <xsl:when test='$level=3'> <img src="images/dotTrans.gif" width="15" height="1" border="0"/> <a href="#{@title}"> <xsl:number count="//section" format="1" /> <img src="images/dotTrans.gif" width="5" height="1" border="0"/> <xsl:value-of select="@title"/> </a><br/> </xsl:when> <xsl:when test='$level=4'> <img src="images/dotTrans.gif" width="30" height="1" border="0"/> <a href="#{@title}"> <xsl:number count="//section" format="1" /> <img src="images/dotTrans.gif" width="5" height="1" border="0"/> <xsl:value-of select="@title"/> </a><br/> </xsl:when> <xsl:otherwise> <img src="images/dotTrans.gif" width="45" height="1" border="0"/> <a href="#{@title}"> <xsl:number count="//section" format="1" /> <img src="images/dotTrans.gif" width="5" height="1" border="0"/> <xsl:value-of select="@title"/> </a><br/> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </span> </xsl:for-each> </xsl:if> <xsl:otherwise> <xsl:for-each select=".//section"> <span class="toc"> <xsl:choose> <xsl:if test="@ref-id"> <xsl:variable name="level" select="count(ancestor::*)"/> <xsl:choose> <xsl:when test='$level=2'> <a href="#{@ref-id}"><xsl:value-of select="@title"/></a><br/> </xsl:when> <xsl:when test='$level=3'> <img src="images/dotTrans.gif" width="15" height="1" border="0"/> <a href="#{@ref-id}"><xsl:value-of select="@title"/></a><br/> </xsl:when> <xsl:when test='$level=4'> <img src="images/dotTrans.gif" width="30" height="1" border="0"/> <a href="#{@ref-id}"><xsl:value-of select="@title"/></a><br/> </xsl:when> <xsl:otherwise> <img src="images/dotTrans.gif" width="45" height="1" border="0"/> <a href="#{@ref-id}"><xsl:value-of select="@title"/></a><br/> </xsl:otherwise> </xsl:choose> </xsl:if> <xsl:otherwise> <xsl:variable name="level" select="count(ancestor::*)"/> <xsl:choose> <xsl:when test='$level=2'> <a href="#{@title}"><xsl:value-of select="@title"/></a><br/> </xsl:when> <xsl:when test='$level=3'> <img src="images/dotTrans.gif" width="15" height="1" border="0"/> <a href="#{@title}"><xsl:value-of select="@title"/></a><br/> </xsl:when> <xsl:when test='$level=4'> <img src="images/dotTrans.gif" width="30" height="1" border="0"/> <a href="#{@title}"><xsl:value-of select="@title"/></a><br/> </xsl:when> <xsl:otherwise> <img src="images/dotTrans.gif" width="45" height="1" border="0"/> <a href="#{@title}"><xsl:value-of select="@title"/></a><br/> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </span> </xsl:for-each> </xsl:otherwise> </xsl:choose> <br/> <!-- now show the sections themselves --> <xsl:apply-templates select="document/body/section"/> <!-- extra row --> </td> <td width="80" valign="top" align="left"> </td> </tr> <tr> <td width="46" valign="top" align="left"> </td> <td width="490" height="5" valign="top" align="left"> <br/><br/> <img src="images/line_light.gif" border="0" width="430" height="3" /><br/> <p/> <span class="bodyGrey"> <xsl:for-each select="$project/notice"> <small><xsl:copy-of select="."/><br/> <br/></small> </xsl:for-each> </span> <p/>   </td> <td width="80" valign="top" align="left"> </td> </tr> </table> </td></tr></table> </body> </html> </xsl:template> <!-- Templates for sections and headers --> <xsl:template match="document//section"> <xsl:variable name="level" select="count(ancestor::*)"/> <xsl:choose> <xsl:when test='$level=2'> <xsl:choose> <xsl:if test="@ref-id"> <a name="{@ref-id}"> <h2><xsl:value-of select="@title"/></h2></a> </xsl:if> <xsl:otherwise> <a name="{@title}"> <h2><xsl:value-of select="@title"/></h2></a> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test='$level=3'> <xsl:choose> <xsl:if test="@ref-id"> <a name="{@ref-id}"> <h3><xsl:value-of select="@title"/></h3></a> </xsl:if> <xsl:otherwise> <a name="{@title}"> <h3><xsl:value-of select="@title"/></h3></a> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test='$level=4'> <xsl:choose> <xsl:if test="@ref-id"> <a name="{@ref-id}"> <h4><xsl:value-of select="@title"/></h4></a> </xsl:if> <xsl:otherwise> <a name="{@title}"> <h4><xsl:value-of select="@title"/></h4></a> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test='$level=5'> <xsl:choose> <xsl:if test="@ref-id"> <a name="{@ref-id}"> <h5><xsl:value-of select="@title"/></h5></a> </xsl:if> <xsl:otherwise> <a name="{@title}"> <h5><xsl:value-of select="@title"/></h5></a> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:if test="@ref-id"> <a name="{@ref-id}"> <h6><xsl:value-of select="@title"/></h6></a> </xsl:if> <xsl:otherwise> <a name="{@title}"> <h6><xsl:value-of select="@title"/></h6></a> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> <xsl:apply-templates/> </xsl:template> <xsl:template match="header"> <xsl:apply-templates select="*"/> </xsl:template> <!-- Templates for HTML correction --> <xsl:template match="*|@*"> <xsl:copy> <xsl:apply-templates select="*|@*|text()"/> </xsl:copy> </xsl:template> <xsl:template match="small"> <span class="bodyGrey"> <xsl:copy-of select="*|text()"/> </span> </xsl:template> <xsl:template match="p"> <p> <span class="bodyBlack"> <xsl:apply-templates select="*|@*|text()"/> </span> </p> </xsl:template> <xsl:template match="td"> <td> <xsl:copy-of select="@*"/> <span class="bodyGrey"> <xsl:apply-templates select="*|@*|text()"/> </span> </td> </xsl:template> <xsl:template match="ul"> <table border="0" cellpadding="2" cellspacing="2"> <tr><td colspan="2" height="5"></td></tr> <span class="bodyGrey"><xsl:apply-templates/></span> </table> </xsl:template> <xsl:template match="ul/li"> <tr> <td align="left" valign="top" width="10">-</td> <td align="left" valign="top"><span class="bodyGrey"><xsl:apply-templates/></span></td> </tr> </xsl:template> <xsl:template match="pre"> <span class="bodyGrey"> <pre><xsl:apply-templates/></pre> </span> </xsl:template> <!-- Templates for links --> <xsl:template match="a"> <a> <xsl:if test="@href"> <xsl:variable name="href"> <xsl:call-template name="link-convertor"> <xsl:with-param name="href" select="@href"/> </xsl:call-template> </xsl:variable> <xsl:attribute name="href"> <xsl:value-of select="$href"/> </xsl:attribute> </xsl:if> <xsl:for-each select="@*[not(name(.)='href')]"> <xsl:copy-of select="."/> </xsl:for-each> <xsl:apply-templates/> </a> </xsl:template> <xsl:template name="link-convertor"> <xsl:param name="href" select="empty"/> <xsl:choose> <xsl:when test="starts-with($href,'http:')"> <xsl:value-of select="$href"/> </xsl:when> <xsl:when test="not(contains($href,'.xml'))"> <xsl:value-of select="$href"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring-before($href, '.xml')"/>.html </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="javadoc"> <xsl:choose> <xsl:when test="@type='package'"> <a href="javadoc/{translate(.,'.','/')}/package-summary.html"><xsl:copy-of select="."/></a> </xsl:when> <xsl:otherwise> <a href="javadoc/{translate(.,'.','/')}.html"><xsl:copy-of select="."/></a> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="api"> <xsl:choose> <xsl:when test="@package"> <a href="api/{translate(@package,'.','/')}/package-summary.html"><xsl:copy-of select="."/></a> </xsl:when> <xsl:when test="@class"> <a href="api/{translate(@class,'.','/')}.html#{.}"><xsl:value-of select="."/></a> </xsl:when> <xsl:otherwise> <a href="api/{translate(.,'.','/')}.html"><xsl:copy-of select="."/></a> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="url"> <a href="{.}"><xsl:copy-of select="."/></a> </xsl:template> <xsl:template match="email"> <a href="mailto:{.}"><xsl:copy-of select="."/></a> </xsl:template> <!-- Templates for special content --> <xsl:template match="body-note"> <hr size="1" noshadow=""/><span class="bodyGrey"><xsl:apply-templates/><hr size="1" noshadow=""/></span> </xsl:template> <xsl:template match="code-block"> <table border="0" cellpadding="0" cellspacing="0" width="440"> <tr> <td bgcolor="#e0e0e0"> <span class="code-block"> <pre><xsl:apply-templates/></pre> </span> </td> </tr> </table> </xsl:template> <xsl:template match="file"> <table border="0" cellpadding="0" cellspacing="0" width="440"> <tr> <td bgcolor="#c0c0c0"><i><span class="code-title"><xsl:value-of select="@name"/></span></i></td> </tr> <tr> <td bgcolor="#e0e0e0"> <span class="code-block"> <pre><xsl:apply-templates/></pre> </span> </td> </tr> </table> </xsl:template> <xsl:template match="code"> <span class="bodyCode"> <xsl:apply-templates/> </span> </xsl:template> <xsl:template match="tab"> <img src="images/dotTrans.gif" width="10" height="1" border="0"/> </xsl:template> <xsl:template match="term"> <span class="bodyTerm"> <xsl:apply-templates/> </span> </xsl:template> <xsl:template match="code/comment"> <span class="bodyGrey"> <font color="red"><xsl:apply-templates/></font> </span> </xsl:template> <xsl:template match="command"> <span class="command"><xsl:apply-templates/></span> </xsl:template> <xsl:template match="mailing-lists"> <xsl:apply-templates/> </xsl:template> <xsl:template match="mailing-list"> <div class="bodyGrey"> [ <a href="mailto:{@manager}@{@server}?subject=subscribe {@name}">Subscribe</a> | <a href="mailto:{@manager}@{@server}?subject=unsubscribe {@name}">Unsubscribe</a> | <a href="mailto:{@name}@{@server}">Post Message</a> | <a href="{@archive}">Archive</a> ] </div> </xsl:template> <xsl:template match="mailing-list/title"> <xsl:apply-templates/> </xsl:template> <xsl:template match="mailing-list/description"> <xsl:apply-templates/> </xsl:template> <xsl:template match="contributors"> <xsl:for-each select="type"> <xsl:variable name="type" select="@name"/> <xsl:variable name="color-epsilon" select="'#DDDDDD'"/> <table cellpadding="4" cellspacing="2" width="90%"> <tr> <td bgcolor="{$color-epsilon}"> <span class="bodyBlack"> <b><xsl:value-of select="@name"/></b> </span> </td> </tr> <tr> <td> <p><span class="bodyGrey"><xsl:value-of select="."/></span></p> </td> </tr> <xsl:for-each select="../contributor[@type=$type]"> <tr> <td> <center> <img src="images/line_light.gif" width="340" height="3" border="0"/> </center> </td> </tr> <tr> <td> <p> <span class="teamMember"> <a href="mailto:{email}"><xsl:value-of select="name/@given"/> <xsl:value-of select="name/@surname"/></a> </span> <xsl:if test="role"> <span class="teamMemberRole"> - <xsl:value-of select="role"/></span> </xsl:if> <xsl:if test="company/@id"> <br/> <span class="bodyGrey"> <xsl:variable name="company-id" select="company/@id"/> <xsl:variable name="company" select="../company[@id=$company-id]"/> <xsl:choose> <xsl:if test="$company/url"> <a href="http://{$company/url}"><xsl:value-of select="$company/name"/></a> </xsl:if> <xsl:otherwise> <xsl:value-of select="$company/name"/> </xsl:otherwise> </xsl:choose> </span> </xsl:if> </p> <p> <span class="bodyBlack"> <xsl:value-of select="description"/> </span> </p> </td> </tr> </xsl:for-each> </table> <br/><br/> </xsl:for-each> </xsl:template> <xsl:template match="contributors0ld"> <xsl:for-each select="type"> <xsl:variable name="type" select="@name"/> <xsl:variable name="color-epsilon" select="'#ffffff'"/> <p><span class="bodyGrey"><b><xsl:value-of select="@name"/></b></span></p> <p><span class="bodyGrey"><xsl:value-of select="."/></span></p> <table cellpadding="4" cellspacing="2" width="90%"> <tr> <td bgcolor="{$color-epsilon}"><span class="bodyGrey"> <b>Name</b></span> </td> <td bgcolor="{$color-epsilon}"><span class="bodyGrey"> <b>Contribution</b></span> </td> <td bgcolor="{$color-epsilon}"><span class="bodyGrey"> <b>Company</b></span> </td> </tr> <xsl:for-each select="../contributor[@type=$type]"> <tr> <td><span class="bodyGrey"> <a href="mailto:{email}"><xsl:value-of select="name/@given"/> <xsl:value-of select="name/@surname"/></a></span> </td> <td><span class="bodyGrey"> <xsl:value-of select="description"/></span> </td> <td><span class="bodyGrey"> <xsl:variable name="company-id" select="company/@id"/> <xsl:variable name="company" select="../company[@id=$company-id]"/> <a href="http://{$company/url}"><xsl:value-of select="$company/name"/></a>  </span> </td> </tr> </xsl:for-each> </table> </xsl:for-each> </xsl:template> </xsl:stylesheet> |
From: David B. <dav...@vi...> - 2002-04-23 17:53:25
|
Modified: src/doc/style website.xsl Log: Updated style By David Blevins, on 02d/02/04 23:10:53 Revision Changes Path 1.2 +29 -15 opene/src/doc/style/website.xsl Index: website.xsl =================================================================== RCS file: /cvsroot/opene/opene/src/doc/style/website.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- website.xsl 23 Apr 2002 16:45:41 -0000 1.1 +++ website.xsl 23 Apr 2002 17:53:24 -0000 1.2 @@ -98,6 +98,33 @@ <td width="490" valign="bottom"> <!-- Page title --> <xsl:choose> + <xsl:when test="/document/body/titlebar"> + <table border="0"> + <tr> + <td> + <span class="pageTitle"><xsl:value-of select="/document/body/titlebar/main"/></span> + </td> + <td> + <table cellspacing="1" width="300"> + <tr> + <td bgcolor="#a0a0a0"> + <span class="pageSubTitle"> + <xsl:value-of select="/document/body/titlebar/top"/> + </span> + </td> + </tr> + <tr> + <td bgcolor="#c0c0c0"> + <span class="pageSubTitle"> + <xsl:value-of select="/document/body/titlebar/bottom"/> + </span> + </td> + </tr> + </table> + </td> + </tr> + </table> + </xsl:when> <xsl:when test="/document/body/title"> <span class="pageTitle"><xsl:value-of select="/document/body/title"/></span><br/> </xsl:when> @@ -116,7 +143,7 @@ </p> </xsl:if> <xsl:if test="document/body/header"> - <br/> + <br/> <xsl:apply-templates select="document/body/header"/> </xsl:if> </td> @@ -405,20 +432,7 @@ </td> </xsl:template> - <xsl:template match="ul"> - <table border="0" cellpadding="2" cellspacing="2"> - <tr><td colspan="2" height="5"></td></tr> - <span class="bodyGrey"><xsl:apply-templates/></span> - </table> - </xsl:template> - - <xsl:template match="ul/li"> - <tr> - <td align="left" valign="top" width="10">-</td> - <td align="left" valign="top"><span class="bodyGrey"><xsl:apply-templates/></span></td> - </tr> - </xsl:template> - + <xsl:template match="pre"> <span class="bodyGrey"> <pre><xsl:apply-templates/></pre> |