docbook-apps

  • 1.  Re: [docbook-apps] chunking or splitting for non-html files

    Posted 07-22-2010 13:55
    gpevaco@aol.com wrote:

    > Just to clarify this then is something that cant be done with XSLT 1.0?

    Yes, it can be done, but you have to use proprietary extensions like
    saxon:output or exsl:document. That's why I have used standard XSLT 2.0.

    > Thank you once again for your help with this, like I said I am a newbie with XSLT.
    > It is greatly appreciated.

    Please keep thread on mailing list by using "Reply All" so other users
    can benefit from mailing list archive.

    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@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
    ------------------------------------------------------------------




  • 2.  Re: [docbook-apps] chunking or splitting for non-html files

    Posted 07-22-2010 15:38

    Jirka:

    Thank you for your very helpful response. I am copying to the mail list as well, I was trying to be considerate and not spam the list.
    I made couple minor changes to the code, so that I can get the declaration in the output files, and got it to work well enough.

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">


    <xsl:output method="xml" doctype-public="-//OASIS//DTD DocBook XML V4.1.2//EN"
    doctype-system="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
    indent="yes" omit-xml-declaration="no"/>

    <xsl:template match="node()|@*">
    <xsl:copy>
    <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
    </xsl:template>
    <xsl:template match="article">
    <xsl:variable name="filename">
    <xsl:number count="article"/>
    </xsl:variable>
    <xi:include href="{$filename}.xml"
    xmlns:xi="http://www.w3.org/2001/XInclude"/>
    <xsl:result-document href="Art-{$filename}.xml">
    <xsl:next-match/>
    </xsl:result-document>
    </xsl:template>
    </xsl:stylesheet>


    However I am running into an issue when I use this following stylesheet to sections and have a nested section
    it errors saying it cannot write out to same URI.

    Here is the Style Sheet


    <xsl:template match="node()|@*">
    <xsl:copy>
    <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
    </xsl:template>
    <xsl:template match="section">
    <xsl:variable name="filename">
    <xsl:number count="section"/>
    </xsl:variable>
    <xi:include href="{$filename}.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    <xsl:result-document href="Sect-{$filename}.xml">
    <xsl:next-match/>
    </xsl:result-document>
    </xsl:template>
    </xsl:stylesheet>

    Here is a sample of the XML data




    <para>blah blah blah</para>



    <para>Next Set of Data Blah blah blah</para>
    <programlisting format="linespecific">
    INTEGER value 10
    INTEGER value 11
    INTEGER value 12
    </programlisting>




    How would you propose to modify the XSLT to handle the nested sections?

    I tried to change the xsl:number to an xsl:select where it could name the result files as section/titles
    but that was not successful.
    How would you handle that? Was I on the right track with the xsl:select?


    Thank you for your help!
    /G.



    -----Original Message-----
    From: Jirka Kosek <jirka@kosek.cz>
    To: docbook-apps@lists.oasis-open.org <docbook-apps@lists.oasis-open.org>
    Sent: Thu, Jul 22, 2010 9:54 am
    Subject: Re: [docbook-apps] chunking or splitting for non-html files


    gpevaco@aol.com wrote:
    > Just to clarify this then is something that cant be done with XSLT 1.0?
    Yes, it can be done, but you have to use proprietary extensions like
    axon:output or exsl:document. That's why I have used standard XSLT 2.0.
    > Thank you once again for your help with this, like I said I am a newbie with
    SLT.
    It is greatly appreciated.
    Please keep thread on mailing list by using "Reply All" so other users
    an benefit from mailing list archive.
    --
    -----------------------------------------------------------------
    Jirka Kosek e-mail: jirka@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
    -----------------------------------------------------------------




  • 3.  RE: [docbook-apps] chunking or splitting for non-html files

    Posted 07-22-2010 16:05
    | -----Original Message-----
    | From: gpevaco@aol.com
    |
    | However I am running into an issue when I use this following
    | stylesheet to sections and have a nested section
    | it errors saying it cannot write out to same URI.
    |
    | Here is the Style Sheet
    |
    | <xsl:template match="node()|@*">
    | <xsl:copy>
    | <xsl:apply-templates select="node()|@*"/>
    | </xsl:copy>
    | </xsl:template>
    | <xsl:template match="section">
    | <xsl:variable name="filename">
    | <xsl:number count="section"/>
    | </xsl:variable>
    | <xi:include href="{$filename}.xml"
    | xmlns:xi="http://www.w3.org/2001/XInclude"/>
    | <xsl:result-document href="Sect-{$filename}.xml">
    | <xsl:next-match/>
    | </xsl:result-document>
    | </xsl:template>


    Try changing <xsl:number count="section"> to

    <xsl:number count="section" level="multiple"/>

    Or perhaps you'll prefer

    <xsl:number count="section" level="any"/>

    Mauritz





  • 4.  Re: [docbook-apps] chunking or splitting for non-html files

    Posted 07-22-2010 17:02

    Mauritz:

    Yes that works great, and yes i do prefer level="any" option!
    I like the way that works better!
    Thank you very much!
    /G.







    -----Original Message-----
    From: Mauritz Jeanson <mj@johanneberg.com>
    To: gpevaco@aol.com; jirka@kosek.cz; docbook-apps@lists.oasis-open.org
    Sent: Thu, Jul 22, 2010 12:05 pm
    Subject: RE: [docbook-apps] chunking or splitting for non-html files


    | -----Original Message-----
    From: gpevaco@aol.com

    However I am running into an issue when I use this following
    stylesheet to sections and have a nested section
    it errors saying it cannot write out to same URI.

    Here is the Style Sheet

    <xsl:template match="node()|@*">
    <xsl:copy>
    <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
    </xsl:template>
    <xsl:template match="section">
    <xsl:variable name="filename">
    <xsl:number count="section"/>
    </xsl:variable>
    <xi:include href="{$filename}.xml"
    xmlns:xi="http://www.w3.org/2001/XInclude"/>
    <xsl:result-document href="Sect-{$filename}.xml">
    <xsl:next-match/>
    </xsl:result-document>
    </xsl:template>

    ry changing <xsl:number count="section"> to
    <xsl:number count="section" level="multiple"/>
    Or perhaps you'll prefer
    <xsl:number count="section" level="any"/>
    Mauritz

    ---------------------------------------------------------------------
    o unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    or additional commands, e-mail: docbook-apps-help@lists.oasis-open.org




  • 5.  [docbook-apps] result-document() replacing chunking?

    Posted 09-01-2010 17:23
    Hi all,



    Are there any efforts underway to replace the chunking mechanism using
    in the Norm Walsh docbook xsl with updated scripts using
    result-document()?



    I suppose the real question is "is anybody porting the publishing
    scripts to XSLT 2.0?"



    My CMS can handle result-document(), but the chunking mechanism baffles
    it. Looking at a rather large rewrite.



    Thanks,

    Jeff.




  • 6.  Re: [docbook-apps] result-document() replacing chunking?

    Posted 09-01-2010 22:01
    Jeff Hooker wrote:

    > I suppose the real question is "is anybody porting the publishing
    > scripts to XSLT 2.0?"

    Yes. See

    http://github.com/docbook/xslt20-stylesheets

    HTML support is quite complete thanks to Norm. I have improved FO output
    during summer but it is not yet complete. Any feedback welcomed.

    Jirka

    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@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
    ------------------------------------------------------------------