docbook-apps

Expand all | Collapse all

Filtering out sections?

  • 1.  Filtering out sections?

    Posted 11-27-2011 11:52
    Hello,

    Sorry for the earlier mail, I accidently send it out before it was finished.

    I have a DocBook source with I want to re-use in different environments.

    For example I have an web tutorial for Java Debugging which is an "Article"
    and which following the structure:











    I want to re-use Detail1 and Detail2 in an larger document of type "book".
    I do this via an x-include.

    <chapter>

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../EclipseDebugging/content/010_content.xml" />
    </chapter>

    Unfortunately this brings also in the first section of the article which I
    would like to filter out. The desired result would be:

    <chapter>







    </chapter>
    Is that possible via a kind of filtering?

    Best regards, Lars
    --
    Lars
    http://www.vogella.de - Eclipse, Android and Java Tutorials
    http://www.twitter.com/vogella - Lars on Twitter



  • 2.  Re: [docbook-apps] Filtering out sections?

    Posted 11-27-2011 12:07
    Hi Lars
    In my course materials I do the equivalent.
    I just use two includes in the book.

    Cheers
    Niels

    Sent from an iPad Nano in some i[A-Za-z]*verse

    On 27/11/2011, at 12.51, Lars Vogel <lars.vogel@googlemail.com> wrote:

    > Hello,
    >
    > Sorry for the earlier mail, I accidently send it out before it was finished.
    >
    > I have a DocBook source with I want to re-use in different environments.
    >
    > For example I have an web tutorial for Java Debugging which is an "Article" and which following the structure:
    >
    >

    >
    >

    >
    >

    >

    >
    >

    >

    >
    > I want to re-use Detail1 and Detail2 in an larger document of type "book". I do this via an x-include.
    >
    > <chapter>
    >
    > <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../EclipseDebugging/content/010_content.xml" />
    > </chapter>
    >
    > Unfortunately this brings also in the first section of the article which I would like to filter out. The desired result would be:
    >
    > <chapter>
    >
    >

    >
    >

    >

    >
    >

    > </chapter>
    >
    > Is that possible via a kind of filtering?
    >
    > Best regards, Lars
    >
    > --
    > Lars
    > http://www.vogella.de - Eclipse, Android and Java Tutorials
    > http://www.twitter.com/vogella - Lars on Twitter
    >
    >



  • 3.  Re: [docbook-apps] Filtering out sections?

    Posted 11-27-2011 12:12
    Hi Niels,

    if I understand your answer correctly, you have each subsection in an own
    file and you include these into your book as well as in into your article.
    Correct?

    This is also how I handle this currently; I was hoping for a simpler way as
    a have this situation frequently.

    Best regards, Lars

    2011/11/27 Niels <nmlenator@gmail.com>

    > Hi Lars
    > In my course materials I do the equivalent.
    > I just use two includes in the book.
    >
    > Cheers
    > Niels
    >
    > Sent from an iPad Nano in some i[A-Za-z]*verse
    >
    > On 27/11/2011, at 12.51, Lars Vogel <lars.vogel@googlemail.com> wrote:
    >
    > Hello,
    >
    > Sorry for the earlier mail, I accidently send it out before it was
    > finished.
    >
    > I have a DocBook source with I want to re-use in different environments.
    >
    > For example I have an web tutorial for Java Debugging which is an
    > "Article" and which following the structure:
    >
    >

    >
    >

    >
    >

    >

    >
    >

    >

    >
    > I want to re-use Detail1 and Detail2 in an larger document of type "book".
    > I do this via an x-include.
    >
    > <chapter>
    >
    > <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    > href="../EclipseDebugging/content/010_content.xml" />
    > </chapter>
    >
    > Unfortunately this brings also in the first section of the article which I
    > would like to filter out. The desired result would be:
    >
    > <chapter>
    >
    >

    >
    >

    >

    >
    >

    > </chapter>
    > Is that possible via a kind of filtering?
    >
    > Best regards, Lars
    > --
    > Lars
    > http://www.vogella.de - Eclipse, Android and Java Tutorials
    > http://www.twitter.com/vogella - Lars on Twitter
    >
    >
    >


    --
    Lars
    http://www.vogella.de - Eclipse, Android and Java Tutorials
    http://www.twitter.com/vogella - Lars on Twitter



  • 4.  Re: [docbook-apps] Filtering out sections?

    Posted 11-27-2011 14:20
    Hi Lars,

    Am Sonntag, 27. November 2011, 12:51:41 schrieb Lars Vogel:
    > [...]
    >

    >
    >

    >
    >

    >

    >
    >

    >

    >
    > I want to re-use Detail1 and Detail2 in an larger document of type "book".
    > I do this via an x-include.
    >
    > <chapter>
    >
    > <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    > href="../EclipseDebugging/content/010_content.xml" />
    > </chapter>
    >
    > Unfortunately this brings also in the first section of the article which I
    > would like to filter out. The desired result would be:
    >
    > <chapter>
    >
    >

    >
    >

    >

    >
    >

    > </chapter>
    > Is that possible via a kind of filtering?

    Hmn, reusing fragments of a file is challenging, but not impossible. :) You
    *could* use so called "XPointers" which were specified for such a task.

    However, and this is the big disadvantage, XPointers are not fully released as
    a W3C recommendation. Furthermore, only parts of the XPointers specifications
    (plural!) are supported by XML parsers (if at all). The xmllint parser seems
    to support _some_ but not all.

    If you are not frightend by XPointers, you could extend your above XIncludes
    with a xpointer attribute (untested!):

    <chapter>


    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../EclipseDebugging/content/010_content.xml"
    xpointer="element(/1/1/node())"/>


    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../EclipseDebugging/content/010_content.xml"
    xpointer="element(/1/2/node())"/>

    </chapter>

    The above element(...) keyword uses an XPath notation to select the first and
    second section elements and includes only their contents. As you have already
    assumed, it highly depends on your structure of your referenced file. If that
    changes, you will have to adapt your XPointers as well.

    If the above notation doesn't work, another solution would be to use an ID
    selection scheme. Insert in your Details 1 and 2 sections unique IDs and
    select them with the xpointer() and id() scheme:

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../EclipseDebugging/content/010_content.xml"
    xpointer="xpointer(id(sec.detail1)/node())"/>

    However, putting IDs in sections and reusing them is always a bit dangerous as
    you can end up with multiple IDs in your documents.

    If you would like to know more about this topic, here are some further links:

    http://www.sagehill.net/docbookxsl/DuplicateIDs.html
    http://blog.fischermatthias.net/2011/03/16/xiinclude-auflosen-mit-xmllint/

    There are probably more ideas, but I leave that for another mail. :)


    --
    Gruß/Regards
    Thomas Schraitle




  • 5.  Re: [docbook-apps] Filtering out sections?

    Posted 11-27-2011 15:02
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi Lars,
    In this case, you could process the file after xincluding to remove
    the wrapper section and promote the child sections. E.g.











    Then then in the preprocessing xslt:

    <xsl:template match="section[@role='wrapper']">
    <xsl:apply-templates select="section"/>
    </xsl:template>

    <xsl:template match="@*|node()">
    <xsl:apply-templates select="@*|node()"/>
    </xsl:template>

    It will work in this case since the doc is valid with the wrapper as
    well as the wrapped content. If the wrapper were a chapter, then it
    wouldn't work well because your doc wouldn't be valid at authoring
    time even if it would be after pre-processing.

    David

    On 11/27/2011 05:51 AM, Lars Vogel wrote:
    > Hello,
    >
    > Sorry for the earlier mail, I accidently send it out before it was
    > finished.
    >
    > I have a DocBook source with I want to re-use in different
    > environments.
    >
    > For example I have an web tutorial for Java Debugging which is an
    > "Article" and which following the structure:
    >
    >

    >

    >
    > I want to re-use Detail1 and Detail2 in an larger document of type
    > "book". I do this via an x-include.
    >
    > <chapter> <xi:include
    > xmlns:xi="http://www.w3.org/2001/XInclude"
    > href="../EclipseDebugging/content/010_content.xml" /> </chapter>
    >
    > Unfortunately this brings also in the first section of the article
    > which I would like to filter out. The desired result would be:
    >
    > <chapter>

    > </chapter> Is that possible via a kind of filtering?
    >
    > Best regards, Lars -- Lars http://www.vogella.de - Eclipse, Android
    > and Java Tutorials http://www.twitter.com/vogella - Lars on
    > Twitter
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQEcBAEBAgAGBQJO0lECAAoJEMHeSXG7afUhP+AIAIIKEl+HF7iKwMq8iOCUogou
    l7H7/zhcEsQjk1D2w/izRqRU8h9Um7J2XF3bVu4Ni6n3lrZxkwvCdRpOFU32YMvI
    IoQOIphWP57MmZCYZOOU6iJ+OzzJccPdQeIp497tfDZn3OlcW09BKHn9Wh+ucc7G
    jLOl/lz1lrbDXKcbzF/1M03rXiEbDWU28L+vS6oAYXWyQaXxGaHTsgKpDyH07RMB
    rpAvM7esD4NbvAG6ujng8mk5LGyCxXW94EaDcFmiYID2NsckX2/wPChhZqIghr3y
    hrIHqu7IYGs8697rxd/lVuhwNa19DpX4KH+QeMKbSbjQjW2NyvqieaCYLFgvdbQ=
    =DFUv
    -----END PGP SIGNATURE-----



  • 6.  Re: [docbook-apps] Filtering out sections?

    Posted 11-27-2011 15:28
    Hi Dave, hi Tom,

    thanks for the great suggestions. I will try Daves Approach as it appears
    simple to me.

    Thanks again, Lars

    2011/11/27 David Cramer <david@thingbag.net>

    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1
    >
    > Hi Lars,
    > In this case, you could process the file after xincluding to remove
    > the wrapper section and promote the child sections. E.g.
    >
    >

    >
    >

    >
    >

    >

    >
    >

    >

    >
    > Then then in the preprocessing xslt:
    >
    > <xsl:template match="section[@role='wrapper']">
    > <xsl:apply-templates select="section"/>
    > </xsl:template>
    >
    > <xsl:template match="@*|node()">
    > <xsl:apply-templates select="@*|node()"/>
    > </xsl:template>
    >
    > It will work in this case since the doc is valid with the wrapper as
    > well as the wrapped content. If the wrapper were a chapter, then it
    > wouldn't work well because your doc wouldn't be valid at authoring
    > time even if it would be after pre-processing.
    >
    > David
    >
    > On 11/27/2011 05:51 AM, Lars Vogel wrote:
    > > Hello,
    > >
    > > Sorry for the earlier mail, I accidently send it out before it was
    > > finished.
    > >
    > > I have a DocBook source with I want to re-use in different
    > > environments.
    > >
    > > For example I have an web tutorial for Java Debugging which is an
    > > "Article" and which following the structure:
    > >
    > >

    > >

    > >
    > > I want to re-use Detail1 and Detail2 in an larger document of type
    > > "book". I do this via an x-include.
    > >
    > > <chapter> <xi:include
    > > xmlns:xi="http://www.w3.org/2001/XInclude"
    > > href="../EclipseDebugging/content/010_content.xml" /> </chapter>
    > >
    > > Unfortunately this brings also in the first section of the article
    > > which I would like to filter out. The desired result would be:
    > >
    > > <chapter>

    > > </chapter> Is that possible via a kind of filtering?
    > >
    > > Best regards, Lars -- Lars http://www.vogella.de - Eclipse, Android
    > > and Java Tutorials http://www.twitter.com/vogella - Lars on
    > > Twitter
    > >
    > >
    >
    > -----BEGIN PGP SIGNATURE-----
    > Version: GnuPG v1.4.11 (GNU/Linux)
    > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
    >
    > iQEcBAEBAgAGBQJO0lECAAoJEMHeSXG7afUhP+AIAIIKEl+HF7iKwMq8iOCUogou
    > l7H7/zhcEsQjk1D2w/izRqRU8h9Um7J2XF3bVu4Ni6n3lrZxkwvCdRpOFU32YMvI
    > IoQOIphWP57MmZCYZOOU6iJ+OzzJccPdQeIp497tfDZn3OlcW09BKHn9Wh+ucc7G
    > jLOl/lz1lrbDXKcbzF/1M03rXiEbDWU28L+vS6oAYXWyQaXxGaHTsgKpDyH07RMB
    > rpAvM7esD4NbvAG6ujng8mk5LGyCxXW94EaDcFmiYID2NsckX2/wPChhZqIghr3y
    > hrIHqu7IYGs8697rxd/lVuhwNa19DpX4KH+QeMKbSbjQjW2NyvqieaCYLFgvdbQ=
    > =DFUv
    > -----END PGP SIGNATURE-----
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >


    --
    Lars
    http://www.vogella.de - Eclipse, Android and Java Tutorials
    http://www.twitter.com/vogella - Lars on Twitter



  • 7.  Re: [docbook-apps] Filtering out sections?

    Posted 11-27-2011 15:56
    Hi Dave,

    I added your suggestion to my customizing layer of Docbook but this results
    in an empty document. I also ran the XSLT transformation directly on the
    input document but again the result was empty.

    For example for isolated running I used:


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

    <xsl:output method="xml" />

    <xsl:template match="section[@role='wrapper']">
    <xsl:apply-templates select="section" />
    </xsl:template>

    <xsl:template match="@*|node()">
    <xsl:apply-templates select="@*|node()" />
    </xsl:template>

    </xsl:stylesheet>

    What did I do wrong?

    Best regards, Lars


    2011/11/27 David Cramer <david@thingbag.net>

    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1
    >
    > Hi Lars,
    > In this case, you could process the file after xincluding to remove
    > the wrapper section and promote the child sections. E.g.
    >
    >

    >
    >

    >
    >

    >

    >
    >

    >

    >
    > Then then in the preprocessing xslt:
    >
    > <xsl:template match="section[@role='wrapper']">
    > <xsl:apply-templates select="section"/>
    > </xsl:template>
    >
    > <xsl:template match="@*|node()">
    > <xsl:apply-templates select="@*|node()"/>
    > </xsl:template>
    >
    > It will work in this case since the doc is valid with the wrapper as
    > well as the wrapped content. If the wrapper were a chapter, then it
    > wouldn't work well because your doc wouldn't be valid at authoring
    > time even if it would be after pre-processing.
    >
    > David
    >
    > On 11/27/2011 05:51 AM, Lars Vogel wrote:
    > > Hello,
    > >
    > > Sorry for the earlier mail, I accidently send it out before it was
    > > finished.
    > >
    > > I have a DocBook source with I want to re-use in different
    > > environments.
    > >
    > > For example I have an web tutorial for Java Debugging which is an
    > > "Article" and which following the structure:
    > >
    > >

    > >

    > >
    > > I want to re-use Detail1 and Detail2 in an larger document of type
    > > "book". I do this via an x-include.
    > >
    > > <chapter> <xi:include
    > > xmlns:xi="http://www.w3.org/2001/XInclude"
    > > href="../EclipseDebugging/content/010_content.xml" /> </chapter>
    > >
    > > Unfortunately this brings also in the first section of the article
    > > which I would like to filter out. The desired result would be:
    > >
    > > <chapter>

    > > </chapter> Is that possible via a kind of filtering?
    > >
    > > Best regards, Lars -- Lars http://www.vogella.de - Eclipse, Android
    > > and Java Tutorials http://www.twitter.com/vogella - Lars on
    > > Twitter
    > >
    > >
    >
    > -----BEGIN PGP SIGNATURE-----
    > Version: GnuPG v1.4.11 (GNU/Linux)
    > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
    >
    > iQEcBAEBAgAGBQJO0lECAAoJEMHeSXG7afUhP+AIAIIKEl+HF7iKwMq8iOCUogou
    > l7H7/zhcEsQjk1D2w/izRqRU8h9Um7J2XF3bVu4Ni6n3lrZxkwvCdRpOFU32YMvI
    > IoQOIphWP57MmZCYZOOU6iJ+OzzJccPdQeIp497tfDZn3OlcW09BKHn9Wh+ucc7G
    > jLOl/lz1lrbDXKcbzF/1M03rXiEbDWU28L+vS6oAYXWyQaXxGaHTsgKpDyH07RMB
    > rpAvM7esD4NbvAG6ujng8mk5LGyCxXW94EaDcFmiYID2NsckX2/wPChhZqIghr3y
    > hrIHqu7IYGs8697rxd/lVuhwNa19DpX4KH+QeMKbSbjQjW2NyvqieaCYLFgvdbQ=
    > =DFUv
    > -----END PGP SIGNATURE-----
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >


    --
    Lars
    http://www.vogella.de - Eclipse, Android and Java Tutorials
    http://www.twitter.com/vogella - Lars on Twitter



  • 8.  Re: [docbook-apps] Filtering out sections?

    Posted 11-27-2011 16:13
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Oops. In the test preprocessing xsl, the second template should be
    (I'd omitted the xsl:copy):

    <xsl:template match="@*|node()">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
    </xsl:template>

    But if you drop only the first template in your customization layer,
    it will work--that's the easiest way:

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

    <xsl:import href="/path/to/docbook-xsl-1.76.1/xhtml/docbook.xsl"/>

    <xsl:template match="section[@role='wrapper']">
    <xsl:apply-templates select="section" />
    </xsl:template>

    </xsl:stylesheet>

    David

    On 11/27/2011 09:56 AM, Lars Vogel wrote:
    > Hi Dave,
    >
    > I added your suggestion to my customizing layer of Docbook but
    > this results in an empty document. I also ran the XSLT
    > transformation directly on the input document but again the result
    > was empty.
    >
    > For example for isolated running I used:
    >
    > <xsl:stylesheet
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    >
    > <xsl:output method="xml" />
    >
    > <xsl:template match="section[@role='wrapper']">
    > <xsl:apply-templates select="section" /> </xsl:template>
    >
    > <xsl:template match="@*|node()"> <xsl:apply-templates
    > select="@*|node()" /> </xsl:template>
    >
    > </xsl:stylesheet>
    >
    > What did I do wrong?
    >
    > Best regards, Lars
    >
    >
    > 2011/11/27 David Cramer <david@thingbag.net
    > <mailto:david@thingbag.net>>
    >
    > Hi Lars, In this case, you could process the file after xincluding
    > to remove the wrapper section and promote the child sections. E.g.
    >
    >

    >

    >
    > Then then in the preprocessing xslt:
    >
    > <xsl:template match="section[@role='wrapper']">
    > <xsl:apply-templates select="section"/> </xsl:template>
    >
    > <xsl:template match="@*|node()"> <xsl:apply-templates
    > select="@*|node()"/> </xsl:template>
    >
    > It will work in this case since the doc is valid with the wrapper
    > as well as the wrapped content. If the wrapper were a chapter, then
    > it wouldn't work well because your doc wouldn't be valid at
    > authoring time even if it would be after pre-processing.
    >
    > David
    >
    > On 11/27/2011 05:51 AM, Lars Vogel wrote:
    >> Hello,
    >
    >> Sorry for the earlier mail, I accidently send it out before it
    >> was finished.
    >
    >> I have a DocBook source with I want to re-use in different
    >> environments.
    >
    >> For example I have an web tutorial for Java Debugging which is
    >> an "Article" and which following the structure:
    >
    >>

    >>

    >
    >> I want to re-use Detail1 and Detail2 in an larger document of
    >> type "book". I do this via an x-include.
    >
    >> <chapter> <xi:include
    >> xmlns:xi="http://www.w3.org/2001/XInclude"
    >> href="../EclipseDebugging/content/010_content.xml" /> </chapter>
    >
    >> Unfortunately this brings also in the first section of the
    >> article which I would like to filter out. The desired result
    >> would be:
    >
    >> <chapter>

    >>
    </chapter> Is that possible via a kind of filtering?
    >
    >> Best regards, Lars -- Lars http://www.vogella.de - Eclipse,
    >> Android and Java Tutorials http://www.twitter.com/vogella - Lars
    >> on Twitter
    >
    >
    >
    >
    > ---------------------------------------------------------------------
    >
    >
    To unsubscribe, e-mail:
    > docbook-apps-unsubscribe@lists.oasis-open.org
    > <mailto:docbook-apps-unsubscribe@lists.oasis-open.org> For
    > additional commands, e-mail:
    > docbook-apps-help@lists.oasis-open.org
    > <mailto:docbook-apps-help@lists.oasis-open.org>
    >
    >
    >
    >
    > -- Lars http://www.vogella.de - Eclipse, Android and Java
    > Tutorials http://www.twitter.com/vogella - Lars on Twitter

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQEcBAEBAgAGBQJO0mF6AAoJEMHeSXG7afUhci8H/03BaPHdZDZq3Y8RJdW0a8qF
    rwGkRD+D64hq8kyyOCfHuwyIFY7XojDkHoWNV7OQntsJOq209aNcG7d/J6y5rGqt
    F5bKlazuTPgJBMTFoht7Sqhos8w/Mvv077R94pKrCCv5IWCO4Pkw2pt7DvQD0MVO
    uSpmohU+Elvmh1itkIzLU6uqjQgsTNDrt9Oo7q0MbUdo5Jj2Nmp7gnT/czxpx3MG
    k6pVuDDBfLsppzGLalUXbBF0WCntV779cyl1JEwGRUJOc2eXyB2kA5liy+EQGctw
    eatMxXhO7v2GG+mAKjrW3Res6IC8rcjflvSR2MzSXplucst+B0nVa8KBoXuYpEM=
    =VJqs
    -----END PGP SIGNATURE-----



  • 9.  Re: [docbook-apps] Filtering out sections?

    Posted 11-27-2011 16:28
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    On 27.11.2011 16:56, Lars Vogel wrote:

    > <xsl:template match="@*|node()"> <xsl:apply-templates
    > select="@*|node()" /> </xsl:template>
    >

    This should be:

    <xsl:template match="@*|node()">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
    </xsl:template>

    It's sometimes considered flaw in XSLT design, that default action is
    only copy text, not also elements. But XSLT 3.0 will provide some new
    features around this :-)

    - --
    - ------------------------------------------------------------------
    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
    - ------------------------------------------------------------------
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.9 (MingW32)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iEYEARECAAYFAk7SZQgACgkQzwmSw7n0dR6bXgCfbx2NKeLfY0q22y0WlSco8Hzd
    77gAn21K32jbkO4dw99qnWG7U1cqZNh1
    =6hwW
    -----END PGP SIGNATURE-----



  • 10.  Re: [docbook-apps] Filtering out sections?

    Posted 11-27-2011 18:22
    Hello Dave, hello Jirka,

    great! This works. I had the problem if I put this directly into my
    customizing layer that the TOC and the numbering of the chapters would
    still be incorrect.

    But if I run this as a two step it works perfectly.

    Thanks again, this saves a ton of work (and would have saved a ton of work
    over the last weeks if I had known this before ;-) )

    Best regards, Lars

    2011/11/27 Jirka Kosek <jirka@kosek.cz>

    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1
    >
    > On 27.11.2011 16:56, Lars Vogel wrote:
    >
    > > <xsl:template match="@*|node()"> <xsl:apply-templates
    > > select="@*|node()" /> </xsl:template>
    > >
    >
    > This should be:
    >
    > <xsl:template match="@*|node()">
    > <xsl:copy>
    > <xsl:apply-templates select="@*|node()" />
    > </xsl:copy>
    > </xsl:template>
    >
    > It's sometimes considered flaw in XSLT design, that default action is
    > only copy text, not also elements. But XSLT 3.0 will provide some new
    > features around this :-)
    >
    > - --
    > - ------------------------------------------------------------------
    > 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
    > - ------------------------------------------------------------------
    > -----BEGIN PGP SIGNATURE-----
    > Version: GnuPG v1.4.9 (MingW32)
    > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
    >
    > iEYEARECAAYFAk7SZQgACgkQzwmSw7n0dR6bXgCfbx2NKeLfY0q22y0WlSco8Hzd
    > 77gAn21K32jbkO4dw99qnWG7U1cqZNh1
    > =6hwW
    > -----END PGP SIGNATURE-----
    >



    --
    Lars
    http://www.vogella.de - Eclipse, Android and Java Tutorials
    http://www.twitter.com/vogella - Lars on Twitter



  • 11.  Re: [docbook-apps] Filtering out sections?

    Posted 11-27-2011 19:27
    On 27.11.2011 19:22, Lars Vogel wrote:

    > great! This works. I had the problem if I put this directly into my
    > customizing layer that the TOC and the numbering of the chapters would
    > still be incorrect.
    >
    > But if I run this as a two step it works perfectly.

    There is one trick how to do this one step. Use profiling version of
    stylesheets, i.e. profile-docbook.xsl instead of docbook.xsl and put
    filtering template into profile mode, like:

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

    <xsl:import
    href="/path/to/docbook-xsl-1.76.1/xhtml/profile-docbook.xsl"/>

    <xsl:template match="section[@role='wrapper']" mode="profile">
    <xsl:apply-templates select="section" mode="profile"/>
    </xsl:template>

    </xsl:stylesheet>

    profile mode is responsible for filtering prior transformation, so
    chapter numbering will work then correctly.

    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
    ------------------------------------------------------------------




  • 12.  Re: [docbook-apps] Filtering out sections?

    Posted 12-07-2011 10:25
    Hi Jirka,

    sorry for my delayed response.

    Thanks for the tips, works perfectly.

    Best regards, Lars

    2011/11/27 Jirka Kosek <jirka@kosek.cz>

    > On 27.11.2011 19:22, Lars Vogel wrote:
    >
    > > great! This works. I had the problem if I put this directly into my
    > > customizing layer that the TOC and the numbering of the chapters would
    > > still be incorrect.
    > >
    > > But if I run this as a two step it works perfectly.
    >
    > There is one trick how to do this one step. Use profiling version of
    > stylesheets, i.e. profile-docbook.xsl instead of docbook.xsl and put
    > filtering template into profile mode, like:
    >
    > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > version="1.0">
    >
    > <xsl:import
    > href="/path/to/docbook-xsl-1.76.1/xhtml/profile-docbook.xsl"/>
    >
    > <xsl:template match="section[@role='wrapper']" mode="profile">
    > <xsl:apply-templates select="section" mode="profile"/>
    > </xsl:template>
    >
    > </xsl:stylesheet>
    >
    > profile mode is responsible for filtering prior transformation, so
    > chapter numbering will work then correctly.
    >
    > 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
    > ------------------------------------------------------------------
    >
    >


    --
    Lars
    http://www.vogella.de - Eclipse, Android and Java Tutorials
    http://www.twitter.com/vogella - Lars on Twitter