docbook-apps

  • 1.  Delete child

    Posted 05-03-2012 05:46
    Hi, can anyone help me with a xsl question?

    I'd like to do the following with an xsl template:

    If a section or chapter contains an immediate child section with the same title, then
    delete the child's
    and


  • 2.  Re: [docbook-apps] Delete child

    Posted 05-03-2012 08:43
    On 3.5.2012 7:46, Joshua J Wulf wrote:

    > If a section or chapter contains an immediate child section with the
    > same title, then
    > delete the child's
    and


  • 3.  Re: [docbook-apps] Delete child

    Posted 05-03-2012 13:20


    ----- Original Message -----
    From: "Jirka Kosek" <jirka@kosek.cz>
    To: "Joshua J Wulf" <jwulf@redhat.com>
    Cc: docbook-apps@lists.oasis-open.org
    Sent: Thursday, May 3, 2012 6:43:05 PM
    Subject: Re: [docbook-apps] Delete child
    via xsl

    On 3.5.2012 7:46, Joshua J Wulf wrote:

    > If a section or chapter contains an immediate child section with the
    > same title, then
    > delete the child's
    and


  • 4.  Re: [docbook-apps] Delete child

    Posted 05-03-2012 15:57
    On 3.5.2012 15:20, Joshua Wulf wrote:

    > Hmmm... good question.
    >
    > The child will be in an xi:included file, so the xsl will need to be applied after xi:includes are resolved.
    >
    > I'm not sure where the best place to do that is....

    XIncludes are resolved priort XSLT processing by XML parser.

    My question was aimed differently. Do you want once convert some
    document to use new structure, or should the structure be changed every
    time you process your document?

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




  • 5.  Re: [docbook-apps] Delete child

    Posted 05-03-2012 19:40
    I'd like to apply it once to convert the document to a new structure.

    ----- Original Message -----
    From: "Jirka Kosek" <jirka@kosek.cz>
    To: "Joshua Wulf" <jwulf@redhat.com>
    Cc: docbook-apps@lists.oasis-open.org
    Sent: Friday, May 4, 2012 1:56:49 AM
    Subject: Re: [docbook-apps] Delete child
    via xsl

    On 3.5.2012 15:20, Joshua Wulf wrote:

    > Hmmm... good question.
    >
    > The child will be in an xi:included file, so the xsl will need to be applied after xi:includes are resolved.
    >
    > I'm not sure where the best place to do that is....

    XIncludes are resolved priort XSLT processing by XML parser.

    My question was aimed differently. Do you want once convert some
    document to use new structure, or should the structure be changed every
    time you process your document?

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




  • 6.  Re: [docbook-apps] Delete child

    Posted 05-04-2012 19:12
    On 3.5.2012 21:39, Joshua Wulf wrote:
    > I'd like to apply it once to convert the document to a new structure.

    Then you need simple identity transformation which will remove section
    with duplicate title, something like:

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

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

    <xsl:template match="section[title = ../title][preceding-sibling::section]">
    <xsl:apply-template select="node()[not(self::title)]"/>
    </xsl:template>

    </xsl:stylesheet>

    Depending on whether you want to keep XIncludes you need to switch
    on/off XInclude in parser used by XSLT processor.

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




  • 7.  RE: Delete child

    Posted 05-03-2012 14:55
    Joshua J Wulf [mailto:jwulf@redhat.com] wrote:

    > I'd like to do the following with an xsl template:
    >
    > If a section or chapter contains an immediate child section with the
    > same title, then
    > delete the child's
    and


  • 8.  Re: [docbook-apps] RE: Delete child

    Posted 05-03-2012 20:02
    Thanks for the suggestion Rob.

    When I try this I get:

    XSLT-apply-templates: could not compile select expression '*[not(name() = 'title']'


    - Josh

    ----- Original Message -----
    From: "rob cavicchio" <rob.cavicchio@emc.com>
    To: docbook-apps@lists.oasis-open.org
    Sent: Friday, May 4, 2012 12:55:19 AM
    Subject: [docbook-apps] RE: Delete child
    via xsl

    Joshua J Wulf [mailto:jwulf@redhat.com] wrote:

    > I'd like to do the following with an xsl template:
    >
    > If a section or chapter contains an immediate child section with the
    > same title, then
    > delete the child's
    and


  • 9.  Re: [docbook-apps] RE: Delete child

    Posted 05-03-2012 20:33
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Looks like you need to close the paren for the not(). Change:

    <xsl:apply-templates select="*[not(name() = 'title']" />

    To:

    <xsl:apply-templates select="*[not(name() = 'title')]" />
    ^^^
    David

    On 05/03/2012 03:02 PM, Joshua Wulf wrote:
    > Thanks for the suggestion Rob.
    >
    > When I try this I get:
    >
    > XSLT-apply-templates: could not compile select expression
    > '*[not(name() = 'title']'
    >
    >
    > - Josh
    >
    > ----- Original Message ----- From: "rob cavicchio"
    > <rob.cavicchio@emc.com> To: docbook-apps@lists.oasis-open.org Sent:
    > Friday, May 4, 2012 12:55:19 AM Subject: [docbook-apps] RE: Delete
    > child
    via xsl
    >
    > Joshua J Wulf [mailto:jwulf@redhat.com] wrote:
    >
    >> I'd like to do the following with an xsl template:
    >>
    >> If a section or chapter contains an immediate child section with
    >> the same title, then delete the child's
    and