1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:its="http://www.w3.org/2005/11/its" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="its" version="1.0">
6 <!-- ********************************************************************
7 $Id: html.xsl 9306 2012-04-28 03:49:00Z bobstayton $
8 ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
14 Templates in this stylesheet convert ITS 2.0 markup
15 http://www.w3.org/TR/its20/ into corresponding HTML5 attributes
16 (prefixed with its-*).
18 ******************************************************************** -->
20 <!-- List of recognized ITS attributes -->
21 <xsl:variable name="its-attrs"> its-allowed-characters its-annotators-ref its-line-break-type its-loc-note its-loc-note-ref its-loc-note-type its-loc-quality-issue-comment its-loc-quality-issue-enabled its-loc-quality-issue-profile-ref its-loc-quality-issue-severity its-loc-quality-issue-type its-loc-quality-issues-ref its-loc-quality-rating-profile-ref its-loc-quality-rating-score its-loc-quality-rating-score-threshold its-loc-quality-rating-vote its-loc-quality-rating-vote-threshold its-locale-filter-list its-locale-filter-type its-mt-confidence its-org its-org-ref its-person its-person-ref its-prov-ref its-provenance-records-ref its-rev-org its-rev-org-ref its-rev-person its-rev-person-ref its-rev-tool its-rev-tool-ref its-storage-encoding its-storage-size its-ta-class-ref its-ta-confidence its-ta-ident its-ta-ident-ref its-ta-source its-term its-term-confidence its-term-info-ref its-tool its-tool-ref its-within-text </xsl:variable>
23 <xsl:template name="its.attributes">
24 <xsl:param name="inherit" select="0"/>
25 <xsl:apply-templates select="." mode="its.attributes">
26 <xsl:with-param name="inherit" select="$inherit"/>
27 </xsl:apply-templates>
30 <xsl:template match="*" mode="its.attributes">
31 <xsl:param name="inherit" select="0"/>
34 <!-- Handle inheritance; especially necessary for chunking -->
35 <xsl:when test="$inherit = 1">
36 <xsl:variable name="attrs" select="ancestor-or-self::*/@*[namespace-uri() = 'http://www.w3.org/2005/11/its']"/>
37 <xsl:for-each select="$attrs">
38 <xsl:variable name="name" select="local-name(.)"/>
39 <xsl:if test="not(..//*/@*[local-name(.) = $name and (count(. | $attrs) = 1)])">
40 <xsl:apply-templates select="."/>
45 <xsl:apply-templates select="@*[namespace-uri() = 'http://www.w3.org/2005/11/its']"/>
50 <!-- translate attribute is special in HTML -->
51 <xsl:template match="@its:translate">
52 <xsl:attribute name="translate">
53 <xsl:value-of select="."/>
57 <xsl:template match="@its:*">
58 <xsl:variable name="attr">
59 <xsl:call-template name="its-html-attribute-name">
60 <xsl:with-param name="name" select="local-name(.)"/>
65 <xsl:when test="contains($its-attrs, concat(' ', $attr, ' '))">
66 <xsl:attribute name="{$attr}">
67 <xsl:value-of select="."/>
71 <xsl:message>Attribute <xsl:value-of select="name(.)"/> is not recognized as ITS attribute. Ignoring.</xsl:message>
76 <xsl:template name="its-html-attribute-name">
77 <xsl:param name="name"/>
79 <xsl:text>its-</xsl:text>
80 <xsl:call-template name="its-camel-case-to-dashes">
81 <xsl:with-param name="text" select="$name"/>
85 <xsl:template name="its-camel-case-to-dashes">
86 <xsl:param name="text"/>
88 <xsl:variable name="first" select="substring($text, 1, 1)"/>
89 <xsl:variable name="rest" select="substring($text, 2)"/>
92 <xsl:when test="$first != translate($first, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')">
93 <xsl:value-of select="'-'"/>
94 <xsl:value-of select="translate($first, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
97 <xsl:value-of select="$first"/>
101 <xsl:if test="$rest != ''">
102 <xsl:call-template name="its-camel-case-to-dashes">
103 <xsl:with-param name="text" select="$rest"/>