1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns:its="http://www.w3.org/2005/11/its" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="its d" version="1.0">
3 <!-- ********************************************************************
5 This file is part of the XSL DocBook Stylesheet distribution.
6 See ../README or http://cdn.docbook.org/release/xsl/current/ for
7 copyright and other information.
9 Templates in this stylesheet convert ITS 2.0 markup
10 http://www.w3.org/TR/its20/ into corresponding HTML5 attributes
11 (prefixed with its-*).
13 ******************************************************************** -->
15 <!-- List of recognized ITS attributes -->
16 <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>
18 <xsl:template name="its.attributes">
19 <xsl:param name="inherit" select="0"/>
20 <xsl:apply-templates select="." mode="its.attributes">
21 <xsl:with-param name="inherit" select="$inherit"/>
22 </xsl:apply-templates>
25 <xsl:template match="*" mode="its.attributes">
26 <xsl:param name="inherit" select="0"/>
29 <!-- Handle inheritance; especially necessary for chunking -->
30 <xsl:when test="$inherit = 1">
31 <xsl:variable name="attrs" select="ancestor-or-self::*/@*[namespace-uri() = 'http://www.w3.org/2005/11/its']"/>
32 <xsl:for-each select="$attrs">
33 <xsl:variable name="name" select="local-name(.)"/>
34 <xsl:if test="not(..//*/@*[local-name(.) = $name and (count(. | $attrs) = 1)])">
35 <xsl:apply-templates select="."/>
40 <xsl:apply-templates select="@*[namespace-uri() = 'http://www.w3.org/2005/11/its']"/>
45 <!-- translate attribute is special in HTML -->
46 <xsl:template match="@its:translate">
47 <xsl:attribute name="translate">
48 <xsl:value-of select="."/>
52 <xsl:template match="@its:*">
53 <xsl:variable name="attr">
54 <xsl:call-template name="its-html-attribute-name">
55 <xsl:with-param name="name" select="local-name(.)"/>
60 <xsl:when test="contains($its-attrs, concat(' ', $attr, ' '))">
61 <xsl:attribute name="{$attr}">
62 <xsl:value-of select="."/>
66 <xsl:message>Attribute <xsl:value-of select="name(.)"/> is not recognized as ITS attribute. Ignoring.</xsl:message>
71 <xsl:template name="its-html-attribute-name">
72 <xsl:param name="name"/>
74 <xsl:text>its-</xsl:text>
75 <xsl:call-template name="its-camel-case-to-dashes">
76 <xsl:with-param name="text" select="$name"/>
80 <xsl:template name="its-camel-case-to-dashes">
81 <xsl:param name="text"/>
83 <xsl:variable name="first" select="substring($text, 1, 1)"/>
84 <xsl:variable name="rest" select="substring($text, 2)"/>
87 <xsl:when test="$first != translate($first, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')">
88 <xsl:value-of select="'-'"/>
89 <xsl:value-of select="translate($first, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
92 <xsl:value-of select="$first"/>
96 <xsl:if test="$rest != ''">
97 <xsl:call-template name="its-camel-case-to-dashes">
98 <xsl:with-param name="text" select="$rest"/>