| 1 | <?xml version="1.0" encoding="utf-8"?> |
|---|
| 2 | <!-- |
|---|
| 3 | |
|---|
| 4 | xhtml2odt - XHTML to ODT XML transformation. |
|---|
| 5 | Copyright (C) 2009 Aurelien Bompard |
|---|
| 6 | Based on the work on docbook2odt, by Roman Fordinal |
|---|
| 7 | http://open.comsultia.com/docbook2odf/ |
|---|
| 8 | |
|---|
| 9 | This program is free software; you can redistribute it and/or |
|---|
| 10 | modify it under the terms of the GNU General Public License |
|---|
| 11 | as published by the Free Software Foundation; either version 2 |
|---|
| 12 | of the License, or (at your option) any later version. |
|---|
| 13 | |
|---|
| 14 | This program is distributed in the hope that it will be useful, |
|---|
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | GNU General Public License for more details. |
|---|
| 18 | |
|---|
| 19 | --> |
|---|
| 20 | <xsl:stylesheet |
|---|
| 21 | xmlns:h="http://www.w3.org/1999/xhtml" |
|---|
| 22 | xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" |
|---|
| 23 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|---|
| 24 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
|---|
| 25 | xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" |
|---|
| 26 | xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" |
|---|
| 27 | xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" |
|---|
| 28 | xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" |
|---|
| 29 | xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" |
|---|
| 30 | xmlns:xlink="http://www.w3.org/1999/xlink" |
|---|
| 31 | xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" |
|---|
| 32 | xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" |
|---|
| 33 | xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" |
|---|
| 34 | xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" |
|---|
| 35 | xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" |
|---|
| 36 | xmlns:math="http://www.w3.org/1998/Math/MathML" |
|---|
| 37 | xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" |
|---|
| 38 | xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" |
|---|
| 39 | xmlns:dom="http://www.w3.org/2001/xml-events" |
|---|
| 40 | xmlns:xforms="http://www.w3.org/2002/xforms" |
|---|
| 41 | xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
|---|
| 42 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|---|
| 43 | xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" |
|---|
| 44 | version="1.0"> |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | <xsl:template match="h:blockquote"> |
|---|
| 49 | <!-- special formatting is defined in paragraph --> |
|---|
| 50 | <xsl:apply-templates/> |
|---|
| 51 | </xsl:template> |
|---|
| 52 | |
|---|
| 53 | <xsl:template match="h:hr"> |
|---|
| 54 | <text:p text:style-name="Horizontal_20_Line"/> |
|---|
| 55 | </xsl:template> |
|---|
| 56 | |
|---|
| 57 | <xsl:template match="h:pre"> |
|---|
| 58 | <text:p text:style-name="Preformatted_20_Text"> |
|---|
| 59 | <xsl:call-template name="pre.line"> |
|---|
| 60 | <xsl:with-param name="content" select="string(.)"/> |
|---|
| 61 | </xsl:call-template> |
|---|
| 62 | </text:p> |
|---|
| 63 | </xsl:template> |
|---|
| 64 | |
|---|
| 65 | <xsl:template name="pre.line"> |
|---|
| 66 | <xsl:param name="content"/> |
|---|
| 67 | <xsl:choose> |
|---|
| 68 | <xsl:when test="contains($content, ' ')"> |
|---|
| 69 | <xsl:value-of select="substring-before($content, ' ')"/> |
|---|
| 70 | <text:line-break/> |
|---|
| 71 | <xsl:call-template name="pre.line"> |
|---|
| 72 | <xsl:with-param name="content" select="substring-after($content, ' ')"/> |
|---|
| 73 | </xsl:call-template> |
|---|
| 74 | </xsl:when> |
|---|
| 75 | <xsl:otherwise> |
|---|
| 76 | <xsl:value-of select="string($content)"/> |
|---|
| 77 | </xsl:otherwise> |
|---|
| 78 | </xsl:choose> |
|---|
| 79 | </xsl:template> |
|---|
| 80 | |
|---|
| 81 | <xsl:template match="h:address"> |
|---|
| 82 | <!-- special formatting is defined in paragraph --> |
|---|
| 83 | <xsl:call-template name="paragraph"/> |
|---|
| 84 | </xsl:template> |
|---|
| 85 | |
|---|
| 86 | <xsl:template match="h:center"> |
|---|
| 87 | <!-- special formatting is defined in paragraph --> |
|---|
| 88 | <xsl:call-template name="paragraph"/> |
|---|
| 89 | </xsl:template> |
|---|
| 90 | |
|---|
| 91 | </xsl:stylesheet> |
|---|