[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] trouble with footers
I presume your simple document's root element has the namespace declaration xmlns="http://docbook.org/ns/docbook", and that you are using the docbook-xsl-ns namespace aware stylesheets, correct?
A1: The preferred way is with xsl:apply-templates in most cases. That way any child elements are processed with their templates. When you use xsl:value-of, it returns only the text strings within the element, ignoring any element markup, and you lose such things as subscript positioning and generated trademarks.
There are a few situations where you must have text only, such as when you are computing an attribute value such as alt which cannot contain markup elements. Even then, I usually use apply-templates inside a variable, and then take the value-of of the variable. That way any generated text is included.
Back to your question, many of the elements in info don't have templates in the default mode (no mode), only in mode="titlepage.mode". That is the case with releaseinfo. Fortunately, the titlepage.mode works outside of titlepages too when it is applied. You could also create a new template in a new mode, such as mode="footer.mode", and apply that mode if you need different behavior.
A2: The date element does have a template in default mode, in fo/inline.xsl. I think that's because date also appears in revhistory, and revhistory can appear in lots of places outside of titlepages.
A3: The default mode is generally used to process the content of a document in document order. But info is one of those elements that contains metadata, and is generally not meant to be processed in document order. The titlepage spec file exists to rearrange or omit elements in info. The default mode template for info is empty to prevent it from being accidentally processed in document order:
Modes are used to process elements outside of document order, such as in a toc and titlepage.
A4: answered in Q1.
A5: The difference is the context from which the template is applied. The titlepage and toc are generated by the template with match="d:book", so the current context element is <book>, and so a relative path such as "d:info/d:releaseinfo" works relative to that context. A chapter is generated by the template with match="d:chapter", so the current context elements is <chapter>, and now a path relative to the chapter would look for d:chapter/d:info, which probably doesn't exist in your document.
To get at the book's info element from all contexts, you need a full XPath:
Hope this helps.