[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Adding new element to the scheme
Thanks Bob! Both ways worked as a charm (with the mentioned problem of using the first method for FO). Ended up using the identity stylesheet method. Thanks. Ilan From: Bob Stayton <bobs@sagehill.net> Hi Ilan, I know of two approaches to this problem. In the first approach, in your customization layer process the requirement element into docbook table elements inside a variable, convert the variable's content to a node-set using the exlt:node-set() function, and then process the node-set with the standard
DocBook stylesheets (see example below). or Preprocess your document into a temporary document with a stylesheet that is an identity stylesheet except for templates that process requirements into DocBook tables. The output is a pure DocBook document, mixing your original DocBook elements copied over
with the generated DocBook tables. Then you can process this temporary document with standard DocBook stylesheets. The first approach has the advantage of being done in a single XSLT process, because the table is held in memory and then processed, while the second approach requires two XSLT processes. The second approach has the advantage of transparency, in that you
can view the temporary output to see how it is working, while an internal node-set is not visible. Here is an example of the first approach that works for HTML processing, using a much simpler input element and link: <requirement xml:id="myrequirement"> and the template that processes that (I'm assuming you are using DocBook 5): <xsl:template match="d:requirement"> <xsl:variable name="id" select="@xml:id"/> <xsl:variable name="req"> <xsl:variable name="nodeset" select="exsl:node-set($req)"/> <xsl:apply-templates select="$nodeset"/> </xsl:template> I used d:informaltable to avoid table numbering, because requirement won't be counted as a table so the numbering sequence won't be right (unless you fix the template that counts tables). Since you didn't include a title, I assumed you meant informaltable
anyway. If you want these things numbered along with your other tables, you will have to use the second approach. Also, the nodeset approach won't work for FO output because the informaltable in the nodeset is treated as a separate document, and so the stylesheet will generate fo:root for the table within a fo:page-sequence, which is invalid in the XSL-FO processor.
If you use the second, two-pass approach, a single first-pass stylesheet can generate the temporary pure DocBook document for either HTML or FO processing, so I would recommend that approach. Let me know if you need more help with the identity stylesheet
approach. Bob Stayton Sagehill Enterprises bobs@sagehill.net On 12/10/2018 5:44 AM, Ilan Finci wrote:
|
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]