]> granicus.if.org Git - docbook-dsssl/commitdiff
First portion of new profiling code. New stylesheet parameters will come later.
authorJirka Kosek <jirka@kosek.cz>
Fri, 1 Mar 2002 17:25:27 +0000 (17:25 +0000)
committerJirka Kosek <jirka@kosek.cz>
Fri, 1 Mar 2002 17:25:27 +0000 (17:25 +0000)
xsl/Makefile
xsl/fo/Makefile
xsl/html/Makefile
xsl/html/Makefile.param
xsl/htmlhelp/Makefile [new file with mode: 0644]
xsl/javahelp/Makefile [new file with mode: 0644]
xsl/profiling/profile-mode.xsl [new file with mode: 0644]
xsl/profiling/xsl2profile.xsl [new file with mode: 0644]
xsl/xhtml/Makefile

index d8969271244c3292aec435c4ab97047708cfdb5f..ca17a9a5389d172050028ac5eae00f5db7432212 100644 (file)
@@ -4,7 +4,7 @@ NEXTVER=../cvstools/nextversion
 DIFFVER=
 ZIPVER=
 
-DIRS=common html fo extensions
+DIRS=common html fo extensions htmlhelp javahelp
 
 .PHONY : distrib clean doc xhtml
 
index 8f7454bce6a99508fc05e821365c6b465039a99e..8b8952cdc22c9c123ab9ade90543f9a033ffce8d 100644 (file)
@@ -3,7 +3,7 @@ XJPARSE=../../cvstools/xjparse
 
 include Makefile.param
 
-all: titlepage.templates.xsl param.xsl
+all: titlepage.templates.xsl param.xsl profile-docbook.xsl
 
 param.html: param.xml
        ../../cvstools/paramchk -m Makefile.param $<
@@ -22,3 +22,6 @@ titlepage.templates.xsl: titlepage.templates.xml ../template/titlepage.xsl
 
 Makefile.param:
        ../../cvstools/paramchk -m $@ param.xweb
+
+profile-docbook.xsl:
+       $(XSLT) docbook.xsl ../profiling/xsl2profile.xsl $@
index 4eea7e7f0796e06a1fe61f90a664d3d45b5351db..637b8b03220b87dcb9e48ac149a381bb29ee9ff7 100644 (file)
@@ -3,7 +3,7 @@ XJPARSE=../../cvstools/xjparse
 
 include Makefile.param
 
-all: titlepage.templates.xsl param.xsl
+all: titlepage.templates.xsl param.xsl profile-docbook.xsl profile-chunk.xsl
 
 xml: param.xml
 
@@ -27,3 +27,9 @@ titlepage.templates.xsl: titlepage.templates.xml ../template/titlepage.xsl
 Makefile.param:
        ../../cvstools/paramchk -m $@ param.xweb
        make
+
+profile-docbook.xsl:
+       $(XSLT) docbook.xsl ../profiling/xsl2profile.xsl $@
+
+profile-chunk.xsl:
+       $(XSLT) chunk.xsl ../profiling/xsl2profile.xsl $@
index f205e0f943f2ee6dbb503a16aa1595e613222e74..6d98ef6d4a6bb75954e7b57fbc200e658908b1a4 100644 (file)
@@ -23,6 +23,7 @@ PARAMS=../params/admon.graphics.xml \
        ../params/chapter.autolabel.xml \
        ../params/chunk.datafile.xml \
        ../params/chunk.first.sections.xml \
+       ../params/chunk.quietly.xml \
        ../params/chunk.section.depth.xml \
        ../params/chunk.toc.xml \
        ../params/citerefentry.link.xml \
@@ -128,7 +129,6 @@ PARAMS=../params/admon.graphics.xml \
        ../params/show.comments.xml \
        ../params/show.revisionflag.xml \
        ../params/spacing.paras.xml \
-       ../params/stylesheet.result.type.xml \
        ../params/suppress.navigation.xml \
        ../params/table.border.color.xml \
        ../params/table.border.style.xml \
diff --git a/xsl/htmlhelp/Makefile b/xsl/htmlhelp/Makefile
new file mode 100644 (file)
index 0000000..049904e
--- /dev/null
@@ -0,0 +1,7 @@
+XSLT=../../cvstools/saxon
+XJPARSE=../../cvstools/xjparse
+
+all: profile-htmlhelp.xsl
+
+profile-htmlhelp.xsl:
+       $(XSLT) htmlhelp.xsl ../profiling/xsl2profile.xsl $@
diff --git a/xsl/javahelp/Makefile b/xsl/javahelp/Makefile
new file mode 100644 (file)
index 0000000..83788ee
--- /dev/null
@@ -0,0 +1,7 @@
+XSLT=../../cvstools/saxon
+XJPARSE=../../cvstools/xjparse
+
+all: profile-javahelp.xsl
+
+profile-javahelp.xsl:
+       $(XSLT) javahelp.xsl ../profiling/xsl2profile.xsl $@
diff --git a/xsl/profiling/profile-mode.xsl b/xsl/profiling/profile-mode.xsl
new file mode 100644 (file)
index 0000000..1948f7d
--- /dev/null
@@ -0,0 +1,97 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+<!-- Which OSes to select -->
+<xsl:param name="os"/>
+
+<!-- Which UserLevels to select -->
+<xsl:param name="ul"/>
+
+<!-- Which Archs to select -->
+<xsl:param name="arch"/>
+
+<!-- Name of attribute with profiling information -->
+<xsl:param name="attr"/>
+
+<!-- Which $attrs to select -->
+<xsl:param name="val"/>
+
+<!-- Seperator for profiling values -->
+<xsl:param name="sep" select="';'"/>  
+
+<!-- Copy all non-element nodes -->
+<xsl:template match="@*|text()|comment()|processing-instruction()" mode="profile">
+  <xsl:copy/>
+</xsl:template>
+
+<!-- Profile elements based on input parameters -->
+<xsl:template match="*" mode="profile">
+  <xsl:variable name="os.content">
+    <xsl:if test="@os">
+      <xsl:call-template name="cross.compare">
+        <xsl:with-param name="a" select="$os"/>
+        <xsl:with-param name="b" select="@os"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:variable>
+  <xsl:variable name="os.ok" select="not(@os) or not($os) or
+                                     $os.content != '' or @os = ''"/>
+
+  <xsl:variable name="ul.content">
+    <xsl:if test="@userlevel">
+      <xsl:call-template name="cross.compare">
+        <xsl:with-param name="a" select="$ul"/>
+        <xsl:with-param name="b" select="@userlevel"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:variable>
+  <xsl:variable name="ul.ok" select="not(@userlevel) or not($ul) or
+                                     $ul.content != '' or @userlevel = ''"/>
+
+  <xsl:variable name="arch.content">
+    <xsl:if test="@arch">
+      <xsl:call-template name="cross.compare">
+        <xsl:with-param name="a" select="$arch"/>
+        <xsl:with-param name="b" select="@arch"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:variable>
+  <xsl:variable name="arch.ok" select="not(@arch) or not($arch) or
+                                       $arch.content != '' or @arch = ''"/>
+
+  <xsl:variable name="attr.content">
+    <xsl:if test="@*[local-name()=$attr]">
+      <xsl:call-template name="cross.compare">
+        <xsl:with-param name="a" select="$val"/>
+        <xsl:with-param name="b" select="@*[local-name()=$attr]"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:variable>
+  <xsl:variable name="attr.ok" select="not(@*[local-name()=$attr]) or not($val) or
+                                       $attr.content != '' 
+                                       or @*[local-name()=$attr] = '' or not($attr)"/>
+
+  <xsl:if test="$os.ok and $ul.ok and $arch.ok and $attr.ok">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" mode="profile"/>
+    </xsl:copy>
+  </xsl:if>
+</xsl:template>
+
+<!-- Returns non-empty string if list in $b contains one ore more values from list $a -->
+<xsl:template name="cross.compare">
+  <xsl:param name="a"/>
+  <xsl:param name="b"/>
+  <xsl:param name="head" select="substring-before(concat($a, $sep), $sep)"/>
+  <xsl:param name="tail" select="substring-after($a, $sep)"/>
+  <xsl:if test="contains(concat($sep, $b, $sep), concat($sep, $head, $sep))">1</xsl:if>
+  <xsl:if test="$tail">
+    <xsl:call-template name="cross.compare">
+      <xsl:with-param name="a" select="$tail"/>
+      <xsl:with-param name="b" select="$b"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/xsl/profiling/xsl2profile.xsl b/xsl/profiling/xsl2profile.xsl
new file mode 100644 (file)
index 0000000..71ba62d
--- /dev/null
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xslo="http://www.w3.org/1999/XSL/TransformAlias"
+                version="1.0">
+
+<xsl:include href="../lib/lib.xsl"/>
+
+<xsl:output method="xml" encoding="US-ASCII"/>
+
+<xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/>
+
+<xsl:preserve-space elements="*"/>
+
+<xsl:template match="/">
+  <xsl:text>&#10;</xsl:text>
+  <xsl:comment>This file was created automatically by xml2profile</xsl:comment>
+  <xsl:text>&#10;</xsl:text>
+  <xsl:comment>from the DocBook XSL stylesheets. Do not edit this file.</xsl:comment>
+  <xsl:text>&#10;</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<!-- Make sure we override some templates and parameters appropriately for XHTML -->
+<xsl:template match="xsl:stylesheet">
+  <xsl:copy>
+    <xsl:attribute name="exslt:dummy" xmlns:exslt="http://exslt.org/common">dummy</xsl:attribute>
+    <xsl:if test="not(@extension-element-prefixes)">
+      <xsl:attribute name="extension-element-prefixes">exslt</xsl:attribute>
+    </xsl:if>
+    <xsl:if test="not(@exclude-result-prefixes)">
+      <xsl:attribute name="exclude-result-prefixes">exslt</xsl:attribute>
+    </xsl:if>
+    <xsl:for-each select="@*">
+      <xsl:choose>
+        <xsl:when test="local-name(.) = 'extension-element-prefixes' or
+                        local-name(.) = 'exclude-result-prefixes'">
+          <xsl:attribute name="{local-name(.)}"><xsl:value-of select="concat(., ' exslt')"/></xsl:attribute>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="*">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="comment()|processing-instruction()|text()">
+  <xsl:copy/>
+</xsl:template>
+
+<xsl:template match="xsl:template[@match='/' or @name='hhc-main' or @name='hhp-main']">
+  <xsl:if test="@match='/'">
+    <xslo:include href="../profiling/profile-mode.xsl"/>
+  </xsl:if>
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xslo:variable name="profiled-content">
+      <xslo:apply-templates select="." mode="profile"/>
+    </xslo:variable>
+    <xslo:variable name="profiled-nodes" select="exslt:node-set($profiled-content)"/>
+
+    <xsl:apply-templates mode="correct"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="*[@select='/']" mode="correct">
+  <xsl:copy>
+    <xsl:for-each select="@*">
+      <xsl:choose>
+        <xsl:when test="local-name(.) = 'select' and string(.) = '/'">
+          <xsl:attribute name="{local-name(.)}">$profiled-nodes</xsl:attribute>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+    <xsl:apply-templates mode="correct"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match='*[contains(@*, "key(&apos;id&apos;,$rootid)")]' mode="correct">
+  <xsl:copy>
+    <xsl:for-each select="@*">
+      <xsl:choose>
+        <xsl:when test='contains(., "key(&apos;id&apos;,$rootid)")'>
+          <xsl:attribute name="{local-name(.)}">
+            <xsl:call-template name="string.subst">
+              <xsl:with-param name="string" select="."/>
+              <xsl:with-param name="target">key('id',$rootid)</xsl:with-param>
+              <xsl:with-param name="replacement">$profiled-nodes//*[@id=$rootid]</xsl:with-param>
+            </xsl:call-template>
+          </xsl:attribute>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+    <xsl:apply-templates mode="correct"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="*" mode="correct">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates mode="correct"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="comment()|processing-instruction()|text()" mode="correct">
+  <xsl:copy/>
+</xsl:template>
+
+</xsl:stylesheet>
index 440bfa88beaa4f068b19dbcd628fea4ad2343715..5a756dd5c347f3afb359eb1a5e8982f6557f5a82 100644 (file)
@@ -1,6 +1,6 @@
 include ../../cvstools/Makefile.incl
 
-all: xslfiles
+all: xslfiles profile-docbook.xsl profile-chunk.xsl
 
 include xslfiles.gen
 
@@ -16,7 +16,8 @@ include xslfiles.gen
 xslfiles.list: .cvsignore
        echo -n "xslfiles: " > xslfiles.gen
        for f in `cat .cvsignore`; do \
-           if [ "$$f" != ".cvsignore" -a "$$f" != "xslfiles.gen" ]; then \
+           if [ "$$f" != ".cvsignore" -a "$$f" != "xslfiles.gen" \
+                 -a "$$f" != "profile-docbook.xsl" -a "$$f" != "profile-chunk.xsl" ]; then \
               echo -n `basename $$f`; \
                if [ "$$f" != "xref.xsl" ]; then \
                   echo " \\"; \
@@ -27,7 +28,8 @@ xslfiles.list: .cvsignore
         done >> xslfiles.gen
        echo "" >> xslfiles.gen
        for f in `cat .cvsignore`; do \
-           if [ "$$f" != ".cvsignore" -a "$$f" != "xslfiles.gen" ]; then \
+           if [ "$$f" != ".cvsignore" -a "$$f" != "xslfiles.gen" \
+                 -a "$$f" != "profile-docbook.xsl" -a "$$f" != "profile-chunk.xsl" ]; then \
               echo `basename $$f`: ../html/`basename $$f`; \
               echo -n "        $$"; \
               echo -n "(XSLT) "; \
@@ -49,3 +51,9 @@ clean:
 
 #%.xsl: html2xhtml.xsl
 #      $(XSLT) ../html/$@ html2xhtml.xsl $@
+
+profile-docbook.xsl:
+       $(XSLT) docbook.xsl ../profiling/xsl2profile.xsl $@
+
+profile-chunk.xsl:
+       $(XSLT) chunk.xsl ../profiling/xsl2profile.xsl $@