aboutsummaryrefslogtreecommitdiffstats
path: root/stylesheets/lfs-xsl/docbook-xsl-1.78.1/extensions/xslt.py
diff options
context:
space:
mode:
authorPierre Labastie <pieere@linuxfromscratch.org>2020-03-13 09:20:45 +0000
committerPierre Labastie <pieere@linuxfromscratch.org>2020-03-13 09:20:45 +0000
commit2e524f93fc03353e6fb05333d8041505948959eb (patch)
tree0e2f8a60e47c994d49152b300f0d698a7eb29c4f /stylesheets/lfs-xsl/docbook-xsl-1.78.1/extensions/xslt.py
parentcc98817b6165e5307c1fc38328cdc2a1cc2de257 (diff)
Since LFS started using docbook-1.78.1, there is a lot of unused data
in the stylesheet directory. Basically, a whole docbook-stylesheet is there, while we need only fo and xhtml (+ some common dirs). Each time we checkout the repo, we have to download this whole thing, which is by far the biggest part of the repo (~33 M). By removing unused cruft, this could be down to ~12 M. Of course, it would be even better to remove completely the stylesheets and use host ones (repo size down to 2M). but let's do this first, it is easier :) git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@11778 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'stylesheets/lfs-xsl/docbook-xsl-1.78.1/extensions/xslt.py')
-rw-r--r--stylesheets/lfs-xsl/docbook-xsl-1.78.1/extensions/xslt.py84
1 files changed, 0 insertions, 84 deletions
diff --git a/stylesheets/lfs-xsl/docbook-xsl-1.78.1/extensions/xslt.py b/stylesheets/lfs-xsl/docbook-xsl-1.78.1/extensions/xslt.py
deleted file mode 100644
index c712f65fb..000000000
--- a/stylesheets/lfs-xsl/docbook-xsl-1.78.1/extensions/xslt.py
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/python -u
-# $Id: xslt.py 8353 2009-03-17 16:57:50Z mzjn $
-
-import sys
-import libxml2
-import libxslt
-from docbook import adjustColumnWidths
-
-# Check the arguments
-usage = "Usage: %s xmlfile.xml xslfile.xsl [outputfile] [param1=val [param2=val]...]" % sys.argv[0]
-
-xmlfile = None
-xslfile = None
-outfile = "-"
-params = {}
-
-try:
- xmlfile = sys.argv[1]
- xslfile = sys.argv[2]
-except IndexError:
- print usage
- sys.exit(1)
-
-def quote(astring):
- if astring.find("'") < 0:
- return "'" + astring + "'"
- else:
- return '"' + astring + '"'
-
-try:
- outfile = sys.argv[3]
- if outfile.find("=") > 0:
- name, value = outfile.split("=", 2)
- params[name] = quote(value)
- outfile = None
-
- count = 4
- while (sys.argv[count]):
- try:
- name, value = sys.argv[count].split("=", 2)
- if params.has_key(name):
- print "Warning: '%s' re-specified; replacing value" % name
- params[name] = quote(value)
- except ValueError:
- print "Invalid parameter specification: '" + sys.argv[count] + "'"
- print usage
- sys.exit(1)
- count = count+1
-except IndexError:
- pass
-
-# ======================================================================
-# Memory debug specific
-# libxml2.debugMemory(1)
-
-# Setup environment
-libxml2.lineNumbersDefault(1)
-libxml2.substituteEntitiesDefault(1)
-libxslt.registerExtModuleFunction("adjustColumnWidths",
- "http://nwalsh.com/xslt/ext/xsltproc/python/Table",
- adjustColumnWidths)
-
-# Initialize and run
-styledoc = libxml2.parseFile(xslfile)
-style = libxslt.parseStylesheetDoc(styledoc)
-doc = libxml2.parseFile(xmlfile)
-result = style.applyStylesheet(doc, params)
-
-# Save the result
-if outfile:
- style.saveResultToFilename(outfile, result, 0)
-else:
- print result
-
-# Free things up
-style.freeStylesheet()
-doc.freeDoc()
-result.freeDoc()
-
-# Memory debug specific
-#libxslt.cleanup()
-#if libxml2.debugMemory(1) != 0:
-# print "Memory leak %d bytes" % (libxml2.debugMemory(1))
-# libxml2.dumpMemory()