You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by di...@apache.org on 2005/10/08 04:53:14 UTC
svn commit: r307242 - in /forrest/trunk/main/webapp/skins/common/xslt:
fo/document-to-fo.xsl html/book-to-menu.xsl html/document-to-html.xsl
html/site-to-xhtml.xsl html/tab-to-menu.xsl svg/document-to-svg.xsl
Author: diwaker
Date: Fri Oct 7 19:53:10 2005
New Revision: 307242
URL: http://svn.apache.org/viewcvs?rev=307242&view=rev
Log:
renamed stylesheets for common skin
Added:
forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl (with props)
forrest/trunk/main/webapp/skins/common/xslt/html/book-to-menu.xsl (with props)
forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl (with props)
forrest/trunk/main/webapp/skins/common/xslt/html/site-to-xhtml.xsl (with props)
forrest/trunk/main/webapp/skins/common/xslt/html/tab-to-menu.xsl (with props)
forrest/trunk/main/webapp/skins/common/xslt/svg/document-to-svg.xsl (with props)
Added: forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl?rev=307242&view=auto
==============================================================================
--- forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl (added)
+++ forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl Fri Oct 7 19:53:10 2005
@@ -0,0 +1,1053 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2002-2005 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <!-- left, justify, right -->
+ <xsl:variable name="text-align" select="string(//skinconfig/pdf/page/@text-align)"/>
+
+ <!-- print URL of external links -->
+ <xsl:variable name="show-external-urls" select="//skinconfig/pdf/show-external-urls"/>
+
+ <!-- Get the section depth to use when generating the minitoc (default is 2) -->
+ <xsl:variable name="toc-max-depth" select="number(//skinconfig/toc/@max-depth)"/>
+
+ <!-- The page size to be used -->
+ <xsl:variable name="pagesize"
+ select="string(//skinconfig/pdf/page/@size)"/>
+
+ <!-- The page orientation ("portrait" or "landscape") -->
+ <xsl:variable name="pageorientation"
+ select="string(//skinconfig/pdf/page/@orientation)"/>
+
+ <!-- Double-sided printing toggle -->
+ <xsl:variable name="doublesided"
+ select="string(//skinconfig/pdf/margins/@double-sided)"/>
+
+ <!-- The top page margin -->
+ <xsl:variable name="topmargin"
+ select="string(//skinconfig/pdf/margins/top)"/>
+
+ <!-- The bottom page margin -->
+ <xsl:variable name="bottommargin"
+ select="string(//skinconfig/pdf/margins/bottom)"/>
+
+ <!-- The inner page margin (always the left margin if
+ double-sided printing is off, alternating between left and right if
+ it's on) -->
+ <xsl:variable name="innermargin"
+ select="string(//skinconfig/pdf/margins/inner)"/>
+
+ <!-- The outer page margin (always the right margin if
+ double-sided printing is off, alternating between right and left if
+ it's on)-->
+ <xsl:variable name="outermargin"
+ select="string(//skinconfig/pdf/margins/outer)"/>
+
+ <xsl:param name="numbersections" select="'true'"/>
+
+ <!-- page breaks after TOC and each page if an aggregate document -->
+ <xsl:variable name="page-break-top-sections" select="'true'"/>
+
+ <!-- page numbering format -->
+ <xsl:variable name="page-numbering-format" select="string(//skinconfig/pdf/page-numbering-format)"/>
+
+ <!-- Section depth at which we stop numbering and just indent -->
+ <xsl:param name="numbering-max-depth" select="'3'"/>
+ <xsl:param name="imagesdir" select="."/>
+ <xsl:param name="xmlbasedir"/>
+ <xsl:include href="pdfoutline.xsl"/>
+ <xsl:include href="footerinfo.xsl"/>
+
+
+ <!-- Determine page height for various page sizes (US Letter portrait
+ is the default) -->
+ <!-- FIXME: JJP:would this be better of a file? -->
+ <xsl:variable name="pageheight">
+ <xsl:choose>
+ <xsl:when test="$pageorientation = 'landscape'">
+ <xsl:choose>
+ <xsl:when test="$pagesize = 'a0'">841mm</xsl:when>
+ <xsl:when test="$pagesize = 'a1'">594mm</xsl:when>
+ <xsl:when test="$pagesize = 'a2'">420mm</xsl:when>
+ <xsl:when test="$pagesize = 'a3'">297mm</xsl:when>
+ <xsl:when test="$pagesize = 'a4'">210mm</xsl:when>
+ <xsl:when test="$pagesize = 'a5'">148mm</xsl:when>
+ <xsl:when test="$pagesize = 'executive'">7.25in</xsl:when>
+ <xsl:when test="$pagesize = 'folio'">8.5in</xsl:when>
+ <xsl:when test="$pagesize = 'ledger'">11in</xsl:when>
+ <xsl:when test="$pagesize = 'legal'">8.5in</xsl:when>
+ <xsl:when test="$pagesize = 'letter'">8.5in</xsl:when>
+ <xsl:when test="$pagesize = 'quarto'">8.5in</xsl:when>
+ <xsl:when test="$pagesize = 'tabloid'">11in</xsl:when>
+ <xsl:otherwise>8.5in</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$pagesize = 'a0'">1189mm</xsl:when>
+ <xsl:when test="$pagesize = 'a1'">841mm</xsl:when>
+ <xsl:when test="$pagesize = 'a2'">594mm</xsl:when>
+ <xsl:when test="$pagesize = 'a3'">420mm</xsl:when>
+ <xsl:when test="$pagesize = 'a4'">297mm</xsl:when>
+ <xsl:when test="$pagesize = 'a5'">210mm</xsl:when>
+ <xsl:when test="$pagesize = 'executive'">10.5in</xsl:when>
+ <xsl:when test="$pagesize = 'folio'">13in</xsl:when>
+ <xsl:when test="$pagesize = 'ledger'">17in</xsl:when>
+ <xsl:when test="$pagesize = 'legal'">14in</xsl:when>
+ <xsl:when test="$pagesize = 'quarto'">10.83in</xsl:when>
+ <xsl:when test="$pagesize = 'tabloid'">17in</xsl:when>
+ <xsl:otherwise>11in</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- Determine page width for various page sizes (US Letter portrait
+ is the default) -->
+ <xsl:variable name="pagewidth">
+ <xsl:choose>
+ <xsl:when test="$pageorientation = 'landscape'">
+ <xsl:choose>
+ <xsl:when test="$pagesize = 'a0'">1189mm</xsl:when>
+ <xsl:when test="$pagesize = 'a1'">841mm</xsl:when>
+ <xsl:when test="$pagesize = 'a2'">594mm</xsl:when>
+ <xsl:when test="$pagesize = 'a3'">420mm</xsl:when>
+ <xsl:when test="$pagesize = 'a4'">297mm</xsl:when>
+ <xsl:when test="$pagesize = 'a5'">210mm</xsl:when>
+ <xsl:when test="$pagesize = 'executive'">10.5in</xsl:when>
+ <xsl:when test="$pagesize = 'folio'">13in</xsl:when>
+ <xsl:when test="$pagesize = 'ledger'">17in</xsl:when>
+ <xsl:when test="$pagesize = 'legal'">14in</xsl:when>
+ <xsl:when test="$pagesize = 'quarto'">10.83in</xsl:when>
+ <xsl:when test="$pagesize = 'tabloid'">17in</xsl:when>
+ <xsl:otherwise>11in</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$pagesize = 'a0'">841mm</xsl:when>
+ <xsl:when test="$pagesize = 'a1'">594mm</xsl:when>
+ <xsl:when test="$pagesize = 'a2'">420mm</xsl:when>
+ <xsl:when test="$pagesize = 'a3'">297mm</xsl:when>
+ <xsl:when test="$pagesize = 'a4'">210mm</xsl:when>
+ <xsl:when test="$pagesize = 'a5'">148mm</xsl:when>
+ <xsl:when test="$pagesize = 'executive'">7.25in</xsl:when>
+ <xsl:when test="$pagesize = 'folio'">8.5in</xsl:when>
+ <xsl:when test="$pagesize = 'ledger'">11in</xsl:when>
+ <xsl:when test="$pagesize = 'legal'">8.5in</xsl:when>
+ <xsl:when test="$pagesize = 'letter'">8.5in</xsl:when>
+ <xsl:when test="$pagesize = 'quarto'">8.5in</xsl:when>
+ <xsl:when test="$pagesize = 'tabloid'">11in</xsl:when>
+ <xsl:otherwise>8.5in</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:template match="/">
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+
+ <fo:simple-page-master master-name="first-page"
+ page-height="{$pageheight}"
+ page-width="{$pagewidth}"
+ margin-top="{$topmargin}"
+ margin-bottom="{$bottommargin}"
+ margin-left="{$innermargin}"
+ margin-right="{$outermargin}">
+ <fo:region-body
+ margin-top="0.5in"
+ margin-bottom=".5in"/>
+ <fo:region-after
+ region-name="first-footer"
+ extent=".5in"
+ display-align="before"/>
+ </fo:simple-page-master>
+
+ <fo:simple-page-master master-name="even-page"
+ page-height="{$pageheight}"
+ page-width="{$pagewidth}"
+ margin-top="{$topmargin}"
+ margin-bottom="{$bottommargin}">
+ <xsl:choose>
+ <xsl:when test="$doublesided = 'true'">
+ <xsl:attribute name="margin-left">
+ <xsl:value-of select="$outermargin"/>
+ </xsl:attribute>
+ <xsl:attribute name="margin-right">
+ <xsl:value-of select="$innermargin"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="margin-left">
+ <xsl:value-of select="$innermargin"/>
+ </xsl:attribute>
+ <xsl:attribute name="margin-right">
+ <xsl:value-of select="$outermargin"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <fo:region-before
+ region-name="even-header"
+ extent="0.5in"
+ border-bottom="0.5pt solid"/>
+ <fo:region-body
+ margin-top="0.5in"
+ margin-bottom=".5in"/>
+ <fo:region-after
+ region-name="even-footer"
+ extent=".5in"
+ display-align="before"/>
+ </fo:simple-page-master>
+
+ <fo:simple-page-master master-name="odd-page"
+ page-height="{$pageheight}"
+ page-width="{$pagewidth}"
+ margin-top="{$topmargin}"
+ margin-bottom="{$bottommargin}"
+ margin-left="{$innermargin}"
+ margin-right="{$outermargin}">
+ <fo:region-before
+ region-name="odd-header"
+ extent="0.5in"
+ border-bottom="0.5pt solid"/>
+ <fo:region-body
+ margin-top="0.5in"
+ margin-bottom=".5in"/>
+ <fo:region-after
+ region-name="odd-footer"
+ extent=".5in"
+ display-align="before"/>
+ </fo:simple-page-master>
+
+ <fo:page-sequence-master master-name="book">
+ <fo:repeatable-page-master-alternatives>
+ <fo:conditional-page-master-reference
+ page-position="first"
+ master-reference="first-page"/>
+ <fo:conditional-page-master-reference
+ odd-or-even="odd"
+ master-reference="odd-page"/>
+ <fo:conditional-page-master-reference
+ odd-or-even="even"
+ master-reference="even-page"/>
+ </fo:repeatable-page-master-alternatives>
+ </fo:page-sequence-master>
+ </fo:layout-master-set>
+
+ <xsl:apply-templates select="/site/document" mode="outline"/>
+
+ <fo:page-sequence master-reference="book">
+ <xsl:apply-templates select="/site/document"/>
+ </fo:page-sequence>
+
+ </fo:root>
+ </xsl:template>
+
+ <xsl:template match="document">
+ <fo:title><xsl:value-of select="header/title"/></fo:title>
+
+ <fo:static-content flow-name="first-footer">
+ <fo:block
+ border-top="0.25pt solid"
+ padding-before="6pt"
+ text-align="center">
+ <xsl:apply-templates select="footer"/>
+ </fo:block>
+ <!-- don't list page number on first page if it's contents is just the TOC -->
+ <xsl:if test="not($toc-max-depth > 0 and $page-break-top-sections)">
+ <xsl:call-template name="insertPageNumber">
+ <xsl:with-param name="text-align">start</xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:call-template name="info"/>
+ </fo:static-content>
+
+ <fo:static-content flow-name="even-header">
+ <fo:block
+ font-size="70%"
+ text-align="end"
+ font-style="italic">
+ <xsl:value-of select="header/title"/>
+ </fo:block>
+ </fo:static-content>
+
+ <fo:static-content flow-name="even-footer">
+ <fo:block
+ border-top="0.25pt solid"
+ padding-before="6pt"
+ text-align="center">
+ <xsl:apply-templates select="footer"/>
+ </fo:block>
+ <xsl:call-template name="insertPageNumber">
+ <xsl:with-param name="text-align">end</xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="info"/>
+ </fo:static-content>
+
+ <fo:static-content flow-name="odd-header">
+ <fo:block
+ font-size="70%"
+ text-align="start"
+ font-style="italic">
+ <xsl:value-of select="header/title"/>
+ </fo:block>
+ </fo:static-content>
+
+ <fo:static-content flow-name="odd-footer">
+ <fo:block
+ border-top="0.25pt solid"
+ padding-before="6pt"
+ text-align="center">
+ <xsl:apply-templates select="footer"/>
+ </fo:block>
+ <xsl:call-template name="insertPageNumber">
+ <xsl:with-param name="text-align">start</xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="info"/>
+ </fo:static-content>
+
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block
+ padding-before="24pt"
+ padding-after="24pt"
+ font-size="24pt"
+ font-weight="bold"
+ id="{generate-id()}">
+
+ <xsl:value-of select="header/title"/>
+ </fo:block>
+
+ <fo:block
+ text-align="{$text-align}"
+ padding-before="18pt"
+ padding-after="18pt">
+ <xsl:apply-templates/>
+ </fo:block>
+
+ <!-- Total number of pages calculation... -->
+ <fo:block id="term"/>
+
+ </fo:flow>
+ </xsl:template>
+
+ <xsl:template match="abstract">
+ <fo:block
+ font-size="12pt"
+ text-align="center"
+ space-before="20pt"
+ space-after="25pt"
+ width="7.5in"
+ font-family="serif"
+ font-style="italic">
+ <xsl:call-template name="insertPageBreaks"/>
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="notice">
+ <fo:block
+ font-size="10pt"
+ text-align="left"
+ space-before="20pt"
+ width="7.5in"
+ font-family="serif"
+ border-top="0.25pt solid"
+ border-bottom="0.25pt solid"
+ padding-before="6pt"
+ padding-after="6pt">
+ <xsl:call-template name="insertPageBreaks"/>
+ <!-- insert i18n stuff here -->
+ NOTICE: <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="anchor">
+ <fo:block id="{@id}"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="section">
+
+ <xsl:param name="level">0</xsl:param>
+
+ <xsl:variable name="size">
+ <!-- 14pt for level 1 12pt for level 2 -->
+ <xsl:value-of select="14-number($level)"/>
+ </xsl:variable>
+
+ <xsl:variable name="background-color" select="//skinconfig/colors/color[@name='body']/@value"/>
+ <xsl:variable name="heading-color" select="//skinconfig/colors/color[@name='subheading']/@value"/>
+ <xsl:variable name="heading-type" select="//skinconfig/headings/@type"/>
+
+ <fo:block
+ font-family="serif"
+ font-size="{$size}pt"
+ font-weight="bold"
+ space-before="12pt"
+ space-after="4pt">
+
+ <xsl:call-template name="insertPageBreaks"/>
+
+ <xsl:if test="$heading-type = 'boxed'">
+ <xsl:attribute name="background-color">
+ <xsl:value-of select="$heading-color"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="normalize-space(@id)!=''">
+ <xsl:value-of select="@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:if test="$numbersections = 'true' and number($level) < $numbering-max-depth+1">
+ <xsl:number format="1.1.1.1.1.1.1" count="section" level="multiple"/>
+ <xsl:text>. </xsl:text>
+ </xsl:if>
+
+ <!-- For sections 4 or more nestings deep, indent instead of number -->
+ <xsl:if test="number($level) > $numbering-max-depth+1">
+ <xsl:attribute name="start-indent">
+ <xsl:value-of select="4+number($level)"/><xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:value-of select="title"/>
+ </fo:block>
+ <xsl:if test="$heading-type = 'underlined'">
+ <!-- The non-breaking space in this block is required, otherwise
+ the block won't be rendered at all. -->
+ <fo:block
+ font-family="serif"
+ font-size="{10 div (number($level) +1 )}pt"
+ background-color="{$heading-color}"> </fo:block>
+ </xsl:if>
+ <fo:block
+ background-color="{$background-color}">
+ <xsl:apply-templates>
+ <xsl:with-param name="level" select="number($level)+1"/>
+ </xsl:apply-templates>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="title">
+ <!-- do nothing as titles are handled in their parent templates -->
+ </xsl:template>
+
+ <xsl:template match="subtitle">
+ <xsl:param name="level">0</xsl:param>
+ <xsl:variable name="size" select="16-(number($level)*1.5)"/>
+
+ <fo:block
+ font-weight="bold"
+ font-size="{$size}pt">
+ <xsl:call-template name="insertPageBreaks"/>
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="authors">
+ <fo:block
+ space-before="20pt"
+ font-weight="bold"
+ font-size="9pt">
+ <xsl:call-template name="insertPageBreaks"/>
+ <!-- insert i18n stuff here -->
+ by
+ <xsl:for-each select="person">
+ <xsl:value-of select="@name"/>
+ <xsl:if test="not(position() = last())">, </xsl:if>
+ </xsl:for-each>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="p">
+ <xsl:choose>
+ <xsl:when test="ancestor::li and not(preceding-sibling::*)">
+ <fo:block
+ space-after="4pt"
+ font-family="serif">
+ <xsl:call-template name="insertPageBreaks"/>
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:block
+ space-before="4pt"
+ space-after="4pt"
+ font-family="serif">
+ <xsl:call-template name="insertPageBreaks"/>
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="source">
+ <xsl:variable name="color" select="//skinconfig/colors/color[@name='code']/@value"/>
+ <fo:block
+ font-family="monospace"
+ font-size="10pt"
+ background-color="{$color}"
+ white-space-collapse="false"
+ linefeed-treatment="preserve"
+ white-space-treatment="preserve"
+ wrap-option="wrap"
+ text-align="start">
+ <xsl:call-template name="insertPageBreaks"/>
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template>
+
+
+ <xsl:template match="ol|ul">
+ <fo:list-block
+ provisional-distance-between-starts="18pt"
+ provisional-label-separation="3pt"
+ text-align="start">
+ <xsl:apply-templates/>
+ </fo:list-block>
+ </xsl:template>
+
+ <xsl:template match="ol/li">
+ <fo:list-item>
+ <xsl:if test="not(following-sibling::li[1])">
+ <xsl:attribute name="space-after">6pt"</xsl:attribute>
+ </xsl:if>
+ <fo:list-item-label
+ end-indent="label-end()">
+ <fo:block>
+ <xsl:number format="1."/>
+ </fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body
+ start-indent="body-start()">
+ <fo:block
+ font-family="serif">
+ <xsl:apply-templates/>
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </xsl:template>
+
+ <!-- Emulate browser handling of these invalid combinations that our DTD
+ unfortunately allows -->
+ <xsl:template match="ul/ul | ul/ol | ol/ul | ol/ol">
+ <fo:list-item>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block></fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block font-family="serif">
+ <xsl:apply-templates/>
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </xsl:template>
+
+ <xsl:template match="ul/li">
+ <fo:list-item>
+ <xsl:if test="not(following-sibling::li[1])">
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
+ </xsl:if>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>•</fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block
+ font-family="serif">
+ <xsl:apply-templates/>
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </xsl:template>
+
+ <xsl:template match="dl">
+ <fo:list-block
+ provisional-distance-between-starts="18pt"
+ provisional-label-separation="3pt"
+ text-align="start">
+ <xsl:apply-templates/>
+ </fo:list-block>
+ </xsl:template>
+
+ <xsl:template match="dt">
+ <fo:list-item>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block></fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block
+ font-weight="bold">
+ <xsl:apply-templates/>
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </xsl:template>
+
+ <xsl:template match="dd">
+ <fo:list-item>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block></fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block>
+ <xsl:apply-templates/>
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </xsl:template>
+
+ <xsl:template match="strong">
+ <fo:inline font-weight="bold"><xsl:apply-templates/></fo:inline>
+ </xsl:template>
+
+ <xsl:template match="em">
+ <fo:inline font-style="italic"><xsl:apply-templates/></fo:inline>
+ </xsl:template>
+
+ <xsl:template match="code">
+ <fo:inline font-family="monospace"><xsl:apply-templates/></fo:inline>
+ </xsl:template>
+
+ <xsl:template match="warning">
+ <xsl:variable name="color" select="//skinconfig/colors/color[@name='warning']/@value"/>
+ <fo:block
+ margin-left="0.25in"
+ margin-right="0.25in"
+ font-weight="bold"
+ font-size="10pt"
+ font-family="serif"
+ space-before="10pt"
+ border-before-style="solid"
+ border-start-style="solid"
+ border-end-style="solid"
+ border-color="{$color}"
+ background-color="{$color}"
+ color="#ffffff">
+ <xsl:call-template name="insertPageBreaks"/>
+ <xsl:choose>
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
+ <xsl:otherwise>Warning: </xsl:otherwise>
+ </xsl:choose><xsl:value-of select="title"/>
+ </fo:block>
+ <fo:block
+ margin-left="0.25in"
+ margin-right="0.25in"
+ font-family="serif"
+ font-size="8pt"
+ border-after-style="solid"
+ border-start-style="solid"
+ border-end-style="solid"
+ border-color="{$color}"
+ background-color="#fff0f0"
+ padding-start="3pt"
+ padding-end="3pt"
+ padding-before="3pt"
+ padding-after="3pt"
+ space-after="10pt">
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="note">
+ <xsl:variable name="color" select="//skinconfig/colors/color[@name='note']/@value"/>
+ <fo:block
+ margin-left="0.25in"
+ margin-right="0.25in"
+ font-weight="bold"
+ font-size="10pt"
+ color="#ffffff"
+ font-family="serif"
+ space-before="10pt"
+ border-before-style="solid"
+ border-start-style="solid"
+ border-end-style="solid"
+ border-color="{$color}"
+ background-color="{$color}">
+ <xsl:call-template name="insertPageBreaks"/>
+ <xsl:choose>
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
+ <!-- insert i18n stuff here -->
+ <xsl:otherwise>Note: </xsl:otherwise>
+ </xsl:choose><xsl:value-of select="title"/>
+ </fo:block>
+ <fo:block
+ margin-left="0.25in"
+ margin-right="0.25in"
+ font-family="serif"
+ font-size="8pt"
+ space-after="10pt"
+ border-after-style="solid"
+ border-start-style="solid"
+ border-end-style="solid"
+ border-color="{$color}"
+ background-color="#F0F0FF"
+ padding-start="3pt"
+ padding-end="3pt"
+ padding-before="3pt"
+ padding-after="3pt">
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="fixme">
+ <xsl:variable name="color" select="//skinconfig/colors/color[@name='fixme']/@value"/>
+ <fo:block
+ margin-left="0.25in"
+ margin-right="0.25in"
+ font-weight="bold"
+ font-size="10pt"
+ color="#FFFFFF"
+ font-family="serif"
+ space-before="10pt"
+ border-before-style="solid"
+ border-start-style="solid"
+ border-end-style="solid"
+ border-color="{$color}"
+ background-color="{$color}">
+ <xsl:call-template name="insertPageBreaks"/>
+ <!-- insert i18n stuff here -->
+ FIXME (<xsl:value-of select="@author"/>): <xsl:value-of select="title"/>
+ </fo:block>
+ <fo:block
+ margin-left="0.25in"
+ margin-right="0.25in"
+ font-family="serif"
+ font-size="8pt"
+ space-after="10pt"
+ border-after-style="solid"
+ border-start-style="solid"
+ border-end-style="solid"
+ border-color="{$color}"
+ background-color="#FFF0F0"
+ padding-start="3pt"
+ padding-end="3pt"
+ padding-before="3pt"
+ padding-after="3pt">
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="link|fork|jump">
+ <xsl:variable name="color" select="//skinconfig/colors/color[@name = 'body']/@link"/>
+ <xsl:choose>
+ <xsl:when test="starts-with(@href, '#')">
+ <fo:basic-link color="{$color}" text-decoration="underline" internal-destination="{substring(@href,2)}">
+ <xsl:apply-templates/>
+ </fo:basic-link>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:basic-link color="{$color}" text-decoration="underline" external-destination="{@href}"><xsl:apply-templates/></fo:basic-link>
+ <xsl:if test="$show-external-urls = 'true' and @href != string(.)">
+ (<xsl:value-of select="@href"/>)
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="figure|img">
+ <fo:block text-align="center">
+ <xsl:call-template name="insertPageBreaks"/>
+ <xsl:if test="normalize-space(@id)!=''">
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+ </xsl:if>
+
+ <!-- Make relative paths absolute -->
+ <xsl:variable name="imgpath">
+ <xsl:choose>
+ <!-- resources image dir -->
+ <xsl:when test="starts-with(string(@src),'images/')">
+ <xsl:value-of select="concat($imagesdir,substring-after(@src,'images'))"/>
+ </xsl:when>
+ <!-- already absolute -->
+ <xsl:when test="contains(string(@src),':') or starts-with(string(@src),'/')">
+ <xsl:value-of select="@src"/>
+ </xsl:when>
+ <!-- relative to document -->
+ <xsl:otherwise><xsl:value-of select="concat($xmlbasedir,@src)"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <fo:external-graphic src="{$imgpath}">
+ <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>
+ </fo:external-graphic>
+ <!-- alt text -->
+ <xsl:if test="normalize-space(@alt)!=''">
+ <fo:block><xsl:value-of select="@alt"/></fo:block>
+ </xsl:if>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="table">
+ <!-- FIXME: Apache FOP must have column widths specified at present,
+ this section can be removed when this limitation is removed from Fop.
+ Unfortunately, this means that each column is a fixed width,
+ but at least the table displays! -->
+
+ <xsl:variable name="max-number-columns">
+ <xsl:for-each select="tr">
+ <xsl:sort select="count(td|th)" data-type="number" order="descending"/>
+ <xsl:if test="position() = 1">
+ <xsl:value-of select="count(td|th)"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+
+ <xsl:variable name="column-width">
+ <xsl:value-of select="6.25 div number($max-number-columns)"/>in
+ </xsl:variable>
+
+ <fo:table>
+
+ <fo:table-column>
+ <xsl:attribute name="column-width">
+ <xsl:value-of select="$column-width"/>
+ </xsl:attribute>
+
+ <xsl:attribute name="number-columns-repeated">
+ <xsl:value-of select="number($max-number-columns)"/>
+ </xsl:attribute>
+ </fo:table-column>
+
+ <!-- End of hack for Fop support (if removing this hack, remember
+ you need the <fo:table> element) -->
+
+ <fo:table-body
+ font-size="10pt"
+ font-family="sans-serif">
+ <xsl:apply-templates select="tr"/>
+ </fo:table-body>
+ </fo:table>
+
+ <!-- FIXME: Apache Fop does not support the caption element yet.
+ This hack will display the table caption accordingly. -->
+ <xsl:if test="caption">
+ <fo:block
+ text-align="center"
+ font-weight="bold">
+ <!-- insert i18n stuff here -->
+ Table
+ <xsl:text> </xsl:text>
+ <xsl:number count="table" level="multiple"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="caption"/>
+ </fo:block>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="tr">
+ <fo:table-row>
+ <xsl:apply-templates/>
+ </fo:table-row>
+ </xsl:template>
+
+ <xsl:template match="th">
+ <xsl:variable name="border-color" select="//skinconfig/colors/color[@name = 'table']/@value"/>
+ <xsl:variable name="background-color" select="$border-color"/>
+ <fo:table-cell
+ padding-before="4pt"
+ padding-after="4pt"
+ padding-start="4pt"
+ padding-end="4pt"
+ color="#FFFFFF"
+ background-color="{$background-color}"
+ border="1pt solid {$border-color}">
+ <xsl:attribute name="number-columns-spanned">
+ <xsl:value-of select="@colspan"/>
+ </xsl:attribute>
+ <xsl:attribute name="number-rows-spanned">
+ <xsl:value-of select="@rowspan"/>
+ </xsl:attribute>
+ <fo:block
+ text-align="center">
+ <xsl:apply-templates/>
+ </fo:block>
+ </fo:table-cell>
+ </xsl:template>
+
+ <xsl:template match="td">
+ <xsl:variable name="border-color" select="//skinconfig/colors/color[@name = 'table']/@value"/>
+ <xsl:variable name="background-color" select="//skinconfig/colors/color[@name = 'table-cell']/@value"/>
+ <fo:table-cell
+ padding-before="4pt"
+ padding-after="4pt"
+ padding-start="4pt"
+ padding-end="4pt"
+ background-color="{$background-color}"
+ border="1pt solid {$border-color}">
+ <xsl:attribute name="number-columns-spanned">
+ <xsl:value-of select="@colspan"/>
+ </xsl:attribute>
+ <xsl:attribute name="number-rows-spanned">
+ <xsl:value-of select="@rowspan"/>
+ </xsl:attribute>
+ <fo:block>
+ <xsl:apply-templates/>
+ </fo:block>
+ </fo:table-cell>
+ </xsl:template>
+
+ <xsl:template match="br">
+ <fo:block></fo:block>
+ </xsl:template>
+
+ <xsl:template match="legal">
+ <fo:inline
+ font-size="8pt">
+ <xsl:apply-templates/>
+ </fo:inline>
+ </xsl:template>
+
+ <xsl:template match="body[count(//section) != 0]">
+ <xsl:if test="$toc-max-depth > 0">
+ <fo:block font-family="serif" font-size="14pt" font-weight="bold"
+ space-after="5pt" space-before="5pt" text-align="justify" width="7.5in">
+ <xsl:call-template name="insertPageBreaks"/>
+ <!-- insert i18n stuff here -->
+ <xsl:text>Table of contents</xsl:text>
+ </fo:block>
+ <fo:block font-family="sans" font-size="12pt" space-after="5pt"
+ space-before="0pt" text-align="justify" width="7.5in">
+ <xsl:if test="$page-break-top-sections">
+ <xsl:attribute name="break-after">page</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="section" mode="toc" />
+ </fo:block>
+ </xsl:if>
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="section" mode="toc">
+ <!-- FIXME: see bug FOR-640 -->
+ <xsl:param name="depth" select="'1'"/>
+ <fo:block space-before="5pt" text-align-last="justify" start-indent=".5em" text-indent=".5em">
+ <fo:inline>
+ <xsl:variable name="id">
+ <xsl:choose>
+ <xsl:when test="normalize-space(@id)!=''">
+ <xsl:value-of select="@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <fo:basic-link internal-destination="{$id}">
+ <xsl:value-of select="substring('          ', 0, 2 * $depth - 1)" />
+ <fo:inline font-size="10pt">
+ <xsl:number count="section" format="1.1.1.1.1.1.1" level="multiple" />
+ </fo:inline>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="title" />
+ <fo:leader leader-pattern="dots" />
+ <fo:page-number-citation ref-id="{$id}" />
+ </fo:basic-link>
+ </fo:inline>
+ <xsl:if test="$toc-max-depth > $depth">
+ <xsl:apply-templates select="section" mode="toc">
+ <xsl:with-param name="depth" select="$depth + 1"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </fo:block>
+ </xsl:template>
+
+
+<!-- ====================================================================== -->
+<!-- Local Extensions section -->
+<!-- ====================================================================== -->
+
+ <xsl:template match="citation">
+ <fo:inline>
+ [<xsl:value-of select="@def"/>]
+ </fo:inline>
+ </xsl:template>
+
+ <xsl:template match="p[@class='quote']">
+ <fo:block start-indent="1em"
+ space-before="4pt"
+ space-after="4pt"
+ background-color="#f0f0f0"
+ font-family="monospace">
+ <xsl:call-template name="insertPageBreaks"/>
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template name="insertPageBreaks">
+ <!-- if marked as a 'pageBreakBefore', and we're breaking on pages, and were not the first node -->
+ <xsl:if test="contains(@class, 'pageBreakBefore') and preceding-sibling::node()">
+ <xsl:attribute name="break-before">page</xsl:attribute>
+ </xsl:if>
+ <!-- if marked as a 'pageBreakAfter', and we're breaking on pages, and were not the last node -->
+ <xsl:if test="contains(@class, 'pageBreakAfter') and following-sibling::node()">
+ <xsl:attribute name="break-after">page</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Display the document numerotation -->
+ <xsl:template name="insertPageNumber">
+ <xsl:param name="text-align" select="'start'"/>
+ <xsl:variable name="prefixe" select="substring-before($page-numbering-format,'1')"/>
+ <xsl:variable name="sep" select="substring-before(substring-after($page-numbering-format,'1'),'1')"/>
+ <xsl:variable name="postfixe">
+ <xsl:choose>
+ <xsl:when test="contains(substring-after($page-numbering-format,'1'),'1')">
+ <xsl:value-of select="substring-after(substring-after($page-numbering-format,'1'),'1')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($page-numbering-format,'1')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- if 'page-numbering-format' contains 1 digits, the page number is displayed in the footer -->
+ <xsl:if test="contains($page-numbering-format,'1')">
+ <fo:block font-size="70%" text-align="{$text-align}">
+ <!-- if the separator is not found, the total page number is skipped -->
+ <xsl:value-of select="$prefixe"/><fo:page-number/><xsl:if test="$sep != ''"><xsl:value-of select="$sep"/><fo:page-number-citation ref-id="term"/></xsl:if><xsl:value-of select="$postfixe"/>
+ </fo:block>
+ </xsl:if>
+ </xsl:template>
+
+<!-- ====================================================================== -->
+<!-- Temporary section - subject to change on short notice -->
+<!-- ====================================================================== -->
+
+ <xsl:template match="//style">
+ <!-- HACK: The OpenOffice.org input plugin currently produces
+ intermediate documents that contain a style element, invalid per
+ the Forrest Document DTD. This style element must be ignored
+ here. To find out why this is done this way, read the comments
+ attached to issue FOR-433. -->
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/main/webapp/skins/common/xslt/html/book-to-menu.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/skins/common/xslt/html/book-to-menu.xsl?rev=307242&view=auto
==============================================================================
--- forrest/trunk/main/webapp/skins/common/xslt/html/book-to-menu.xsl (added)
+++ forrest/trunk/main/webapp/skins/common/xslt/html/book-to-menu.xsl Fri Oct 7 19:53:10 2005
@@ -0,0 +1,172 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2002-2005 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--
+book2menu.xsl generates the HTML menu. It outputs XML/HTML of the form:
+ <div class="menu">
+ ...
+ </div>
+which is then merged with other HTML by site2xhtml.xsl
+
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <!-- ================================================================ -->
+ <!-- These templates SHOULD be overridden -->
+ <!-- ================================================================ -->
+
+ <xsl:template name="selected">
+ <xsl:value-of select="@label"/>
+ </xsl:template>
+
+ <xsl:template name="unselected">
+ <a href="{@href}">
+ <xsl:if test="@description">
+ <xsl:attribute name="title">
+ <xsl:value-of select="@description"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="@label"/>
+ </a>
+ </xsl:template>
+
+ <xsl:template name="print-external">
+ <!-- Use apply-imports when overriding -->
+ <xsl:value-of select="@label"/>
+ </xsl:template>
+
+
+ <!-- ================================================================ -->
+ <!-- These templates CAN be overridden -->
+ <!-- ================================================================ -->
+
+ <!-- Eg, if tab href is 'index.html#foo', this will be called when index.html
+ is selected -->
+ <xsl:template name="selected-anchor">
+ <!-- By default, render as unselected so that it is clickable (takes user
+ to the anchor) -->
+ <xsl:call-template name="unselected"/>
+ </xsl:template>
+
+ <xsl:template name="unselected-anchor">
+ <xsl:call-template name="unselected"/>
+ </xsl:template>
+
+
+ <xsl:template match="book">
+ <xsl:apply-templates select="menu"/>
+ </xsl:template>
+
+
+ <xsl:template match="menu">
+ <div class="menu">
+ <xsl:call-template name="base-menu"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="menu-item">
+ <!-- Use apply-imports when overriding -->
+
+ <xsl:variable name="href-nofrag">
+ <xsl:call-template name="path-nofrag">
+ <xsl:with-param name="path" select="@href"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="node-path">
+ <xsl:call-template name="normalize">
+ <xsl:with-param name="path" select="concat($dirname, $href-nofrag)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <!-- Compare with extensions stripped -->
+ <xsl:when test="$node-path = $path-nofrag">
+ <xsl:choose>
+ <xsl:when test="contains(@href, '#')">
+ <xsl:call-template name="selected-anchor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="selected"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="contains(@href, '#')">
+ <xsl:call-template name="unselected-anchor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="unselected"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ================================================================ -->
+ <!-- These templates SHOULD NOT be overridden -->
+ <!-- ================================================================ -->
+
+
+ <xsl:param name="path"/>
+
+ <xsl:include href="pathutils.xsl"/>
+
+ <xsl:variable name="filename">
+ <xsl:call-template name="filename">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="path-nofrag">
+ <xsl:call-template name="path-nofrag">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="dirname">
+ <xsl:call-template name="dirname">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:template match="external">
+ <li>
+ <xsl:choose>
+ <xsl:when test="starts-with(@href, $path-nofrag)">
+ <span class="externalSelected">
+ <xsl:call-template name="print-external"/>
+ </span>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="{@href}" target="_blank"><xsl:value-of select="@label"/></a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </li>
+ </xsl:template>
+
+ <xsl:template match="menu-item[@type='hidden']"/>
+
+ <xsl:template match="external[@type='hidden']"/>
+
+ <xsl:template name="base-menu">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: forrest/trunk/main/webapp/skins/common/xslt/html/book-to-menu.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl?rev=307242&view=auto
==============================================================================
--- forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl (added)
+++ forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl Fri Oct 7 19:53:10 2005
@@ -0,0 +1,399 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2002-2005 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--
+This stylesheet contains the majority of templates for converting documentv11
+to HTML. It renders XML as HTML in this form:
+
+ <div class="content">
+ ...
+ </div>
+
+..which site2xhtml.xsl then combines with HTML from the index (book2menu.xsl)
+and tabs (tab2menu.xsl) to generate the final HTML.
+
+Section handling
+ - <a name/> anchors are added if the id attribute is specified
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:param name="dynamic-page" select="'false'"/>
+ <xsl:param name="notoc"/>
+ <xsl:param name="path"/>
+ <!-- <xsl:include href="split.xsl"/> -->
+ <xsl:include href="dotdots.xsl"/>
+ <xsl:include href="pathutils.xsl"/>
+
+ <!-- Path to site root, eg '../../' -->
+ <xsl:variable name="root">
+ <xsl:call-template name="dotdots">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="skin-img-dir" select="concat(string($root), 'skin/images')"/>
+
+ <xsl:template match="/">
+ <xsl:apply-templates mode="toc"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="document">
+ <div class="content">
+ <table summary="" class="title">
+ <tr>
+ <td valign="middle">
+ <xsl:if test="normalize-space(header/title)!=''">
+ <h1>
+ <xsl:value-of select="header/title"/>
+ </h1>
+ </xsl:if>
+ </td>
+ <div id="skinconf-printlink"/>
+ <xsl:if test="$dynamic-page='false'">
+ <div id="skinconf-pdflink"/>
+ <div id="skinconf-xmllink"/>
+ </xsl:if>
+ </tr>
+ </table>
+ <xsl:if test="normalize-space(header/subtitle)!=''">
+ <h3>
+ <xsl:value-of select="header/subtitle"/>
+ </h3>
+ </xsl:if>
+ <xsl:apply-templates select="header/type"/>
+ <xsl:apply-templates select="header/notice"/>
+ <xsl:apply-templates select="header/abstract"/>
+ <xsl:apply-templates select="body"/>
+ <div class="attribution">
+ <xsl:apply-templates select="header/authors"/>
+ <xsl:if test="header/authors and header/version">
+ <xsl:text>; </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates select="header/version"/>
+ </div>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="body">
+ <div id="skinconf-toc-page"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+
+ <!-- Generate a <a name="..."> tag for an @id -->
+ <xsl:template match="@id">
+ <xsl:if test="normalize-space(.)!=''">
+ <a name="{.}"/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="section">
+ <!-- count the number of section in the ancestor-or-self axis to compute
+ the title element name later on -->
+ <xsl:variable name="sectiondepth" select="count(ancestor-or-self::section)"/>
+ <a name="{generate-id()}"/>
+ <xsl:apply-templates select="@id"/>
+ <!-- generate a title element, level 1 -> h3, level 2 -> h4 and so on... -->
+ <xsl:element name="{concat('h',$sectiondepth + 2)}">
+ <xsl:value-of select="title"/>
+ <xsl:if test="$notoc='true' and $sectiondepth = 3">
+ <span style="float: right"><a href="#{@id}-menu">^</a></span>
+ </xsl:if>
+ </xsl:element>
+
+ <!-- Indent FAQ entry text 15 pixels -->
+ <xsl:variable name="indent">
+ <xsl:choose>
+ <xsl:when test="$notoc='true' and $sectiondepth = 3">
+ <xsl:text>15</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <div style="margin-left: {$indent} ; border: 2px">
+ <xsl:apply-templates select="*[not(self::title)]"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="note | warning | fixme">
+ <xsl:apply-templates select="@id"/>
+ <div class="{local-name()}">
+ <div class="label">
+ <xsl:choose>
+ <!-- FIXME: i18n Transformer here -->
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
+ <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="notice">
+ <div class="notice">
+ <!-- FIXME: i18n Transformer here -->
+ <xsl:text>Notice: </xsl:text>
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="link">
+ <xsl:apply-templates select="@id"/>
+ <a>
+ <xsl:if test="@class='jump'">
+ <xsl:attribute name="target">_top</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@class='fork'">
+ <xsl:attribute name="target">_blank</xsl:attribute>
+ </xsl:if>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates/>
+ </a>
+ </xsl:template>
+
+ <xsl:template match="jump">
+ <xsl:apply-templates select="@id"/>
+ <a href="{@href}" target="_top">
+ <xsl:apply-templates/>
+ </a>
+ </xsl:template>
+
+ <xsl:template match="fork">
+ <xsl:apply-templates select="@id"/>
+ <a href="{@href}" target="_blank">
+ <xsl:apply-templates/>
+ </a>
+ </xsl:template>
+
+ <xsl:template match="p[@xml:space='preserve']">
+ <xsl:apply-templates select="@id"/>
+ <div class="pre">
+ <xsl:copy-of select="@id"/>
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="source">
+ <xsl:apply-templates select="@id"/>
+ <pre class="code">
+<!-- Temporarily removed long-line-splitter ... gives out-of-memory problems -->
+ <xsl:copy-of select="@id"/>
+ <xsl:apply-templates/>
+<!--
+ <xsl:call-template name="format">
+ <xsl:with-param select="." name="txt" />
+ <xsl:with-param name="width">80</xsl:with-param>
+ </xsl:call-template>
+-->
+ </pre>
+ </xsl:template>
+
+ <xsl:template match="anchor">
+ <a name="{@id}">
+ <xsl:copy-of select="@id"/>
+ </a>
+ </xsl:template>
+
+ <xsl:template match="icon">
+ <xsl:apply-templates select="@id"/>
+ <img class="icon">
+ <xsl:copy-of select="@height | @width | @src | @alt | @id"/>
+ </img>
+ </xsl:template>
+
+ <xsl:template match="code">
+ <xsl:apply-templates select="@id"/>
+ <span class="codefrag">
+ <xsl:copy-of select="@id"/>
+ <xsl:value-of select="."/>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="figure">
+ <xsl:apply-templates select="@id"/>
+
+ <div align="center">
+ <xsl:copy-of select="@id"/>
+ <img class="figure">
+ <xsl:copy-of select="@height | @width | @src | @alt | @id"/>
+ </img>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="table">
+ <xsl:apply-templates select="@id"/>
+ <xsl:choose>
+ <!-- Limit Forrest specific processing to tables without class -->
+ <xsl:when test="not(@class) or @class=''">
+ <table cellpadding="4" cellspacing="1" class="ForrestTable">
+ <xsl:copy-of select="@cellspacing | @cellpadding | @border | @class | @bgcolor |@id"/>
+ <xsl:apply-templates/>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Tables with class are passed without change -->
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates/>
+ </xsl:copy>
+
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@class = ''">
+
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="acronym/@title">
+ <xsl:attribute name="title">
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="header/authors">
+ <xsl:for-each select="person">
+ <xsl:choose>
+ <xsl:when test="position()=1">by</xsl:when>
+ <xsl:otherwise>,</xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@name"/>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template match="version">
+ <span class="version">
+ <xsl:apply-templates select="@major"/>
+ <xsl:apply-templates select="@minor"/>
+ <xsl:apply-templates select="@fix"/>
+ <xsl:apply-templates select="@tag"/>
+ <xsl:choose>
+ <xsl:when test="starts-with(., '$Revision: ')">
+ version <xsl:value-of select="substring(., 12, string-length(.) -11-2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="@major">
+ v<xsl:value-of select="."/>
+ </xsl:template>
+
+ <xsl:template match="@minor | @fix">
+ <xsl:value-of select="concat('.',.)"/>
+ </xsl:template>
+
+ <xsl:template match="@tag">
+ <xsl:value-of select="concat('-',.)"/>
+ </xsl:template>
+
+ <xsl:template match="type">
+ <p class="type">
+ <!-- FIXME: i18n Transformer here -->
+ <xsl:text>Type: </xsl:text>
+ <xsl:value-of select="."/>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="abstract">
+ <p>
+ <xsl:apply-templates/>
+ </p>
+ </xsl:template>
+
+ <xsl:template name="email">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('mailto:',@email)"/>
+ </xsl:attribute>
+ <xsl:value-of select="@name"/>
+ </a>
+ </xsl:template>
+
+ <xsl:template name="generate-id">
+ <xsl:choose>
+ <xsl:when test="@id">
+ <xsl:value-of select="@id"/>
+ </xsl:when>
+ <xsl:when test="@title">
+ <xsl:value-of select="@title"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id(.)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Templates for "toc" mode. This will generate a complete
+ Table of Contents for the document. This will then be used
+ by the site2xhtml to generate a Menu ToC and a Page ToC -->
+
+ <xsl:template match="document" mode="toc">
+ <xsl:apply-templates mode="toc"/>
+ </xsl:template>
+
+ <xsl:template match="body" mode="toc">
+ <tocitems>
+ <xsl:apply-templates select="section" mode="toc">
+ <xsl:with-param name="level" select="1"/>
+ </xsl:apply-templates>
+ </tocitems>
+ </xsl:template>
+
+ <xsl:template match="section" mode="toc">
+ <xsl:param name="level"/>
+
+ <tocitem level="{$level}">
+ <xsl:attribute name="href">#<xsl:call-template name="generate-id"/></xsl:attribute>
+ <xsl:attribute name="title"><xsl:value-of select="title"/></xsl:attribute>
+ <xsl:apply-templates mode="toc">
+ <xsl:with-param name="level" select="$level+1"/>
+ </xsl:apply-templates>
+ </tocitem>
+ </xsl:template>
+
+ <xsl:template match="node()|@*" mode="toc"/>
+
+ <!-- End of "toc" mode templates -->
+
+ <xsl:template match="node()|@*" priority="-1">
+ <!-- id processing will create its own a-element so processing has to
+ happen outside the copied element
+ -->
+ <xsl:apply-templates select="@id"/>
+ <xsl:copy>
+ <xsl:apply-templates select="@*[name(.) != 'id']"/>
+ <xsl:copy-of select="@id"/>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
+
Propchange: forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/main/webapp/skins/common/xslt/html/site-to-xhtml.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/skins/common/xslt/html/site-to-xhtml.xsl?rev=307242&view=auto
==============================================================================
--- forrest/trunk/main/webapp/skins/common/xslt/html/site-to-xhtml.xsl (added)
+++ forrest/trunk/main/webapp/skins/common/xslt/html/site-to-xhtml.xsl Fri Oct 7 19:53:10 2005
@@ -0,0 +1,377 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2002-2005 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--
+site2xhtml.xsl is the final stage in HTML page production. It merges HTML from
+document2html.xsl, tab2menu.xsl and book2menu.xsl, and adds the site header,
+footer, searchbar, css etc. As input, it takes XML of the form:
+
+<site>
+ <div class="menu">
+ ...
+ </div>
+ <div class="tab">
+ ...
+ </div>
+ <div class="content">
+ ...
+ </div>
+</site>
+
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:variable name="config" select="//skinconfig"/>
+ <!-- If true, a txt link for this page will not be generated -->
+ <xsl:variable name="disable-txt-link" select="//skinconfig/disable-txt-link"/>
+ <!-- If true, a PDF link for this page will not be generated -->
+ <xsl:variable name="disable-pdf-link" select="//skinconfig/disable-pdf-link"/>
+ <!-- If true, a "print" link for this page will not be generated -->
+ <xsl:variable name="disable-print-link" select="//skinconfig/disable-print-link"/>
+ <!-- If true, an XML link for this page will not be generated -->
+ <xsl:variable name="disable-xml-link" select="//skinconfig/disable-xml-link"/>
+ <!-- If true, a POD link for this page will not be generated -->
+ <xsl:variable name="disable-pod-link" select="//skinconfig/disable-pod-link"/>
+ <!-- Get the location where to generate the minitoc -->
+ <xsl:variable name="minitoc-location" select="//skinconfig/toc/@location"/>
+
+ <xsl:param name="path"/>
+
+ <xsl:include href="dotdots.xsl"/>
+ <xsl:include href="pathutils.xsl"/>
+ <xsl:include href="renderlogo.xsl"/>
+
+ <!-- Path (..'s) to the root directory -->
+ <xsl:variable name="root">
+ <xsl:call-template name="dotdots">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!-- Source filename (eg 'foo.xml') of current page -->
+ <xsl:variable name="filename">
+ <xsl:call-template name="filename">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!-- Path of Lucene search results page (relative to $root) -->
+ <xsl:param name="lucene-search" select="'lucene-search.html'"/>
+
+ <xsl:variable name="filename-noext">
+ <xsl:call-template name="filename-noext">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!-- Whether to obfuscate email links -->
+ <xsl:variable name="obfuscate-mail-links" select="//skinconfig/obfuscate-mail-links"/>
+ <!-- If true, the font size script will not be rendered -->
+ <xsl:variable name="disable-font-script" select="//skinconfig/disable-font-script"/>
+ <!-- If true, an the images on all external links will not be added -->
+ <xsl:variable name="disable-external-link-image" select="//skinconfig/disable-external-link-image"/>
+ <xsl:variable name="skin-img-dir" select="concat(string($root), 'skin/images')"/>
+ <xsl:variable name="spacer" select="concat($root, 'skin/images/spacer.gif')"/>
+
+ <xsl:template name="breadcrumbs">
+ <xsl:if test="(//skinconfig/trail/link1/@name)and(//skinconfig/trail/link1/@name!='')"><a href="{//skinconfig/trail/link1/@href}"><xsl:value-of select="//skinconfig/trail/link1/@name"/></a></xsl:if>
+ <xsl:if test="(//skinconfig/trail/link2/@name)and(//skinconfig/trail/link2/@name!='')"> > <a href="{//skinconfig/trail/link2/@href}"> <xsl:value-of select="//skinconfig/trail/link2/@name"/></a> </xsl:if>
+ <xsl:if test="(//skinconfig/trail/link3/@name)and(//skinconfig/trail/link3/@name!='')"> > <a href="{//skinconfig/trail/link3/@href}"> <xsl:value-of select="//skinconfig/trail/link3/@name"/></a> </xsl:if>
+ <script type="text/javascript" language="JavaScript" src="{$root}skin/breadcrumbs.js"/>
+ </xsl:template>
+
+ <xsl:template match="site">
+ <html>
+ <head>
+ <title><xsl:value-of select="div[@class='content']/table/tr/td/h1"/></title>
+ <xsl:if test="//skinconfig/favicon-url">
+ <link rel="shortcut icon">
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat($root,//skinconfig/favicon-url)"/>
+ </xsl:attribute>
+ </link>
+ </xsl:if>
+ </head>
+ <body>
+ <xsl:if test="//skinconfig/group-url">
+ <xsl:call-template name="renderlogo">
+ <xsl:with-param name="name" select="//skinconfig/group-name"/>
+ <xsl:with-param name="url" select="//skinconfig/group-url"/>
+ <xsl:with-param name="logo" select="//skinconfig/group-logo"/>
+ <xsl:with-param name="root" select="$root"/>
+ <xsl:with-param name="description" select="//skinconfig/group-description"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:call-template name="renderlogo">
+ <xsl:with-param name="name" select="//skinconfig/project-name"/>
+ <xsl:with-param name="url" select="//skinconfig/project-url"/>
+ <xsl:with-param name="logo" select="//skinconfig/project-logo"/>
+ <xsl:with-param name="root" select="$root"/>
+ <xsl:with-param name="description" select="//skinconfig/project-description"/>
+ </xsl:call-template>
+ <xsl:comment>================= start Tabs ==================</xsl:comment>
+ <xsl:apply-templates select="div[@class='tab']"/>
+ <xsl:comment>================= end Tabs ==================</xsl:comment>
+ <xsl:comment>================= start Menu items ==================</xsl:comment>
+ <xsl:apply-templates select="div[@class='menu']"/>
+ <xsl:comment>================= end Menu items ==================</xsl:comment>
+ <xsl:comment>================= start Content==================</xsl:comment>
+ <xsl:apply-templates select="div[@class='content']"/>
+ <xsl:comment>================= end Content==================</xsl:comment>
+
+ <xsl:comment>================= start Footer ==================</xsl:comment>
+ <xsl:choose>
+ <xsl:when test="$config/copyright-link">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$config/copyright-link"/>
+ </xsl:attribute>
+ Copyright © <xsl:value-of select="$config/year"/> 
+ <xsl:value-of select="$config/vendor"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ Copyright © <xsl:value-of select="$config/year"/> 
+ <xsl:value-of select="$config/vendor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ All rights reserved.
+ <script language="JavaScript" type="text/javascript"><![CDATA[<!--
+ document.write(" - "+"Last Published: " + document.lastModified);
+ // -->]]></script>
+ <xsl:if test="//skinconfig/host-logo and not(//skinconfig/host-logo = '')">
+ <a href="{//skinconfig/host-url}">
+ <xsl:call-template name="renderlogo">
+ <xsl:with-param name="name" select="//skinconfig/host-name"/>
+ <xsl:with-param name="url" select="//skinconfig/host-url"/>
+ <xsl:with-param name="logo" select="//skinconfig/host-logo"/>
+ <xsl:with-param name="root" select="$root"/>
+ </xsl:call-template>
+ </a>
+ </xsl:if>
+ <xsl:if test="$filename = 'index.html' and //skinconfig/credits">
+ <xsl:for-each select="//skinconfig/credits/credit[not(@role='pdf')]">
+ <xsl:call-template name="renderlogo">
+ <xsl:with-param name="name" select="name"/>
+ <xsl:with-param name="url" select="url"/>
+ <xsl:with-param name="logo" select="image"/>
+ <xsl:with-param name="root" select="$root"/>
+ <xsl:with-param name="width" select="width"/>
+ <xsl:with-param name="height" select="height"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <a href="http://validator.w3.org/check/referer"><img class="skin" border="0"
+ src="http://www.w3.org/Icons/valid-html401"
+ alt="Valid HTML 4.01!" height="31" width="88"/></a>
+ </body>
+ </html>
+ </xsl:template>
+
+ <!-- Add links to any standards-compliance logos -->
+ <xsl:template name="compliancy-logos">
+ <xsl:if test="$filename = 'index.html' and //skinconfig/disable-compliance-links = 'false'">
+ <a href="http://validator.w3.org/check/referer"><img class="logoImage"
+ src="{$skin-img-dir}/valid-html401.png"
+ alt="Valid HTML 4.01!" title="Valid HTML 4.01!" height="31" width="88" border="0"/></a>
+
+ <a href="http://jigsaw.w3.org/css-validator/check/referer"><img class="logoImage"
+ src="{$skin-img-dir}/vcss.png"
+ alt="Valid CSS!" title="Valid CSS!" height="31" width="88" border="0"/></a>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Generates the PDF link -->
+ <xsl:template match="div[@id='skinconf-pdflink']">
+ <xsl:if test="not($config/disable-pdf-link) or $disable-pdf-link = 'false'">
+ <td align="center" width="40" nowrap="nowrap"><a href="{$filename-noext}.pdf" class="dida">
+ <img class="skin" src="{$skin-img-dir}/pdfdoc.gif" alt="PDF"/><br/>
+ PDF</a>
+ </td>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Generates the TXT link -->
+ <xsl:template match="div[@id='skinconf-txtlink']">
+ <xsl:if test="$disable-txt-link = 'false'">
+ <td align="center" width="40" nowrap="nowrap"><a href="{$filename-noext}.txt" class="dida">
+ <img class="skin" src="{$skin-img-dir}/txtdoc.png" alt="TXT"/><br/>
+ TXT</a>
+ </td>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Generates the POD link -->
+ <xsl:template match="div[@id='skinconf-podlink']">
+ <xsl:if test="$disable-pod-link = 'false'">
+ <td align="center" width="40" nowrap="nowrap"><a href="{$filename-noext}.pod" class="dida">
+ <img class="skin" src="{$skin-img-dir}/poddoc.png" alt="POD"/><br/>
+ POD</a>
+ </td>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Generates the XML link -->
+ <xsl:template match="div[@id='skinconf-xmllink']">
+ <xsl:if test="$disable-xml-link = 'false'">
+ <td align="center" width="40" nowrap="nowrap"><a href="{$filename-noext}.xml" class="dida">
+ <img class="skin" src="{$skin-img-dir}/xmldoc.gif" alt="XML"/><br/>
+ XML</a>
+ </td>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Generates the "printer friendly version" link -->
+ <xsl:template match="div[@id='skinconf-printlink']">
+ <xsl:if test="$disable-print-link = 'false'">
+<script type="text/javascript" language="Javascript">
+function printit() {
+ if (window.print) {
+ window.focus();
+ window.print();
+ }
+}
+
+var NS = (navigator.appName == "Netscape");
+var VERSION = parseInt(navigator.appVersion);
+if (VERSION > 3) {
+ document.write('<td align="center" width="40" nowrap="nowrap">');
+ document.write(' <a href="javascript:printit()" class="dida">');
+ document.write(' <img class="skin" src="{$skin-img-dir}/printer.gif" alt="Print this Page"/><br />');
+ document.write(' print</a>');
+ document.write('</td>');
+}
+</script>
+
+ </xsl:if>
+ </xsl:template>
+
+ <!-- handle all obfuscating mail links and disabling external link images -->
+ <xsl:template match="a">
+ <xsl:choose>
+ <xsl:when test="$obfuscate-mail-links='true' and starts-with(@href, 'mailto:') and contains(@href, '@')">
+ <xsl:variable name="mailto-1" select="substring-before(@href,'@')"/>
+ <xsl:variable name="mailto-2" select="substring-after(@href,'@')"/>
+ <xsl:variable name="obfuscation" select="normalize-space(//skinconfig/obfuscate-mail-value)"/>
+ <a href="{$mailto-1}{$obfuscation}{$mailto-2}">
+ <xsl:apply-templates/>
+ </a>
+ </xsl:when>
+ <xsl:when test="not($disable-external-link-image='true') and contains(@href, ':') and not(contains(@href, //skinconfig/group-url)) and not(contains(@href, //skinconfig/project-url))">
+ <a href="{@href}" class="external">
+ <xsl:apply-templates/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- xsl:copy-of makes sure we copy <a href> as well as <a name>
+ or any other <a ...> forms -->
+ <xsl:copy-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="div[@id='skinconf-toc-page']">
+ <xsl:if test="$config/toc">
+ <xsl:if test="contains($minitoc-location,'page')">
+ <xsl:if test="count(//tocitems/tocitem) >= $config/toc/@min-sections">
+ <xsl:call-template name="minitoc">
+ <xsl:with-param name="tocroot" select="//tocitems"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="minitoc">
+ <xsl:param name="tocroot"/>
+ <xsl:if test="count($tocroot/tocitem) >= $config/toc/@min-sections">
+ <xsl:if test="contains($config/toc/@location,'page')">
+ <ul class="minitoc">
+ <xsl:for-each select="$tocroot/tocitem">
+ <li>
+ <a href="{@href}">
+ <xsl:value-of select="@title"/>
+ </a>
+ <xsl:if test="@level<//skinconfig/toc/@max-depth+1">
+ <xsl:call-template name="minitoc">
+ <xsl:with-param name="tocroot" select="."/>
+ </xsl:call-template>
+ </xsl:if>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="html-meta">
+ <meta name="Generator" content="Apache Forrest"/>
+ <meta name="Forrest-version">
+ <xsl:attribute name="content">
+ <xsl:value-of select="//info/forrest-version"/>
+ </xsl:attribute>
+ </meta>
+ <meta name="Forrest-skin-name">
+ <xsl:attribute name="content">
+ <xsl:value-of select="//info/project-skin"/>
+ </xsl:attribute>
+ </meta>
+ </xsl:template>
+
+ <!-- meta information from v 2.0 documents
+ FIXME: the match is really inefficient -->
+ <xsl:template name="meta-data">
+ <xsl:for-each select="//meta-data/meta">
+ <xsl:element name="meta">
+ <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
+ <xsl:attribute name="content"><xsl:value-of select="."/></xsl:attribute>
+ <xsl:if test="@xml:lang">
+ <xsl:attribute name="lang"><xsl:value-of select="@xml:lang"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="feedback">
+ <div id="feedback">
+ <xsl:value-of select="$config/feedback"/>
+ <xsl:choose>
+ <xsl:when test="$config/feedback/@href and not($config/feedback/@href='')">
+ <a id="feedbackto">
+ <xsl:attribute name="href">
+ <xsl:value-of select="$config/feedback/@href"/>
+ <xsl:value-of select="$path"/>
+ </xsl:attribute>
+ <xsl:value-of select="$config/feedback/@to"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$config/feedback/@to"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="node()|@*" priority="-1">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: forrest/trunk/main/webapp/skins/common/xslt/html/site-to-xhtml.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/main/webapp/skins/common/xslt/html/tab-to-menu.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/skins/common/xslt/html/tab-to-menu.xsl?rev=307242&view=auto
==============================================================================
--- forrest/trunk/main/webapp/skins/common/xslt/html/tab-to-menu.xsl (added)
+++ forrest/trunk/main/webapp/skins/common/xslt/html/tab-to-menu.xsl Fri Oct 7 19:53:10 2005
@@ -0,0 +1,227 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2002-2005 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--
+This stylesheet generates 'tabs' at the top left of the screen. Tabs are
+visual indicators that a certain subsection of the URI space is being browsed.
+For example, if we had tabs with paths:
+
+Tab1: ''
+Tab2: 'community'
+Tab3: 'community/howto'
+Tab4: 'community/howto/xmlform/index.html'
+
+Then if the current path was 'community/howto/foo', Tab3 would be highlighted.
+The rule is: the tab with the longest path that forms a prefix of the current
+path is enabled.
+
+The output of this stylesheet is HTML of the form:
+ <div class="tab">
+ ...
+ </div>
+
+which is then merged by site2xhtml.xsl
+
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <!-- ================================================================ -->
+ <!-- These templates SHOULD be overridden -->
+ <!-- ================================================================ -->
+
+ <!-- Called before first level 1 tag -->
+ <xsl:template name="pre-separator">
+ </xsl:template>
+
+ <!-- Called after last level 1 tag -->
+ <xsl:template name="post-separator">
+ </xsl:template>
+
+ <!-- Called between level 1 tags -->
+ <xsl:template name="separator">
+ <xsl:text> | </xsl:text>
+ </xsl:template>
+
+ <!-- Called before first level 2 tag -->
+ <xsl:template name="level2-pre-separator">
+ </xsl:template>
+
+ <!-- Called after last level 2 tag -->
+ <xsl:template name="level2-post-separator">
+ </xsl:template>
+
+ <!-- Called between level 2 tags -->
+ <xsl:template name="level2-separator">
+ <xsl:text> | </xsl:text>
+ </xsl:template>
+
+ <!--
+ Note: sub-stylesheets can't do apply-imports here, because it would choose
+ the 'tags' template and infinitely recurse. Hence call-template used instead.
+ -->
+
+ <!-- Display a selected level 1 tab node -->
+ <xsl:template name="selected">
+ <xsl:call-template name="base-selected"/>
+ </xsl:template>
+
+ <!-- Display an unselected level 1 tab node -->
+ <xsl:template name="not-selected">
+ <xsl:call-template name="base-not-selected"/>
+ </xsl:template>
+
+ <!-- Display a selected second level tab node -->
+ <xsl:template name="level2-selected">
+ <xsl:call-template name="base-selected"/>
+ </xsl:template>
+
+ <!-- Display an unselected second level tab node -->
+ <xsl:template name="level2-not-selected">
+ <xsl:call-template name="base-not-selected"/>
+ </xsl:template>
+
+ <!-- ================================================================ -->
+ <!-- These templates CAN be overridden -->
+ <!-- ================================================================ -->
+
+ <xsl:template match="tabs">
+ <div class="tab">
+ <xsl:call-template name="base-tabs"/>
+ </div>
+ </xsl:template>
+
+
+ <!-- ================================================================ -->
+ <!-- These templates SHOULD NOT be overridden -->
+ <!-- ================================================================ -->
+
+ <xsl:param name="path"/>
+
+ <xsl:include href="dotdots.xsl"/>
+ <xsl:include href="tabutils.xsl"/>
+
+ <!-- NOTE: Xalan has a bug (race condition?) where sometimes $root is only half-evaluated -->
+ <xsl:variable name="root">
+ <xsl:call-template name="dotdots">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="skin-img-dir" select="concat(string($root), 'skin/images')"/>
+
+ <!--
+ The longest path of any level 1 tab, whose path is a subset of the current URL. Ie,
+ the path of the 'current' level 1 tab.
+ -->
+ <xsl:variable name="longest-dir">
+ <xsl:call-template name="longest-dir">
+ <xsl:with-param name="tabfile" select="/"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!--
+ The longest path of any level 2 tab, whose path is a subset of the current URL. Ie,
+ the path of the 'current' level 2 tab.
+ -->
+ <xsl:variable name="level2-longest-dir">
+ <xsl:call-template name="level2-longest-dir">
+ <xsl:with-param name="tabfile" select="/"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="matching-id">
+ <xsl:call-template name="matching-id"/>
+ </xsl:variable>
+
+ <!-- Called from tabs, after it has written the outer 'div class=tabs' and
+ any other HTML -->
+ <xsl:template name="base-tabs">
+ <xsl:call-template name="pre-separator"/>
+ <xsl:for-each select="tab">
+ <xsl:if test="position()!=1"><xsl:call-template name="separator"/></xsl:if>
+ <xsl:apply-templates select="." mode="level1"/>
+ </xsl:for-each>
+ <xsl:call-template name="post-separator"/>
+ </xsl:template>
+
+ <!-- Called from tabs, after it has written the outer 'div class=tabs' and
+ any other HTML -->
+ <xsl:template name="level2tabs">
+ <xsl:call-template name="level2-pre-separator"/>
+ <xsl:for-each select="tab[@dir=$longest-dir]/tab|tab[@href=$longest-dir]/tab">
+ <xsl:if test="position()!=1"><xsl:call-template name="level2-separator"/></xsl:if>
+ <xsl:apply-templates select="." mode="level2"/>
+ </xsl:for-each>
+ <xsl:call-template name="level2-post-separator"/>
+ </xsl:template>
+
+ <xsl:template match="tab" mode="level1">
+ <xsl:choose>
+ <xsl:when test="@id and @id = $matching-id">
+ <xsl:call-template name="selected"/>
+ </xsl:when>
+ <xsl:when test="not(@id) and @dir = $longest-dir or @href = $longest-dir">
+ <xsl:call-template name="selected"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="not-selected"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="tab" mode="level2">
+ <xsl:choose>
+ <xsl:when test="@id and @id = $matching-id">
+ <xsl:call-template name="level2-selected"/>
+ </xsl:when>
+ <xsl:when test="@dir = $level2-longest-dir">
+ <xsl:call-template name="level2-selected"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="level2-not-selected"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Called from 'selected' -->
+ <xsl:template name="base-selected">
+ <a class="base-selected">
+ <xsl:attribute name="href">
+ <xsl:call-template name="calculate-tab-href">
+ <xsl:with-param name="tab" select="."/>
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:value-of select="@label"/>
+ </a>
+ </xsl:template>
+
+ <!-- Called from 'not-selected' -->
+ <xsl:template name="base-not-selected">
+ <a class="base-not-selected">
+ <xsl:attribute name="href">
+ <xsl:call-template name="calculate-tab-href">
+ <xsl:with-param name="tab" select="."/>
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:value-of select="@label"/>
+ </a>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: forrest/trunk/main/webapp/skins/common/xslt/html/tab-to-menu.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/main/webapp/skins/common/xslt/svg/document-to-svg.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/skins/common/xslt/svg/document-to-svg.xsl?rev=307242&view=auto
==============================================================================
--- forrest/trunk/main/webapp/skins/common/xslt/svg/document-to-svg.xsl (added)
+++ forrest/trunk/main/webapp/skins/common/xslt/svg/document-to-svg.xsl Fri Oct 7 19:53:10 2005
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2002-2005 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
+ <xsl:output method="xml" media-type="image/svg" omit-xml-declaration="yes" indent="yes"/>
+
+ <!-- the skinconf file -->
+ <xsl:param name="config-file"/>
+ <xsl:variable name="config" select="document($config-file)/skinconfig"/>
+ <!-- Get the section depth to use when generating the minitoc (default is 2) -->
+ <xsl:variable name="toc-max-depth" select="number($config/toc/@max-depth)"/>
+
+ <xsl:param name="numbersections" select="'true'"/>
+
+ <!-- Section depth at which we stop numbering and just indent -->
+ <xsl:param name="numbering-max-depth" select="'3'"/>
+ <xsl:param name="ctxbasedir" select="."/>
+ <xsl:param name="xmlbasedir"/>
+
+ <xsl:template match="/">
+ <svg width="1305" height="1468" xmlns="http://www.w3.org/2000/svg">
+ <g transform="translate(0 0)">
+ <xsl:apply-templates/>
+ </g>
+ </svg>
+ </xsl:template>
+
+ <xsl:template match="document">
+ <text x="00px" y="30px" style="font-size:20;"><xsl:value-of select="header/title"/></text>
+ <text x="0px" y="50px" style="font-size:12;">
+ <xsl:apply-templates/>
+ </text>
+ </xsl:template>
+
+
+</xsl:stylesheet>
Propchange: forrest/trunk/main/webapp/skins/common/xslt/svg/document-to-svg.xsl
------------------------------------------------------------------------------
svn:eol-style = native