diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-17 20:07:05 +0000 |
---|---|---|
committer | <> | 2015-07-07 10:18:30 +0000 |
commit | 802da9dd5d4bc18f46a916eedc0c5c1980a15e59 (patch) | |
tree | f78a8637465b7a4c9624fef03d27eb7aeaa779d4 /xhtml5/html5-element-mods.xsl | |
parent | 18f63104106b81bf37ca1af774d7be38051e5444 (diff) | |
download | docbook-xsl-master.tar.gz |
Imported from /home/lorry/working-area/delta_docbook-xsl/docbook-xsl-1.78.1.tar.bz2.HEADdocbook-xsl-1.78.1master
Diffstat (limited to 'xhtml5/html5-element-mods.xsl')
-rw-r--r-- | xhtml5/html5-element-mods.xsl | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/xhtml5/html5-element-mods.xsl b/xhtml5/html5-element-mods.xsl index 9aae285..f3cb2d1 100644 --- a/xhtml5/html5-element-mods.xsl +++ b/xhtml5/html5-element-mods.xsl @@ -336,16 +336,25 @@ <!-- HTML5: converts obsolete HTML attributes to CSS styles --> <xsl:template match="*" mode="convert.to.style"> + <xsl:variable name="element" select="local-name(.)"/> + <xsl:variable name="style.from.atts"> <xsl:for-each select="@*"> <xsl:choose> - <xsl:when test="local-name() = 'width'"> + <!-- width and height attributes are ok for img element --> + <xsl:when test="local-name() = 'width' and $element != 'img'"> <xsl:text>width: </xsl:text> <xsl:value-of select="."/> <xsl:text>; </xsl:text> </xsl:when> + <xsl:when test="local-name() = 'height' and $element != 'img'"> + <xsl:text>height </xsl:text> + <xsl:value-of select="."/> + <xsl:text>; </xsl:text> + </xsl:when> + <xsl:when test="local-name() = 'align'"> <xsl:text>text-align: </xsl:text> <xsl:value-of select="."/> @@ -395,15 +404,23 @@ <xsl:value-of select="$style"/> </xsl:attribute> </xsl:if> - <!-- Also skip disallowed summary attributes --> - <xsl:copy-of select="@*[local-name(.) != 'width' and - local-name(.) != 'summary' and - local-name(.) != 'border' and - local-name(.) != 'cellspacing' and - local-name(.) != 'cellpadding' and - local-name(.) != 'style' and - local-name(.) != 'align' and - local-name(.) != 'valign']"/> + <!-- skip converted atts, and also skip disallowed summary attribute --> + <xsl:for-each select="@*"> + <xsl:choose> + <xsl:when test="local-name(.) = 'width' and $element != 'img'"/> + <xsl:when test="local-name(.) = 'height' and $element != 'img'"/> + <xsl:when test="local-name(.) = 'summary'"/> + <xsl:when test="local-name(.) = 'border'"/> + <xsl:when test="local-name(.) = 'cellspacing'"/> + <xsl:when test="local-name(.) = 'cellpadding'"/> + <xsl:when test="local-name(.) = 'style'"/> + <xsl:when test="local-name(.) = 'align'"/> + <xsl:when test="local-name(.) = 'valign'"/> + <xsl:otherwise> + <xsl:copy-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> <xsl:apply-templates mode="convert.to.style"/> </xsl:element> </xsl:template> |