OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Filtering out sections?


-----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:
> 
> <?xml version="1.0"?> <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.
> 
> <section role="wrapper"> <title> Debugging</title> <section> 
> <title> Detail1 </title> </section> <section> <title> Detail2
> </title> </section> </section>
> 
> 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:
> 
>> <section> <title> Debugging</title> <section> <title> Detail1 
>> </title> </section> <section> <title> Detail2 </title>
>> </section> </section>
> 
>> I want to re-use Detail1 and Detail2 in an larger document of
>> type "book". I do this via an x-include.
> 
>> <chapter> <title>Developing Java</title> <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> <title>Developing Java</title> <section> <title>
>> Detail1 </title> </section> <section> <title> Detail2 </title>
>> </section> </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-----


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]