Re: [docbook-apps] Adding new element to the scheme
Hi Tony, That does work. Thanks for pointing that out. Bob Stayton Sagehill Enterprises b...@sagehill.net On 12/11/2018 11:11 AM, Tony Graham wrote: On 11/12/2018 05:40, Bob Stayton wrote: ... ... 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. I am not in a position to try it, but how does this not avoid the problem: ? Regards, Tony Graham.
Re: [docbook-apps] Adding new element to the scheme
On 11/12/2018 05:40, Bob Stayton wrote: ... ... 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. I am not in a position to try it, but how does this not avoid the problem: ? Regards, Tony Graham. -- Senior Architect XML Division Antenna House, Inc. Skerries, Ireland tgra...@antenna.co.jp - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
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 Date: Tuesday, 11 December 2018 at 7:40 To: "docbook-apps@lists.oasis-open.org" Subject: Re: [docbook-apps] Adding new element to the scheme 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: My requirement ... Link to Requirement and the template that processes that (I'm assuming you are using DocBook 5): > 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 b...@sagehill.net<mailto:b...@sagehill.net> On 12/10/2018 5:44 AM, Ilan Finci wrote: Hi I’m new to docbook and XSLT, and tried to find the answer among the different books/websites and failed, so looking up for your help (pointers to the right place will be good as well). I’m trying to add a new element to my docbook, that will describe a requirement for example: TRC_001 1 New H We need to be able to save a snapshot of requirements per product version None In my outputs, I want to format each such requirement as a table. Writing same table as docbook table directly, I would have something like: TRC_001 1 New H We need to be able to save a snapshot of requirements per product version None I tried to add this to stylesheet, but I cannot write “docbook” table there, and I have to do it per output format (HTML – use the tr & td flags, FO for PDF and other print formats…) 1. Is there a way to do the conversion of the new “requirement” into docbook code, which will automatically be formatted as HTML or FO later, base on the xsltproc parameters I give? 2. Is there a way to add reference based on the requirement ID (so I can link to it later)? Thanks in advance Ilan IMPORTANT NOTICE: The contents of this email and any attachments are confidential an
Re: [docbook-apps] Adding new element to the scheme
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: My requirement ... Link to Requirement and the template that processes that (I'm assuming you are using DocBook 5): 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 b...@sagehill.net On 12/10/2018 5:44 AM, Ilan Finci wrote: Hi I’m new to docbook and XSLT, and tried to find the answer among the different books/websites and failed, so looking up for your help (pointers to the right place will be good as well). I’m trying to add a new element to my docbook, that will describe a requirement for example: TRC_001 1 New H We need to be able to save a snapshot of requirements per product version None In my outputs, I want to format each such requirement as a table. Writing same table as docbook table directly, I would have something like: colwidth="*" /> colwidth="*" /> colwidth="*" /> colwidth="*" /> nameend="3"/> TRC_001 1 New H We need to be able to save a snapshot of requirements per product version None I tried to add this to stylesheet, but I cannot write “docbook” table there, and I have to do it per output format (HTML – use the tr & td flags, FO for PDF and other print formats…) 1. Is there a way to do the conversion of the new “requirement” into docbook code, which will automatically be formatted as HTML or FO later, base on the xsltproc parameters I give? 2. Is there a way to add reference based on the requirement ID (so I can link to it later)? Thanks in advance Ilan IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.