its20 CVS commit

Update of /w3ccvs/WWW/International/multilingualweb/lt/drafts/its20/tools/xslt
In directory hutz:/tmp/cvs-serv27103/xslt

Modified Files:
	xmlspec-i18n-itstagset.xsl xmlspec-i18n.xsl 
Log Message:
Added syntax highlighting of examples

Index: xmlspec-i18n.xsl
===================================================================
RCS file: /w3ccvs/WWW/International/multilingualweb/lt/drafts/its20/tools/xslt/xmlspec-i18n.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xmlspec-i18n.xsl	28 Jun 2012 13:06:40 -0000	1.1
+++ xmlspec-i18n.xsl	18 Oct 2012 12:35:25 -0000	1.2
@@ -301,7 +301,7 @@
 			<!-- list out references without duplication-->
 			<xsl:for-each select="$resourceList/resource">
 				<xsl:if test="(not(bibref/@ref = preceding-sibling::resource/bibref/@ref)) and (not(bibref/@ref = 'url'))">
-					<xsl:apply-templates select="doc('refs.xml')//bibl[@id = current()/bibref/@ref]" />
+					<xsl:apply-templates select="document('refs.xml')//bibl[@id = current()/bibref/@ref]" />
 					</xsl:if>
 				</xsl:for-each>
     		</dl>
@@ -882,7 +882,8 @@
   	<xsl:param name="var1Value" /> 
   	<xsl:param name="var2ID" /> 
   	<xsl:param name="var2Value" /> 
-	<xsl:for-each select="doc('strings.xml')/id($stringID)/string/node()">
+	<xsl:for-each select="document('strings.xml')">
+		<xsl:for-each select="id($stringID)/string/node()">
 		<xsl:choose>
 		<xsl:when test="name() = 'variable' and @name = $var1ID">
   			<xsl:value-of select="$var1Value" /> 
@@ -895,6 +896,7 @@
   			</xsl:otherwise>
   		</xsl:choose>
   		</xsl:for-each>
+	</xsl:for-each>
   	</xsl:template>
 
 

Index: xmlspec-i18n-itstagset.xsl
===================================================================
RCS file: /w3ccvs/WWW/International/multilingualweb/lt/drafts/its20/tools/xslt/xmlspec-i18n-itstagset.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xmlspec-i18n-itstagset.xsl	25 Jul 2012 07:04:58 -0000	1.2
+++ xmlspec-i18n-itstagset.xsl	18 Oct 2012 12:35:24 -0000	1.3
@@ -1,7 +1,11 @@
 <?xml version="1.0"?>
 <!-- TODO: check strings.xml for appendix -->
 <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns="http://www.w3.org/1999/xhtml">
+    xmlns="http://www.w3.org/1999/xhtml"    
+    xmlns:s6hl="java:net.sf.xslthl.ConnectorSaxon6"
+    xmlns:xslthl="http://xslthl.sf.net"
+    xmlns:exsl="http://exslt.org/common"        
+    extension-element-prefixes="s6hl xslthl exsl">
     <xsl:import href="xmlspec-i18n.xsl"/>
     <xsl:template match="/">
         <xsl:apply-templates/>
@@ -336,4 +340,90 @@
             </a> for this document, which may include some normative corrections.</p>
     </xsl:template>
 
+    <!-- Syntax highlighting -->
+    <xsl:template match="eg/text()">
+        <xsl:variable name="content">
+            <xsl:copy-of select="."/>
+        </xsl:variable>        
+        <xsl:choose>
+            <xsl:when test="function-available('s6hl:highlight')">
+                <xsl:apply-templates select="s6hl:highlight('xml', exsl:node-set($content), 'file:tools/xslthl/xslthl-config.xml')" mode="xslthl"/>        
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="."/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <xsl:template match="xslthl:keyword" mode="xslthl">
+        <strong class="hl-keyword">
+            <xsl:apply-templates mode="xslthl"/>
+        </strong>
+    </xsl:template>
+    <xsl:template match="xslthl:string" mode="xslthl">
+        <strong class="hl-string">
+            <em style="color:red">
+                <xsl:apply-templates mode="xslthl"/>
+            </em>
+        </strong>
+    </xsl:template>
+    <xsl:template match="xslthl:comment" mode="xslthl">
+        <em class="hl-comment" style="color: silver">
+            <xsl:apply-templates mode="xslthl"/>
+        </em>
+    </xsl:template>
+    <xsl:template match="xslthl:directive" mode="xslthl">
+        <span class="hl-directive" style="color: maroon">
+            <xsl:apply-templates mode="xslthl"/>
+        </span>
+    </xsl:template>
+    <xsl:template match="xslthl:tag" mode="xslthl">
+        <strong class="hl-tag" style="color: #000096">
+            <xsl:apply-templates mode="xslthl"/>
+        </strong>
+    </xsl:template>
+    <xsl:template match="xslthl:attribute" mode="xslthl">
+        <span class="hl-attribute" style="color: #F5844C">
+            <xsl:apply-templates mode="xslthl"/>
+        </span>
+    </xsl:template>
+    <xsl:template match="xslthl:value" mode="xslthl">
+        <span class="hl-value" style="color: #993300">
+            <xsl:apply-templates mode="xslthl"/>
+        </span>
+    </xsl:template>
+    <xsl:template match="xslthl:xslt" mode="xslthl">
+        <strong style="color: #0066FF">
+            <xsl:apply-templates mode="xslthl"/>
+        </strong>
+    </xsl:template>
+    <!-- Not emitted since XSLTHL 2.0 -->
+    <xsl:template match="xslthl:section" mode="xslthl">
+        <strong>
+            <xsl:apply-templates mode="xslthl"/>
+        </strong>
+    </xsl:template>
+    <xsl:template match="xslthl:number" mode="xslthl">
+        <span class="hl-number">
+            <xsl:apply-templates mode="xslthl"/>
+        </span>
+    </xsl:template>
+    <xsl:template match="xslthl:annotation" mode="xslthl">
+        <em>
+            <span class="hl-annotation" style="color: gray">
+                <xsl:apply-templates mode="xslthl"/>
+            </span>
+        </em>
+    </xsl:template>
+    <!-- Not sure which element will be in final XSLTHL 2.0 -->
+    <xsl:template match="xslthl:doccomment|xslthl:doctype" mode="xslthl">
+        <strong class="hl-tag" style="color: blue">
+            <xsl:apply-templates mode="xslthl"/>
+        </strong>
+    </xsl:template>
+
+    <xsl:template match='xslthl:html' mode="xslthl">
+        <b style="color: navy"><xsl:apply-templates mode="xslthl"/></b>
+    </xsl:template>
+    
 </xsl:transform>

Received on Thursday, 18 October 2012 12:36:01 UTC