优化项目结构、优化 maven 结构

This commit is contained in:
chenkailing
2021-02-10 00:58:13 +08:00
parent 28d3e05ca9
commit 2542a24675
3610 changed files with 77 additions and 180 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,481 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*
***********************************************************-->
<!--
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dom="http://www.w3.org/2001/xml-events"
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:ooo="http://openoffice.org/2004/office"
xmlns:oooc="http://openoffice.org/2004/calc"
xmlns:ooow="http://openoffice.org/2004/writer"
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xforms xsd xsi"
xmlns="http://www.w3.org/1999/xhtml">
<!-- ************** -->
<!-- *** header *** -->
<!-- ************** -->
<xsl:template name="create-header">
<xsl:param name="globalData" />
<xsl:element name="head">
<xsl:attribute name="profile">http://dublincore.org/documents/dcmi-terms/</xsl:attribute>
<xsl:if test="$debugEnabled"><xsl:message>CSS helper variable will be created....</xsl:message></xsl:if>
<xsl:call-template name='xhtml-header-properties'>
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
<xsl:if test="$debugEnabled"><xsl:message>CSS variable ready, header will be created....</xsl:message></xsl:if>
<!-- constructing the css header simulating inheritance of style-families by style order -->
<xsl:call-template name='create-css-styleheader'>
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
<xsl:if test="$debugEnabled"><xsl:message>CSS header creation finished!</xsl:message></xsl:if>
</xsl:element>
</xsl:template>
<!-- Creating a CSS style header from the collected styles of the 'globalData' parameter -->
<xsl:template name='create-css-styleheader'>
<xsl:param name="globalData" />
<xsl:element name="style">
<xsl:attribute name="type">text/css</xsl:attribute>
<xsl:text>
</xsl:text>
<xsl:call-template name='create-page-layout'>
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
<xsl:text>table { border-collapse:collapse; border-spacing:0; empty-cells:show }
</xsl:text>
<xsl:choose>
<xsl:when test="/*/office:body/office:spreadsheet"><xsl:text>td, th { vertical-align:top; font-size:10pt;}
</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>td, th { vertical-align:top; font-size:12pt;}
</xsl:text></xsl:otherwise>
</xsl:choose>
<xsl:text>h1, h2, h3, h4, h5, h6 { clear:both }
</xsl:text>
<xsl:text>ol, ul { margin:0; padding:0;}
</xsl:text>
<xsl:text>li { list-style: none; margin:0; padding:0;}
</xsl:text>
<xsl:comment> "li span.odfLiEnd" - IE 7 issue</xsl:comment>
<xsl:text>
</xsl:text>
<xsl:text>li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; }
</xsl:text>
<xsl:text>span.footnodeNumber { padding-right:1em; }
</xsl:text>
<xsl:text>span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000; margin:0; border:0; padding:0; }
</xsl:text>
<xsl:text>* { margin:0;}
</xsl:text>
<xsl:call-template name="write-mapped-CSS-styles">
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
</xsl:element>
</xsl:template>
<xsl:template name="write-mapped-CSS-styles">
<xsl:param name="globalData" />
<xsl:param name="styleNo" select="1"/>
<xsl:param name="emptyStyles"/>
<xsl:choose>
<xsl:when test="$globalData/all-styles/style[$styleNo]">
<!-- If there is still a style to be written -->
<!-- setting the context -->
<xsl:for-each select="$globalData/all-styles/style[$styleNo]">
<xsl:choose>
<xsl:when test="final-properties != ''">
<!-- NOTE: easy process, as only the style family in conjunction with the style name, makes the style unambigous -->
<xsl:text>.</xsl:text><!--<xsl:value-of select="@style:family" /><xsl:text>:</xsl:text>--><xsl:value-of select="translate(@style:name, '.,;: %()[]/\+', '_____________')"/><xsl:text> { </xsl:text> <xsl:value-of select="final-properties" /><xsl:text>}
</xsl:text>
<xsl:call-template name="write-mapped-CSS-styles">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="emptyStyles" select="$emptyStyles"/>
<xsl:with-param name="styleNo" select="$styleNo + 1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="write-mapped-CSS-styles">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="emptyStyles" select="concat($emptyStyles, '.', @style:name, ' ')"/>
<xsl:with-param name="styleNo" select="$styleNo + 1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<!-- Otherwise all styles have been processed and the empty styles have to be given out -->
<xsl:comment> ODF styles with no properties representable as CSS </xsl:comment><xsl:text>
</xsl:text><xsl:value-of select="$emptyStyles"/><xsl:text>{ }
</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Creating CSS page layout based on first office master style -->
<xsl:template name='create-page-layout'>
<xsl:param name="globalData" />
<!-- approximation to find the correct master page style (with page dimensions) -->
<xsl:variable name="masterPageNames">
<!-- set context to styles.xml -->
<xsl:for-each select="$globalData/all-doc-styles/style">
<!-- Loop over every style:style containing a @style:master-page-name attribute -->
<xsl:for-each select="key('masterPage','count')">
<!-- set context to styles.xml -->
<xsl:for-each select="/*/office:body">
<!-- Check if this style is being used in the body -->
<xsl:if test="key('elementUsingStyle', ../@style:name)">
<!-- Check every master-page-name if it is not emtpy and return as ';' separated list -->
<xsl:if test="string-length(../@style:master-page-name) &gt; 0"><xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:variable>
<!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name -->
<xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
<!-- Find the according style:page-layout and store the properties in a variable -->
<xsl:variable name="pageProperties" select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties"/>
<xsl:text>@page { </xsl:text>
<xsl:call-template name="page-size">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="pageProperties" select="$pageProperties" />
</xsl:call-template>
<xsl:call-template name="page-margin">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="pageProperties" select="$pageProperties" />
</xsl:call-template>
<xsl:text> }
</xsl:text>
</xsl:template>
<xsl:template name="page-size">
<xsl:param name="globalData" />
<xsl:param name="pageProperties" />
<xsl:variable name="printOrientation" select="$pageProperties/@style:print-orientation" />
<xsl:variable name="pageWidth" select="$pageProperties/@fo:page-width" />
<xsl:variable name="pageHeight" select="$pageProperties/@fo:page-height" />
<xsl:choose>
<xsl:when test="$pageWidth and $pageHeight">
<xsl:text>size: </xsl:text>
<xsl:value-of select="$pageWidth" />
<xsl:text> </xsl:text>
<xsl:value-of select="$pageHeight" />
<xsl:text>; </xsl:text>
</xsl:when>
<xsl:when test="$printOrientation">
<xsl:text>size: </xsl:text>
<xsl:value-of select="$printOrientation" />
<xsl:text>; </xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="page-margin">
<xsl:param name="globalData" />
<xsl:param name="pageProperties" />
<xsl:variable name="marginTop" select="$pageProperties/@fo:margin-top" />
<xsl:if test="$marginTop">
<xsl:text>margin-top: </xsl:text>
<xsl:value-of select="$marginTop" />
<xsl:text>; </xsl:text>
</xsl:if>
<xsl:variable name="marginBottom" select="$pageProperties/@fo:margin-bottom" />
<xsl:if test="$marginBottom">
<xsl:text>margin-bottom: </xsl:text>
<xsl:value-of select="$marginBottom" />
<xsl:text>; </xsl:text>
</xsl:if>
<xsl:variable name="marginLeft" select="$pageProperties/@fo:margin-left" />
<xsl:if test="$marginLeft">
<xsl:text>margin-left: </xsl:text>
<xsl:value-of select="$marginLeft" />
<xsl:text>; </xsl:text>
</xsl:if>
<xsl:variable name="marginRight" select="$pageProperties/@fo:margin-right" />
<xsl:if test="$marginRight">
<xsl:text>margin-right: </xsl:text>
<xsl:value-of select="$marginRight" />
</xsl:if>
</xsl:template>
<!-- *************************** -->
<!-- *** Common XHTML header *** -->
<!-- *************************** -->
<xsl:template name='xhtml-header-properties'>
<xsl:param name="globalData" />
<xsl:variable name="netloc">
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
<xsl:if test="./@meta:name='ODF.base'">
<xsl:value-of select="." />
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
<xsl:if test="./@meta:name='ODF.filename'">
<xsl:value-of select="." />
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="lang">
<xsl:choose>
<xsl:when test="$globalData/meta-file/*/office:meta/dc:language">
<xsl:value-of select="$globalData/meta-file/*/office:meta/dc:language" />
</xsl:when>
<xsl:otherwise>en-US</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="prov">
<xsl:choose>
<xsl:when test="$globalData/meta-file/*/office:meta/meta:printed-by">
<xsl:value-of select="concat('Printed by &quot;',$globalData/meta-file/*/office:meta/meta:printed-by,'&quot;[dc:publisher] on &quot;',$globalData/meta-file/*/office:meta/meta:print-date,'&quot;[dc:date] in &quot;',$lang,'&quot;[dc:language]')" />
</xsl:when>
<xsl:otherwise />
</xsl:choose>
</xsl:variable>
<xsl:variable name="keywords">
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:keyword">
<xsl:value-of select="." />
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<!-- explicit output content-type for low-tech browser (e.g. IE6) -->
<xsl:element name="meta">
<xsl:attribute name="http-equiv">Content-Type</xsl:attribute>
<xsl:attribute name="content">application/xhtml+xml; charset=utf-8</xsl:attribute>
</xsl:element>
<!-- title of document for browser frame title -->
<xsl:element name="title">
<xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
<xsl:value-of select="$lang" />
</xsl:attribute>
<xsl:choose>
<xsl:when test="$globalData/meta-file/*/office:meta/dc:title">
<xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
</xsl:when>
<!-- providing the mandatory title is a workaround for an IE bug-->
<xsl:otherwise>
<xsl:text>- no title specified</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
<!-- title, in DC syntax -->
<xsl:element name="meta">
<xsl:attribute name="name">DCTERMS.title</xsl:attribute>
<xsl:attribute name="content">
<xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
</xsl:attribute>
<xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
<xsl:value-of select="$lang" />
</xsl:attribute>
</xsl:element>
<!-- the identifier for source (identifier) -->
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.identifier'" />
<xsl:with-param name="meta-data" select="translate($netloc, ' ','')" />
<xsl:with-param name="meta-enc" select="'DCTERMS.URI'" />
</xsl:call-template>
<!-- the language for source (language) -->
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.language'" />
<xsl:with-param name="meta-data" select="$lang" />
<xsl:with-param name="meta-enc" select="'DCTERMS.RFC4646'" />
</xsl:call-template>
<!-- a bit commercial (generator) -->
<xsl:element name="meta">
<xsl:attribute name="name">DCTERMS.source</xsl:attribute>
<xsl:attribute name="content">http://xml.openoffice.org/odf2xhtml</xsl:attribute>
</xsl:element>
<!-- the author of the input source (author) -->
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.creator'" />
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:initial-creator" />
</xsl:call-template>
<!-- creation-date of the input source (issued) -->
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.issued'" />
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:creation-date" />
<xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
</xsl:call-template>
<!-- name of last changing person of the input source (changedby) -->
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.contributor'" />
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:creator" />
</xsl:call-template>
<!-- last changing date of the input source (changed) -->
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.modified'" />
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:date" />
<xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
</xsl:call-template>
<!-- Last print, as provenance -->
<xsl:if test="$prov">
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.provenance'" />
<xsl:with-param name="meta-data" select="$prov" />
<xsl:with-param name="meta-lang" select="$lang" />
</xsl:call-template>
</xsl:if>
<!-- keywords about the input source (keywords) -->
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.subject'" />
<xsl:with-param name="meta-data" select="normalize-space(concat($globalData/meta-file/*/office:meta/dc:subject,', ',$keywords))" />
<xsl:with-param name="meta-lang" select="$lang" />
</xsl:call-template>
<!-- detailed description about the input source (description) -->
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.description'" />
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:description" />
<xsl:with-param name="meta-lang" select="$lang" />
</xsl:call-template>
<!-- user defined use of DCTERM tags -->
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DCTERMS.')][not(.='')]">
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="@meta:name" />
<xsl:with-param name="meta-data" select="." />
<!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
</xsl:call-template>
</xsl:for-each>
<!-- user defined use of DC tags (legacy) -->
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DC.')][not(.='')]">
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="@meta:name" />
<xsl:with-param name="meta-data" select="." />
<!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
</xsl:call-template>
</xsl:for-each>
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en" />
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en" />
<link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en" />
<link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en" />
<!-- W3C GRDDL Profile -->
<!--
<link rel="transformation" href="http://xml.openoffice.org/odf2xhtml/rdf-extract.xsl" />
-->
<!-- base URL of document for resolving relative links
NOTE: CHROME has a problem, with relative references as from content table, referencing to root directory instead of document
<xsl:element name="base">
<xsl:attribute name="href">-->
<!-- earlier 'targetURL' was used for an absoulte reference of base provided by the Office (file URL)
<xsl:value-of select="$targetURL" />
now '.' let relative links work, even if document has been moved -->
<!--<xsl:text>.</xsl:text>
</xsl:attribute>
</xsl:element>-->
</xsl:template>
<!-- generic template for adding common meta tags -->
<xsl:template name="add-meta-tag">
<xsl:param name="meta-name" />
<xsl:param name="meta-data" />
<xsl:param name="meta-enc" />
<xsl:param name="meta-lang" />
<xsl:if test="$meta-data">
<xsl:element name="meta">
<xsl:attribute name="name">
<xsl:value-of select="$meta-name" />
</xsl:attribute>
<xsl:attribute name="content">
<xsl:value-of select="$meta-data" />
</xsl:attribute>
<xsl:if test="$meta-enc">
<xsl:attribute name="scheme">
<xsl:value-of select="$meta-enc" />
</xsl:attribute>
</xsl:if>
<xsl:if test="$meta-lang">
<xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
<xsl:value-of select="$meta-lang" />
</xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*
***********************************************************-->
<!--
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dom="http://www.w3.org/2001/xml-events"
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:ooo="http://openoffice.org/2004/office"
xmlns:oooc="http://openoffice.org/2004/calc"
xmlns:ooow="http://openoffice.org/2004/writer"
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xforms xsd xsi"
xmlns="http://www.w3.org/1999/xhtml">
<!--+++++ INCLUDED XSL MODULES +++++-->
<!-- inheritance of office style properties is resolved into absolute styles. Office properties gathered as elements -->
<xsl:include href="../common/styles/style_collector.xsl" />
<!-- mapping rules of office style properties to CSS/HTML properties -->
<xsl:include href="../common/styles/style_mapping_css.xsl" />
<!-- office header element handling especially for XHTML -->
<xsl:include href="header.xsl" />
<!-- office body element handling especially for XHTML -->
<xsl:include href="body.xsl" />
<xsl:output method = "xml"
encoding = "UTF-8"
media-type = "application/xhtml+xml"
indent = "no"
omit-xml-declaration = "no"
doctype-public = "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
doctype-system = "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd" />
<xsl:variable name="namespace" select="'http://www.w3.org/1999/xhtml'" />
<!--+++++ PARAMETER SECTION +++++-->
<!-- OPTIONAL: if the document content is provided in a directory structure. Opposite to a single flat XML stream -->
<xsl:param name="isPackageFormat" />
<!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is a absolute file URL to the target directory.
Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix -->
<xsl:param name="targetBaseURL" select="'./'" />
<!-- OPTIONAL: (MANDATORY: for all input document with content table) : parameter is a absolute file URL to the target document.
Relative links to this office document (e.g. to internal anchor) will get this parameter as a prefix -->
<xsl:param name="targetURL" select="'./'" />
<!-- OPTIONAL: (MANDATORY: for input document with relative internal links)
To access contents of a office file (content like the meta.xml, styles.xml file or graphics) a URL could be choosen.
This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be
"jar:file:/C:/temp/Test.sxw!/" for example.
When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the the jared document. -->
<xsl:param name="sourceBaseURL" select="'./'" />
<!-- OPTIONAL: (MANDATORY: for session management by URL rewriting)
Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL).
This URL session is used for example when links to graphics are created by XSLT. Otherwise the user havt to log again in for every graphic he liks to see. -->
<xsl:param name="optionalURLSuffix" />
<!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
<xsl:param name="metaFileURL" />
<!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
<xsl:param name="stylesFileURL" />
<!-- OPTIONAL: DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')-->
<!-- Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
<!-- Cp. measure_conversion.xsl:
<xsl:param name="dpi" select="111" /> -->
<!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
(e.g. encoding chapter names for the content-table as href and anchors ) -->
<xsl:param name="java" select="true()" />
<xsl:param name="javaEnabled" select="boolean($java)" />
<!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
<xsl:param name="debug" select="false()" />
<xsl:param name="debugEnabled" select="boolean($debug)" />
<xsl:param name="onlyStyleOutput" select="false()" />
<xsl:param name="onlyStyleOutputEnabled" select="boolean($onlyStyleOutput)" />
<!-- ************************************* -->
<!-- *** build the propriate HTML file *** -->
<!-- ************************************* -->
<xsl:template match="/">
<!-- debug output of parameter value set -->
<xsl:if test="$debugEnabled">
<xsl:call-template name="debug-check-paramter" />
</xsl:if>
<!-- gathers style properties and
returns them as globalData parameter to the 'start-main' template -->
<xsl:call-template name="collect-global-odf-properties" />
</xsl:template>
<!-- *************************** -->
<!-- *** Built up XHTML file *** -->
<!-- *************************** -->
<xsl:template name="start-main">
<xsl:param name="globalData" />
<xsl:element name="html">
<xsl:comment>This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.</xsl:comment>
<xsl:call-template name='create-header'>
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
<xsl:call-template name='create-body'>
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
</xsl:element>
</xsl:template>
<!-- debug purpose only:
verbose checking of the parameters of this template-->
<xsl:template name="debug-check-paramter">
<xsl:message>Parameter dpi: <xsl:value-of select="$dpi" /></xsl:message>
<xsl:message>Parameter metaFileURL: <xsl:value-of select="$metaFileURL" /></xsl:message>
<xsl:message>Parameter stylesFileURL: <xsl:value-of select="$stylesFileURL" /></xsl:message>
<xsl:message>Parameter sourceBaseURL: <xsl:value-of select="$sourceBaseURL" /></xsl:message>
<xsl:message>Parameter targetBaseURL: <xsl:value-of select="$targetBaseURL" /></xsl:message>
<xsl:message>Parameter onlyStyleOutputEnabled: <xsl:value-of select="$onlyStyleOutputEnabled" /></xsl:message>
<xsl:message>Parameter debugEnabled: <xsl:value-of select="$debugEnabled" /></xsl:message>
<xsl:message>Parameter java: <xsl:value-of select="$java" /></xsl:message>
<xsl:message>Parameter javaEnabled: <xsl:value-of select="$javaEnabled" /></xsl:message>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,218 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*
***********************************************************-->
<!--
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dom="http://www.w3.org/2001/xml-events"
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:ooo="http://openoffice.org/2004/office"
xmlns:oooc="http://openoffice.org/2004/calc"
xmlns:ooow="http://openoffice.org/2004/writer"
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi"
xmlns="http://www.w3.org/1999/xhtml">
<!-- current node is a table:table -->
<xsl:template name="create-table-children">
<xsl:param name="globalData" />
<xsl:param name="allVisibleTableRows" />
<xsl:param name="allTableColumns" />
<xsl:element name="colgroup">
<xsl:for-each select="$allTableColumns/table:table-column">
<xsl:if test="not(@table:visibility = 'collapse' or @table:visibility = 'filter')">
<xsl:element name="col">
<xsl:variable name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:column-width" />
<xsl:if test="$value">
<xsl:attribute name="width">
<!-- using the absolute width, problems with the relative in browser (in OOo style:rel-column-width) -->
<xsl:call-template name="convert2px">
<xsl:with-param name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:column-width" />
</xsl:call-template>
</xsl:attribute>
</xsl:if>
</xsl:element>
<!-- *** the column-style ***
<xsl:attribute name="width">
<xsl:variable name="currentColumnStyleName" select="$allTableColumns/table:table-column[position() = $columnPosition]/@table:style-name" />
<xsl:value-of select="$globalData/all-doc-styles/style[@style:name = $currentColumnStyleName]/*/@style:column-width" />
</xsl:attribute>-->
</xsl:if>
</xsl:for-each>
</xsl:element>
<xsl:call-template name="create-table-rows">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
</xsl:call-template>
</xsl:template>
<!-- Creating the content of a table content using CSS styles -->
<xsl:template name="create-table-cell-content">
<xsl:param name="tableDataType" />
<xsl:param name="globalData" />
<xsl:param name="allTableColumns" />
<xsl:param name="columnPosition" />
<xsl:param name="currentTableColumn" />
<xsl:element name="{$tableDataType}">
<!-- if parser reads DTD the default is set to '1' -->
<xsl:if test="@table:number-columns-spanned and @table:number-columns-spanned > 1">
<xsl:attribute name="colspan">
<xsl:value-of select="@table:number-columns-spanned" />
</xsl:attribute>
</xsl:if>
<!-- if parser reads DTD the default is set to '1' -->
<xsl:if test="@table:number-rows-spanned and @table:number-rows-spanned > 1">
<xsl:attribute name="rowspan">
<xsl:value-of select="@table:number-rows-spanned" />
</xsl:attribute>
</xsl:if>
<!-- *** the cell-style *** -->
<!-- The cell style has no conclusion with the column style, so we switch the order/priorities due to browser issues
The cell-style depends on two attributes:
1) table:style-name - the style properties of cell. When they exist, a default alignement (cp. below) will be added for the
case of no alignment in the style exist.
2) office:value-type - the value type of the table-cell giving the default alignments.
By default a string value is left aligned, all other are aligned:right.
-->
<xsl:choose>
<xsl:when test="@table:style-name">
<xsl:call-template name="set-styles">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="styleName" select="@table:style-name" />
<xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- Cells without a style use the 'table:default-cell-style-name'
when there is no default cell style specified for the current column. -->
<xsl:variable name="defaultCellStyleName" select="$currentTableColumn/@table:default-cell-style-name" />
<xsl:choose>
<xsl:when test="$defaultCellStyleName">
<xsl:call-template name="set-styles">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="styleName" select="$defaultCellStyleName" />
<xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- No cell style exists, nor a default table cell style for the column -->
<xsl:attribute name="style">
<!-- sets cell alignment dependent of cell value type -->
<xsl:call-template name="set-cell-alignment" />
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$debugEnabled">
<xsl:message>A table cell '<xsl:value-of select="$tableDataType" />' element has been added!</xsl:message>
</xsl:if>
<!-- empty cell tags produce problems with width CSS style on itself other table cells as well
therefore an non breakable space (&nbsp;/&#160;) have been inserted.-->
<xsl:choose>
<xsl:when test="node()">
<xsl:call-template name="apply-styles-and-content">
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="apply-styles-and-content">
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
<xsl:text>&#160;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
<!-- Sets the cell alignment by the 'office:value-type' of the 'table:table-cell'.
Strings have a left alignment, other values right -->
<xsl:template name="set-cell-alignment">
<xsl:choose>
<xsl:when test="@office:value-type and not(@office:value-type = 'string')">text-align:right; </xsl:when>
<xsl:otherwise>text-align:left;</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Sets styles of a cell -->
<xsl:template name="set-styles">
<xsl:param name="globalData" />
<xsl:param name="styleName" />
<xsl:param name="currentTableColumn" />
<xsl:attribute name="style">
<!-- sets cell alignment dependent of cell value type -->
<xsl:call-template name="set-cell-alignment" />
<!-- set column style (disjunct of cell style) -->
<xsl:value-of select="$globalData/all-styles/style[@style:name = $currentTableColumn/@table:style-name]/final-properties" />
</xsl:attribute>
<!-- cell style header -->
<xsl:attribute name="class">
<xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>