| From | Sent On | Attachments |
|---|---|---|
| gpev...@aol.com | Jul 21, 2010 10:40 am | |
| Jirka Kosek | Jul 21, 2010 1:37 pm | |
| Jirka Kosek | Jul 22, 2010 6:26 am | |
| Jirka Kosek | Jul 22, 2010 6:54 am | |
| gpev...@aol.com | Jul 22, 2010 8:37 am | |
| Mauritz Jeanson | Jul 22, 2010 9:04 am | |
| gpev...@aol.com | Jul 22, 2010 10:02 am | |
| Jeff Hooker | Sep 1, 2010 10:22 am | |
| Jirka Kosek | Sep 1, 2010 3:00 pm |
| Subject: | Re: [docbook-apps] chunking or splitting for non-html files | |
|---|---|---|
| From: | Jirka Kosek (jir...@kosek.cz) | |
| Date: | Jul 21, 2010 1:37:18 pm | |
| List: | org.oasis-open.lists.docbook-apps | |
gpev...@aol.com wrote:
Is there a style sheet which will allow one to split or chunk the XML into
smaller XML files?
Similar to the html/chunk style sheets but leaving the document in docbook xml.
Specifically I am looking to break out a larger document into smaller XML docs
at specific sections.
Sort of modularize a book. Break out say every sect2 as its own self contained
XML file.
Or split each sect1 into a series of articles?
Is there a style sheet in the docbook distro that would do this?
There is no such existing stylesheet, but it is quite easy to create your own. For example to put each chapter in separate file, you could use something like:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template>
<xsl:template match="chapter"> <xsl:variable name="filename"> <xsl:number count="chapter"/> </xsl:variable> <xi:include href="{$filename}.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> <xsl:result-document href="{$filename}.xml"> <xsl:next-match/> </xsl:result-docuement> </xsl:template>
</xsl:stylesheet>
--
------------------------------------------------------------------ Jirka Kosek e-mail: jir...@kosek.cz http://xmlguru.cz
------------------------------------------------------------------ Professional XML consulting and training services DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------





