| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!-- $Id: h2db.xsl,v 1.1.4.45 2008/09/22 16:47:19 robertDouglass Exp $ --> |
<!-- $Id: h2db.xsl,v 1.1.4.46 2008/09/25 21:41:40 robertDouglass Exp $ --> |
| 3 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 4 |
xmlns:html="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xsl html"> |
xmlns:html="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xsl html"> |
| 5 |
|
|
| 108 |
|
|
| 109 |
<!-- Hyperlinks --> |
<!-- Hyperlinks --> |
| 110 |
<xsl:template match="html:a[contains(@href,'http://')]" priority="1.5"> |
<xsl:template match="html:a[contains(@href,'http://')]" priority="1.5"> |
|
<xsl:value-of select="' '"/> |
|
| 111 |
<xsl:element name="ulink"> |
<xsl:element name="ulink"> |
| 112 |
<xsl:attribute name="url"> |
<xsl:attribute name="url"> |
| 113 |
<xsl:value-of select="normalize-space(@href)"/> |
<xsl:value-of select="normalize-space(@href)"/> |
| 114 |
</xsl:attribute> |
</xsl:attribute> |
| 115 |
<xsl:apply-templates/> |
<xsl:apply-templates/> |
| 116 |
</xsl:element> |
</xsl:element> |
|
<xsl:value-of select="' '"/> |
|
| 117 |
</xsl:template> |
</xsl:template> |
| 118 |
|
|
| 119 |
<xsl:template match="html:a[contains(@href,'#')]" priority="0.6"> |
<xsl:template match="html:a[contains(@href,'#')]" priority="0.6"> |
|
<xsl:value-of select="' '"/> |
|
| 120 |
<xsl:element name="link"> |
<xsl:element name="link"> |
| 121 |
<xsl:attribute name="linkend"> |
<xsl:attribute name="linkend"> |
| 122 |
<xsl:call-template name="make_id"> |
<xsl:call-template name="make_id"> |
| 125 |
</xsl:attribute> |
</xsl:attribute> |
| 126 |
<xsl:value-of select="."/> |
<xsl:value-of select="."/> |
| 127 |
</xsl:element> |
</xsl:element> |
|
<xsl:value-of select="' '"/> |
|
| 128 |
</xsl:template> |
</xsl:template> |
| 129 |
|
|
| 130 |
<xsl:template match="html:a[@href != '']"> |
<xsl:template match="html:a[@href != '']"> |
|
<xsl:value-of select="' '"/> |
|
| 131 |
<xsl:element name="link"> |
<xsl:element name="link"> |
| 132 |
<xsl:attribute name="linkend"> |
<xsl:attribute name="linkend"> |
| 133 |
<xsl:value-of select="$prefix"/> |
<xsl:value-of select="$prefix"/> |
| 137 |
</xsl:attribute> |
</xsl:attribute> |
| 138 |
<xsl:value-of select="."/> |
<xsl:value-of select="."/> |
| 139 |
</xsl:element> |
</xsl:element> |
|
<xsl:value-of select="' '"/> |
|
| 140 |
<!-- Most of the time the <xsl:value-of select="."/> will |
<!-- Most of the time the <xsl:value-of select="."/> will |
| 141 |
take care of all the needs of the child nodes. In the |
take care of all the needs of the child nodes. In the |
| 142 |
case of dfn and acronym, however, extra processing is in |
case of dfn and acronym, however, extra processing is in |
| 806 |
</xsl:template> |
</xsl:template> |
| 807 |
|
|
| 808 |
<!-- text() handling. Some paragraphs in XHTML are really a collection of text nodes and inline elements. |
<!-- text() handling. Some paragraphs in XHTML are really a collection of text nodes and inline elements. |
| 809 |
these templates look at each text node, determine what kind of parent and siblings it has, and |
These templates look at each text node, determine what kind of parent and siblings it has, and |
| 810 |
inserts a [[para]] or [[/para]] placeholder where <para> or </para> should be. I couldn't find a way |
inserts a [[para]] or [[/para]] placeholder where <para> or </para> should be. I couldn't find a way |
| 811 |
to get XSLT to insert <para> or </para> because they would be unmatched elements, and you can't do that. --> |
to get XSLT to insert <para> or </para> because they would be unmatched elements, and you can't do that. --> |
| 812 |
<xsl:template match="text()"> |
<xsl:template match="text()"> |
| 854 |
<xsl:with-param name="element_name" select="name()"/> |
<xsl:with-param name="element_name" select="name()"/> |
| 855 |
</xsl:call-template> |
</xsl:call-template> |
| 856 |
</xsl:variable> |
</xsl:variable> |
| 857 |
|
<!-- if the previous node was a block level element print [[para]] --> |
| 858 |
<xsl:if test="'true' = $last_is_block_level"> |
<xsl:if test="'true' = $last_is_block_level"> |
| 859 |
<xsl:text>[[para]]</xsl:text> |
<xsl:text>[[para]]</xsl:text> |
| 860 |
</xsl:if> |
</xsl:if> |
| 865 |
</xsl:if> |
</xsl:if> |
| 866 |
|
|
| 867 |
<!-- this prints the actual text. --> |
<!-- this prints the actual text. --> |
| 868 |
<xsl:copy-of select="normalize-space(.)"/> |
<xsl:copy-of select="."/> |
| 869 |
|
|
| 870 |
<xsl:if test="'true' = $is_block_level"> |
<xsl:if test="'true' = $is_block_level"> |
| 871 |
<!-- if there are no following nodes, or if the immediate following is block level, print </para> --> |
<!-- If there are no following nodes, or if the immediate following is block level, print [[/para]] --> |
| 872 |
<xsl:choose> |
<xsl:choose> |
| 873 |
<xsl:when test="count(following-sibling::* | following-sibling::text()) = 0"> |
<xsl:when test="count(following-sibling::* | following-sibling::text()) = 0"> |
| 874 |
<xsl:text>[[/para]]</xsl:text> |
<xsl:text>[[/para]]</xsl:text> |