The Fedora SELinux FAQ[1] is starting to get sizable, and messy without a list of questions at the top. I'm having trouble fixing this.
Our default XSL stylesheets for HTML (xsl/main-html.xsl, xsl/html-common.xsl, and redhat.xsl) don't have a call to make the list of questions for a FAQ written with <qandaset>[2].
It seemed straightforward to call qandaset.xsl[3], just as other stylesheets are called in the Fedora docs XSL. I have had no success, in fact zero recognizable difference in the resulting document, with these efforts:
* Tried importing, then tried including qandaset.xsl into main-html.xsl, which is the main XSL called from the Makefile.
xsl:import="/usr/share/sgml/docbook/xsl-stylesheets/html/qandaset.xsl"/ ... didn't work ... xsl:include="/usr/share/sgml/docbook/xsl-stylesheets/html/qandaset.xsl"/ .... didn't work ...
* Under the heading <xsl:param name="generate.toc">, I tried adding "qanda toc" and "qandaset toc", underneath the "section nop" in both cases. No luck there. I didn't feel that this area of the XSL was related to the solution, but I tried it anyway.
Any ideas?
- Karsten
[1] http://people.redhat.com/kwade/fedora-docs/selinux-faq-en/ http://people.redhat.com/kwade/fedora-docs/selinux-faq/selinux-faq-en.xml
[2] http://www.docbook.org/tdg/en/html/qandaset.html
[3] /usr/share/sgml/docbook/xsl-stylesheets/html/qandaset.xsl
At 00:47 07/04/2004, Karsten Wade wrote:
The Fedora SELinux FAQ[1] is starting to get sizable, and messy without a list of questions at the top. I'm having trouble fixing this.
near the top.
<xsl:import href="DavePawsonsTOC.xsl"/>
Then, whereever you want the toc placed,
<xsl:call-template name="davePawsonsToc"/>
How's that sound?
Or you could use the docbook website xslt stylesheets, but I guess that smells of NIH?
Funny, they have just what you want Karsten!
regards DaveP
On Wed, 2004-04-07 at 08:26, Dave Pawson wrote:
At 00:47 07/04/2004, Karsten Wade wrote:
The Fedora SELinux FAQ[1] is starting to get sizable, and messy without a list of questions at the top. I'm having trouble fixing this.
near the top.
<xsl:import href="DavePawsonsTOC.xsl"/>
Then, whereever you want the toc placed,
<xsl:call-template name="davePawsonsToc"/>
How's that sound?
Or you could use the docbook website xslt stylesheets, but I guess that smells of NIH?
Funny, they have just what you want Karsten!
I tried to figure this out, and couldn't understand what you mean. One reason is not having DavePawsonTOC.xsl ... did an attachment to the list get stripped?
Oh, I'm back to being a newbie again. :)
Anyway ... I resolved it this way.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=122665 includes a simple two line patch to fedora-docs/xsl/main-html.xsl:
--- main-html.xsl 1 Oct 2003 19:02:56 -0000 1.2 +++ main-html.xsl 6 May 2004 18:52:51 -0000 @@ -24,6 +24,8 @@ book toc article toc chapter nop +qandadiv toc +qandaset toc sect1 nop sect2 nop sect3 nop
Then I added this one line to my XML:
<qandaset defaultlabel="qanda" id="selinux-faq-list"> + <?dbhtml toc="1"?> <qandaentry>
This generated the TOC. It could be prettier, but it works for me for now.
cheers - Karsten
At 20:17 06/05/2004, Karsten Wade wrote:
Anyway ... I resolved it this way.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=122665 includes a simple two line patch to fedora-docs/xsl/main-html.xsl:
--- main-html.xsl 1 Oct 2003 19:02:56 -0000 1.2 +++ main-html.xsl 6 May 2004 18:52:51 -0000 @@ -24,6 +24,8 @@ book toc article toc chapter nop +qandadiv toc +qandaset toc sect1 nop sect2 nop sect3 nop
Then I added this one line to my XML:
<qandaset defaultlabel="qanda" id="selinux-faq-list">
<?dbhtml toc="1"?> <qandaentry>
This generated the TOC. It could be prettier, but it works for me for now.
I've seen the pi's being used, but have you tried
<toc/>
<qandaset defaultlabel="qanda" id="selinux-faq-list">
<?dbhtml toc="1"?> <qandaentry>
instead? That normally causes the toc insertion. Its not valid (the toc element) where you have the pi, must it be there?
regards DaveP
On Sat, 2004-05-08 at 01:33, Dave Pawson wrote:
At 20:17 06/05/2004, Karsten Wade wrote:
Anyway ... I resolved it this way.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=122665 includes a simple two line patch to fedora-docs/xsl/main-html.xsl:
--- main-html.xsl 1 Oct 2003 19:02:56 -0000 1.2 +++ main-html.xsl 6 May 2004 18:52:51 -0000 @@ -24,6 +24,8 @@ book toc article toc chapter nop +qandadiv toc +qandaset toc sect1 nop sect2 nop sect3 nop
Then I added this one line to my XML:
<qandaset defaultlabel="qanda" id="selinux-faq-list">
<?dbhtml toc="1"?> <qandaentry>
This generated the TOC. It could be prettier, but it works for me for now.
I've seen the pi's being used, but have you tried
<toc/> > <qandaset defaultlabel="qanda" id="selinux-faq-list"> >+ <?dbhtml toc="1"?> > <qandaentry>
instead? That normally causes the toc insertion. Its not valid (the toc element) where you have the pi, must it be there?
I'm still not understanding completely. The processing instructions (PIs) are a valid way of tackling this, yes? Or is the problem that this one is only really good for HTML output?
I also didn't have success with the <toc />. In my <article>, the only place I can validly insert a <toc></toc> block is inside of the <sect1>. Doing so doesn't make it appear in the rendered HTML, probably because of the stylesheet again, although I can't see why. 'sect1 nop' in main-html.xsl disables ToCs for the sections, and a ToC is generated and enabled via 'article toc'.
I also discovered that the mere inclusion of 'qandadiv toc' in the <xsl:param name="generate.toc"> section of fedora-docs/xsl/main-html.xsl is enough to generate the ToC that appear after the title of each <qandadiv>. The only way I have successfully created the entire 'table of questions' for the <qandaset> is with the PI <?dbhtml toc="1"?>.
/me scratches his head
I'm happy with my hack for the moment, but I'm not happy with not fully understanding _why_ it works as it does. Back to the books ...
- Karsten
At 23:11 13/05/2004, Karsten Wade wrote:
I've seen the pi's being used, but have you tried
<toc/> > <qandaset defaultlabel="qanda" id="selinux-faq-list"> >+ <?dbhtml toc="1"?> > <qandaentry>
instead? That normally causes the toc insertion. Its not valid (the toc element) where you have the pi, must it be there?
I'm still not understanding completely. The processing instructions (PIs) are a valid way of tackling this, yes?
Ambivalent about that, since there are no pi's in the dtd :-)
Or is the problem that this one is only really good for HTML output?
I'm saying docbook provides a way of automatically generating a toc itself?
If you use a toc element, try validating it with the toc element in place, or read about it in tdg?
http://www.docbook.org/tdg/en/html/toc.html
I also didn't have success with the <toc />. In my <article>, the only place I can validly insert a <toc></toc> block is inside of the <sect1>.
Parents
These elements contain toc: http://www.docbook.org/tdg/en/html/appendix.htmlappendix, http://www.docbook.org/tdg/en/html/article.htmlarticle, http://www.docbook.org/tdg/en/html/book.htmlbook, http://www.docbook.org/tdg/en/html/chapter.htmlchapter, http://www.docbook.org/tdg/en/html/part.htmlpart, http://www.docbook.org/tdg/en/html/preface.htmlpreface, http://www.docbook.org/tdg/en/html/sect1.htmlsect1, http://www.docbook.org/tdg/en/html/sect2.htmlsect2, http://www.docbook.org/tdg/en/html/sect3.htmlsect3, http://www.docbook.org/tdg/en/html/sect4.htmlsect4, http://www.docbook.org/tdg/en/html/sect5.htmlsect5, http://www.docbook.org/tdg/en/html/section.htmlsection, http://www.docbook.org/tdg/en/html/set.htmlset.
Doing so doesn't make it appear in the rendered HTML, probably because of the stylesheet again, although I can't see why. 'sect1 nop' in main-html.xsl disables ToCs for the sections, and a ToC is generated and enabled via 'article toc'.
Read up on where/when you want tocs in the doco for the stylesheets.
I also discovered that the mere inclusion of 'qandadiv toc' in the <xsl:param name="generate.toc"> section of fedora-docs/xsl/main-html.xsl is enough to generate the ToC that appear after the title of each <qandadiv>.
Yep, that's your 'control' aspect of where and when you want a toc.
The only way I have successfully created the entire 'table of questions' for the <qandaset> is with the PI <?dbhtml toc="1"?>.
/me scratches his head
I'm happy with my hack for the moment, but I'm not happy with not fully understanding _why_ it works as it does. Back to the books ...
If you want one, and its not supported, put in the request at sourceforge, or mail it to the docbook-apps list?
HTH DaveP
docs@lists.stg.fedoraproject.org