Re: [docbook-apps] Filtering out sections?

From
Lars Vogel <>
Date
2011-11-27T15:27:38+00:00
ID
Thread
Re: [docbook-apps] Filtering out sections?
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 <>

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

<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="" /> </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

>

>

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

For additional commands, e-mail: 

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