List:Commits« Previous MessageNext Message »
From:paul Date:April 25 2006 1:23am
Subject:svn commit - mysqldoc@docsrva: r1924 - in trunk: . make.d xsl.d
View as plain text  
Author: paul
Date: 2006-04-25 03:23:16 +0200 (Tue, 25 Apr 2006)
New Revision: 1924

Log:
 r6912@polar:  paul | 2006-04-24 20:22:50 -0500
 Newer versions of libxslt have some change that prevents our Texinfo
 exclude-element stylesheet from working as originally written. This change
 works around the probably by causing the exclusion-stylesheet to work a
 different way:
 - Read the XML file that names the element ids to be excluded
 - Generate a second stylesheet containing templates that match and
   ignore the elements to exclude
 - Apply the generated stylesheet to the manual XML to generate another
   XML file that does not contain the excluded elements.


Modified:
   trunk/
   trunk/make.d/xml-prep
   trunk/xsl.d/exclude-element.xsl


Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:6907
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:9717
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:4590
   + 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:6912
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:9717
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:4590

Modified: trunk/make.d/xml-prep
===================================================================
--- trunk/make.d/xml-prep	2006-04-24 21:53:48 UTC (rev 1923)
+++ trunk/make.d/xml-prep	2006-04-25 01:23:16 UTC (rev 1924)
@@ -28,18 +28,22 @@
 # too-deep nesting.  The ids of these elements should be listed in
 # the exclusions-texi.xml file if there are any.  The -texiprepped.xml
 # file is created by running the regular -prepped.xml through an
-# element-exclusion stylesheet.  Otherwise, if the exclusions-texi.xml
-# file does not exist, just copy the -prepped.xml file to the
-# -texiprepped.xml file.
+# element-exclusion stylesheet generated from the exclusions file.
+# Otherwise, if the exclusions-texi.xml file does not exist, just
+# copy the -prepped.xml file to the -texiprepped.xml file.
 
-%-texiprepped.xml: %-prepped.xml $(DBK_TEXIPREP_XSL_DEPS)
-	if [ -f $$PWD/exclusions-texi.xml ]; then \
-		$(XSLTPROC) \
-			--stringparam id.exclusion.file "$$PWD/exclusions-texi.xml" \
-			$(DBK_TEXIPREP_XSL) $< > $@ ; \
+%-texiprepped.xml: %-prepped.xml
+	if [ -f exclusions-texi.xml ]; then \
+		make exclusions-texi.xsl ; \
+		$(XSLTPROC) --output $@ exclusions-texi.xsl $< ; \
 	else \
 		cp $< $@ ; \
 	fi
 
+%-texi.xsl: %-texi.xml $(DBK_TEXIPREP_XSL_DEPS)
+	$(XSLTPROC) \
+		$(DBK_TEXIPREP_XSL) $< > $@
+
 clean::
 	$(RM) *-prepped.xml *-manprepped.xml *-texiprepped.xml
+	$(RM) *-texi.xsl

Modified: trunk/xsl.d/exclude-element.xsl
===================================================================
--- trunk/xsl.d/exclude-element.xsl	2006-04-24 21:53:48 UTC (rev 1923)
+++ trunk/xsl.d/exclude-element.xsl	2006-04-25 01:23:16 UTC (rev 1924)
@@ -1,46 +1,97 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:gen="dummy-namespace"
+  exclude-result-prefixes="gen">
 
+  <xsl:namespace-alias stylesheet-prefix="gen" result-prefix="xsl"/>
+
 <!--
-exclude-element.xsl
+  exclude-element.xsl
 
-Identity transform, with the following exception:
-- Strip out elements with an id attribute that is listed in the
-  file named by the $id.exclusion.file parameter (which must be
-  defined on the command line).
+  XSLT stylesheet that generates another stylesheet that is an identity
+  transform except that it excludes the elements with ids named in a
+  given XML file:
 
-Format of file:
-  <idlist>
-    <id>id-to-exclude-1</id>
-    <id>id-to-exclude-2</id>
-    <id>id-to-exclude-3</id>
-    etc
-  </idlist>
+  Format of exclusion-ID file:
+    <idlist>
+      <id>id-to-exclude-1</id>
+      <id>id-to-exclude-2</id>
+      <id>id-to-exclude-3</id>
+      etc
+    </idlist>
+
+  - Read the XML file.  For each idlist/id element named in the file,
+  - generate a template to exclude it (by matching it and doing nothing
+    with it).
+  - Generate identity transform to match and copy everything else.
+
+  The output of this stylesheet then can be applied to the XML file
+  from which the elements with the given IDs should be excluded.
 -->
 
-<!-- define xml declaration and DOCTYPE information -->
+<!-- define xml declaration -->
 
 <xsl:output
   method="xml"
   version="1.0"
   encoding="utf-8"
-  standalone="no"
-  doctype-public="-//OASIS//DTD DocBook XML V4.3//EN"
-  doctype-system="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
 />
 
-<!-- global variable containing the excluded-section ids -->
-<xsl:variable name="excluded-ids" select="document($id.exclusion.file)"/>
+<!-- define explicit newline variable that contains a newline character -->
+<xsl:variable name="newline" select="'&#xA;'"/>
 
-<!--
-  Match excluded elements and do nothing with them (thus deleting them).
--->
-<xsl:template match="*[@id=$excluded-ids/idlist/id]"/>
+<xsl:template match="/">
+  <gen:stylesheet version="1.0">
+  <xsl:value-of select="$newline"/>
+    <gen:output
+       method="xml"
+       version="1.0"
+       encoding="utf-8"
+       doctype-public="-//OASIS//DTD DocBook XML V4.3//EN"
+       doctype-system="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+    />
+    <xsl:value-of select="$newline"/>
 
-<xsl:template match="/ | node() | @* | comment() | processing-instruction()">
-  <xsl:copy>
-    <xsl:apply-templates select="@* | node()"/>
-  </xsl:copy>
+    <!--
+      Write templates that match excluded elements and do
+      nothing with them (thus deleting them).
+    -->
+    <xsl:for-each select="/idlist/id">
+      <xsl:element name="gen:template">
+        <xsl:attribute name="match">
+          <xsl:text>*[@id='</xsl:text>
+          <xsl:value-of select="."/>
+          <xsl:text>']</xsl:text>
+        </xsl:attribute>
+      </xsl:element>
+      <xsl:value-of select="$newline"/>
+    </xsl:for-each>
+
+    <!--
+      Write identity template to handle everything else
+    -->
+    <xsl:element name="gen:template">
+      <xsl:attribute name="match">
+        <xsl:text>/|node()|@*|comment()|processing-instruction()</xsl:text>
+      </xsl:attribute>
+      <xsl:value-of select="$newline"/>
+      <xsl:element name="gen:copy">
+        <xsl:value-of select="$newline"/>
+        <xsl:element name="gen:apply-templates">
+          <xsl:attribute name="select">
+            <xsl:text>node()|@*</xsl:text>
+          </xsl:attribute>
+        </xsl:element>
+        <xsl:value-of select="$newline"/>
+      </xsl:element>
+      <xsl:value-of select="$newline"/>
+    </xsl:element>
+    <xsl:value-of select="$newline"/>
+
+  </gen:stylesheet>
+  <xsl:value-of select="$newline"/>
 </xsl:template>
 
 </xsl:stylesheet>

Thread
svn commit - mysqldoc@docsrva: r1924 - in trunk: . make.d xsl.dpaul25 Apr