?? xhtml2fo.xsl
字號:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright Antenna House, Inc. (http://www.antennahouse.com) 2001, 2002.
Since this stylesheet is originally developed by Antenna House to be used with XSL Formatter, it may not be compatible with another XSL-FO processors.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- modifed by N. Afshartous
- removed html: namespace prefix in templates so that the stylesheet would
- work with DOM output of JTidy Java API.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:html="http://www.w3.org/1999/xhtml">
<xsl:output method="xml"
version="1.0"
encoding="UTF-8"
indent="no"/>
<!--======================================================================
Parameters
=======================================================================-->
<!-- page size -->
<xsl:param name="page-width">auto</xsl:param>
<xsl:param name="page-height">auto</xsl:param>
<xsl:param name="page-margin-top">1in</xsl:param>
<xsl:param name="page-margin-bottom">1in</xsl:param>
<xsl:param name="page-margin-left">1in</xsl:param>
<xsl:param name="page-margin-right">1in</xsl:param>
<!-- page header and footer -->
<xsl:param name="page-header-margin">0.5in</xsl:param>
<xsl:param name="page-footer-margin">0.5in</xsl:param>
<xsl:param name="title-print-in-header">true</xsl:param>
<xsl:param name="page-number-print-in-footer">true</xsl:param>
<!-- multi column -->
<xsl:param name="column-count">1</xsl:param>
<xsl:param name="column-gap">12pt</xsl:param>
<!-- writing-mode: lr-tb | rl-tb | tb-rl -->
<xsl:param name="writing-mode">lr-tb</xsl:param>
<!-- text-align: justify | start -->
<xsl:param name="text-align">start</xsl:param>
<!-- hyphenate: true | false -->
<xsl:param name="hyphenate">false</xsl:param>
<!--======================================================================
Attribute Sets
=======================================================================-->
<!--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Root
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-->
<xsl:attribute-set name="root">
<xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
<xsl:attribute name="hyphenate"><xsl:value-of select="$hyphenate"/></xsl:attribute>
<xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
<!-- specified on fo:root to change the properties' initial values -->
</xsl:attribute-set>
<xsl:attribute-set name="page">
<xsl:attribute name="page-width"><xsl:value-of select="$page-width"/></xsl:attribute>
<xsl:attribute name="page-height"><xsl:value-of select="$page-height"/></xsl:attribute>
<!-- specified on fo:simple-page-master -->
</xsl:attribute-set>
<xsl:attribute-set name="body">
<!-- specified on fo:flow's only child fo:block -->
</xsl:attribute-set>
<xsl:attribute-set name="page-header">
<!-- specified on (page-header)fo:static-content's only child fo:block -->
<xsl:attribute name="font-size">small</xsl:attribute>
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="page-footer">
<!-- specified on (page-footer)fo:static-content's only child fo:block -->
<xsl:attribute name="font-size">small</xsl:attribute>
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:attribute-set>
<!--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Block-level
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-->
<xsl:attribute-set name="h1">
<xsl:attribute name="font-size">2em</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="space-before">0.67em</xsl:attribute>
<xsl:attribute name="space-after">0.67em</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="h2">
<xsl:attribute name="font-size">1.5em</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="space-before">0.83em</xsl:attribute>
<xsl:attribute name="space-after">0.83em</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="h3">
<xsl:attribute name="font-size">1.17em</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="space-before">1em</xsl:attribute>
<xsl:attribute name="space-after">1em</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="h4">
<xsl:attribute name="font-size">1em</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="space-before">1.17em</xsl:attribute>
<xsl:attribute name="space-after">1.17em</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="h5">
<xsl:attribute name="font-size">0.83em</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="space-before">1.33em</xsl:attribute>
<xsl:attribute name="space-after">1.33em</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="h6">
<xsl:attribute name="font-size">0.67em</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="space-before">1.67em</xsl:attribute>
<xsl:attribute name="space-after">1.67em</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="p">
<xsl:attribute name="space-before">1em</xsl:attribute>
<xsl:attribute name="space-after">1em</xsl:attribute>
<!-- e.g.,
<xsl:attribute name="text-indent">1em</xsl:attribute>
-->
</xsl:attribute-set>
<xsl:attribute-set name="p-initial" use-attribute-sets="p">
<!-- initial paragraph, preceded by h1..6 or div -->
<!-- e.g.,
<xsl:attribute name="text-indent">0em</xsl:attribute>
-->
</xsl:attribute-set>
<xsl:attribute-set name="p-initial-first" use-attribute-sets="p-initial">
<!-- initial paragraph, first child of div, body or td -->
</xsl:attribute-set>
<xsl:attribute-set name="blockquote">
<xsl:attribute name="start-indent">inherited-property-value(start-indent) + 24pt</xsl:attribute>
<xsl:attribute name="end-indent">inherited-property-value(end-indent) + 24pt</xsl:attribute>
<xsl:attribute name="space-before">1em</xsl:attribute>
<xsl:attribute name="space-after">1em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="pre">
<xsl:attribute name="font-size">0.83em</xsl:attribute>
<xsl:attribute name="font-family">monospace</xsl:attribute>
<xsl:attribute name="white-space">pre</xsl:attribute>
<xsl:attribute name="space-before">1em</xsl:attribute>
<xsl:attribute name="space-after">1em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="address">
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="hr">
<xsl:attribute name="border">1px inset</xsl:attribute>
<xsl:attribute name="space-before">0.67em</xsl:attribute>
<xsl:attribute name="space-after">0.67em</xsl:attribute>
</xsl:attribute-set>
<!--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
List
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-->
<xsl:attribute-set name="ul">
<xsl:attribute name="space-before">1em</xsl:attribute>
<xsl:attribute name="space-after">1em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="ul-nested">
<xsl:attribute name="space-before">0pt</xsl:attribute>
<xsl:attribute name="space-after">0pt</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="ol">
<xsl:attribute name="space-before">1em</xsl:attribute>
<xsl:attribute name="space-after">1em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="ol-nested">
<xsl:attribute name="space-before">0pt</xsl:attribute>
<xsl:attribute name="space-after">0pt</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="ul-li">
<!-- for (unordered)fo:list-item -->
<xsl:attribute name="relative-align">baseline</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="ol-li">
<!-- for (ordered)fo:list-item -->
<xsl:attribute name="relative-align">baseline</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="dl">
<xsl:attribute name="space-before">1em</xsl:attribute>
<xsl:attribute name="space-after">1em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="dt">
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="dd">
<xsl:attribute name="start-indent">inherited-property-value(start-indent) + 24pt</xsl:attribute>
</xsl:attribute-set>
<!-- list-item-label format for each nesting level -->
<xsl:param name="ul-label-1">•</xsl:param>
<xsl:attribute-set name="ul-label-1">
<xsl:attribute name="font">1em serif</xsl:attribute>
</xsl:attribute-set>
<xsl:param name="ul-label-2">o</xsl:param>
<xsl:attribute-set name="ul-label-2">
<xsl:attribute name="font">0.67em monospace</xsl:attribute>
<xsl:attribute name="baseline-shift">0.25em</xsl:attribute>
</xsl:attribute-set>
<xsl:param name="ul-label-3">-</xsl:param>
<xsl:attribute-set name="ul-label-3">
<xsl:attribute name="font">bold 0.9em sans-serif</xsl:attribute>
<xsl:attribute name="baseline-shift">0.05em</xsl:attribute>
</xsl:attribute-set>
<xsl:param name="ol-label-1">1.</xsl:param>
<xsl:attribute-set name="ol-label-1"/>
<xsl:param name="ol-label-2">a.</xsl:param>
<xsl:attribute-set name="ol-label-2"/>
<xsl:param name="ol-label-3">i.</xsl:param>
<xsl:attribute-set name="ol-label-3"/>
<!--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Table
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-->
<xsl:attribute-set name="inside-table">
<!-- prevent unwanted inheritance -->
<xsl:attribute name="start-indent">0pt</xsl:attribute>
<xsl:attribute name="end-indent">0pt</xsl:attribute>
<xsl:attribute name="text-indent">0pt</xsl:attribute>
<xsl:attribute name="last-line-end-indent">0pt</xsl:attribute>
<xsl:attribute name="text-align">start</xsl:attribute>
<xsl:attribute name="text-align-last">relative</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="table-and-caption" >
<!-- horizontal alignment of table itself
<xsl:attribute name="text-align">center</xsl:attribute>
-->
<!-- vertical alignment in table-cell -->
<xsl:attribute name="display-align">center</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="table">
<xsl:attribute name="border-collapse">separate</xsl:attribute>
<xsl:attribute name="border-spacing">2px</xsl:attribute>
<xsl:attribute name="border">1px</xsl:attribute>
<!--
<xsl:attribute name="border-style">outset</xsl:attribute>
-->
</xsl:attribute-set>
<xsl:attribute-set name="table-caption" use-attribute-sets="inside-table">
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="table-column">
</xsl:attribute-set>
<xsl:attribute-set name="thead" use-attribute-sets="inside-table">
</xsl:attribute-set>
<xsl:attribute-set name="tfoot" use-attribute-sets="inside-table">
</xsl:attribute-set>
<xsl:attribute-set name="tbody" use-attribute-sets="inside-table">
</xsl:attribute-set>
<xsl:attribute-set name="tr">
</xsl:attribute-set>
<xsl:attribute-set name="th">
<xsl:attribute name="font-weight">bolder</xsl:attribute>
<xsl:attribute name="text-align">center</xsl:attribute>
<xsl:attribute name="border">1px</xsl:attribute>
<!--
<xsl:attribute name="border-style">inset</xsl:attribute>
-->
<xsl:attribute name="padding">1px</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="td">
<xsl:attribute name="border">1px</xsl:attribute>
<!--
<xsl:attribute name="border-style">inset</xsl:attribute>
-->
<xsl:attribute name="padding">1px</xsl:attribute>
</xsl:attribute-set>
<!--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Inline-level
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-->
<xsl:attribute-set name="b">
<xsl:attribute name="font-weight">bolder</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="strong">
<xsl:attribute name="font-weight">bolder</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="strong-em">
<xsl:attribute name="font-weight">bolder</xsl:attribute>
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="i">
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="cite">
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="em">
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="var">
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="dfn">
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="tt">
<xsl:attribute name="font-family">monospace</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="code">
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -