[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: DOCBOOK-APPS: How to structure XSL stylesheets for chunking andnon-chunking
Question for those of you working with XSL stylesheets.... for both my work here at e-smith/Mitel and also some of the stuff I do with the Linux Documentation Project, I need to generate both chunked and non-chunked HTML files from various DocBook files and I need a customization layer to modify certain settings in Norm's XSL stylesheets. With SGML/DSSSL, it seems chunking was handled by the *processor*, so we all simply passed (open)jade the "-V nochunks" option when we did NOT want chunking. The DSSSL customization layer could work for both. With XML/XSL, chunking is handled by the *stylesheet*, so there is now a need for two stylesheets - one for chunking and one for not. However, basically everything in the two stylesheets is the same. What is different is whether the stylesheet calls Norm's 'html/docbook.xsl' (non-chunking) or 'html/chunk.xsl' (chunking). So the question really is - how do you structure a customization layer to sit on top of Norm's stylesheets? The solution I have come up with actually uses *three* stylesheets. I put all my customizations in an XSL stylesheet called 'e-smith-common.xsl'. This stylesheet does NOT do an <xsl:import> to Norm's XSL stylesheets. It just has all my customizations. I then have two other stylesheets. One is called simply 'e-smith.xsl' and has the contents: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="/usr/share/sgml/docbook-xsl-1.41/html/docbook.xsl"/> <xsl:import href="e-smith-common.xsl"/> </xsl:stylesheet> The other stylesheet, 'e-smith-chunk.xsl', is the same as the above except that it imports 'chunk.xsl' instead of 'docbook.xsl'. Both of these essentially import the appropriate XSL file from Norm and then import e-smith-common.xsl. FYI, I used <xsl:import> instead of <xsl:include> in case I later decided that I wanted to override e-smith-common.xsl in one or the other of these files. So to use them, I just call the appropriate stylesheet. To generate a single page: $ xsltproc -o sample.html /usr/share/sgml/e-smith.xsl sample.xml To generate multiple pages: $ xsltproc /usr/share/sgml/e-smith-chunk.xsl sample.xml It all works fine, and there is no difference between the files generated this way and those I generated from my single larger stylesheets before. So I have a system that works... why I am asking the question? Well, does anyone have a better way to do this? Is there any way to NOT have to have two separate stylesheets for chunking or non-chunking? Is there a way I can have *one* call and call it differently? Or is the solution I have come up with the best way to do it? Any thoughts or suggestions are welcome. Thanks, Dan -- Dan York, Director of Training dyork@e-smith.com Ph: +1-613-751-4401 Mobile: +1-613-263-4312 Fax: +1-613-564-7739 e-smith, inc. 150 Metcalfe St., Suite 1500, Ottawa,ON K2P 1P1 Canada http://www.e-smith.com/ open source, open mind
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC