[PATCH] Add local customization layers for all languages

Øyvind A. Holm sunny at sunbase.org
Tue Aug 8 13:22:59 CDT 2006


On 2006-08-08 13:33:50 Max Bowsher wrote:
> Øyvind A. Holm wrote:
> > I need to do a change to the xsl stylesheets for the Norwegian book 
> > (changing “” to «» and maybe some other small stuff) so I need a 
> > local customization layer to be able to do it. This patch creates a 
> > local tools/ directory at the root of every book variant, containing 
> > their own .xsl files. For now they don’t change anything, only 
> > imports the master stylesheets from $TOOLS_DIR. Later on they can be 
> > tweaked for each language separately. Have tested make for all 
> > languages.
>
> Question: Are most languages eventually going to want to do this?

I don’t think it’s an actual _need_ for it in most cases, it’ll probably 
range from small punctuation changes to DocBook-generated text which is 
not translated yet.

> If only a few languages are ever going to make customizations, then I 
> favour only creating the additional .xsl files for the languages that 
> need them, and having the makefile simply use the local override if it 
> exists, but otherwise use the master version directly.

Yes, this looks like a better idea. I've created a new patch which makes 
it optional to use local stylesheets.

[[[
Enable local customization layers for all languages. If a specific 
language needs to customize the stylesheets, a local "stylesheets/" 
directory can be created with {html,chunk,fo}-stylesheet.xsl files.

* src/tools/Makefile.base-rules
  ($XSL_DIR): New variable.

* src/tools/Makefile.base-vars
  (html, html-chunk, fo): Execute $(XSLTPROC) with stylesheets in 
  $(XSL_DIR) instead of $(TOOLS_DIR).

* src/nb/stylesheets/chunk-stylesheet.xsl
* src/nb/stylesheets/fo-stylesheet.xsl
* src/nb/stylesheets/html-stylesheet.xsl
  New files. No layout changes, only imports the master stylesheets from 
  ../../src/tools/.
]]]

Attachment:
88d52b4a4d62028ee47dc76b9bf2ddd1  layers.r2372.patch

sunny256
N 60.42541° E 5.29959°
----------------------
cat /dev/urandom >SCO
-------------- next part --------------
Index: src/nb/stylesheets/fo-stylesheet.xsl
===================================================================
--- src/nb/stylesheets/fo-stylesheet.xsl	(revision 0)
+++ src/nb/stylesheets/fo-stylesheet.xsl	(revision 0)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:import href="../../tools/fo-stylesheet.xsl"/>
+</xsl:stylesheet>

Property changes on: src/nb/stylesheets/fo-stylesheet.xsl
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/nb/stylesheets/html-stylesheet.xsl
===================================================================
--- src/nb/stylesheets/html-stylesheet.xsl	(revision 0)
+++ src/nb/stylesheets/html-stylesheet.xsl	(revision 0)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:import href="../../tools/html-stylesheet.xsl"/>
+</xsl:stylesheet>

Property changes on: src/nb/stylesheets/html-stylesheet.xsl
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/nb/stylesheets/chunk-stylesheet.xsl
===================================================================
--- src/nb/stylesheets/chunk-stylesheet.xsl	(revision 0)
+++ src/nb/stylesheets/chunk-stylesheet.xsl	(revision 0)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:import href="../../tools/chunk-stylesheet.xsl"/>
+</xsl:stylesheet>

Property changes on: src/nb/stylesheets/chunk-stylesheet.xsl
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/tools/Makefile.base-vars
===================================================================
--- src/tools/Makefile.base-vars	(revision 2372)
+++ src/tools/Makefile.base-vars	(working copy)
@@ -36,6 +36,8 @@
 DIR = .
 IMAGES =
 TOOLS_DIR = ../tools
+XSL_DIR := $(shell if test -d "stylesheets"; then \
+           echo stylesheets; else echo $(TOOLS_DIR); fi)
 OUTNAME = $(NAME)
 
 HTML_CHUNK_DIR = $(DIR)/html-chunk
Index: src/tools/Makefile.base-rules
===================================================================
--- src/tools/Makefile.base-rules	(revision 2372)
+++ src/tools/Makefile.base-rules	(working copy)
@@ -24,7 +24,7 @@
 $(HTML_TARGET): $(ALL_SOURCE) $(VERSION_SOURCE) $(STYLESHEET) $(IMAGES)
 	$(ENSURE_XSL)
 	$(XSLTPROC) $(HTML_XSLTPROC_OPTS) --output $(HTML_TARGET) \
-	  $(TOOLS_DIR)/html-stylesheet.xsl $(XML_SOURCE)
+	  $(XSL_DIR)/html-stylesheet.xsl $(XML_SOURCE)
 
 # The trailing slash on the xsltproc --output option is essential to
 # output pages into the directory
@@ -35,7 +35,7 @@
 	$(ENSURE_XSL)
 	$(XSLTPROC) $(HTML_XSLTPROC_OPTS) \
            --output $(HTML_CHUNK_DIR)/ \
-	   $(TOOLS_DIR)/chunk-stylesheet.xsl $(XML_SOURCE)
+	   $(XSL_DIR)/chunk-stylesheet.xsl $(XML_SOURCE)
 	cp $(STYLESHEET) $(HTML_CHUNK_DIR)
 	$(IFIMAGES) cp $(IMAGES) $(HTML_CHUNK_DIR)/images $(ENDIF)
 
@@ -58,7 +58,7 @@
 $(FO_TARGET): $(ALL_SOURCE) $(VERSION_SOURCE) $(IMAGES)
 	$(ENSURE_XSL)
 	$(XSLTPROC) $(FO_XSLTPROC_OPTS) --output $(FO_TARGET) \
-	  $(TOOLS_DIR)/fo-stylesheet.xsl $(XML_SOURCE)
+	  $(XSL_DIR)/fo-stylesheet.xsl $(XML_SOURCE)
 
 pdf: $(PDF_TARGET)
 $(PDF_TARGET): $(FO_TARGET) $(IMAGES)


More information about the svnbook-dev mailing list