2 * Function: permissions_list_to_docbook2()
3 * Copyright (C) 2011 Robert Soulliere <robert.soulliere@mohawkcollege.ca>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * This function can be used for generating a DocBook appendix in XML format to be included in the Evergreen DocBook documentation.
15 * It takes the code and descrtiption values from permission.perm_list and formats it into XML. Some cleanup is required to remove added lines in the beginning and end of the file.
16 * To run this script simple use the following commands from psql:
18 * SELECT * FROM permissions_list_to_docbook2();
21 CREATE OR REPLACE FUNCTION permissions_list_to_docbook2()
25 r permission.perm_list;
26 -- r permission.perm_list;
33 -- description permission.perm_list.description;
35 FOR r.code, r.description IN SELECT code, description FROM permission.perm_list AS pl WHERE id > 0 ORDER BY code
37 XMLTerm = XMLCONCAT(XMLTerm, '
39 XMLELEMENT (name formalpara,
56 -- XMLTerm = XMLCONCAT(XMLTerm, XMLELEMENT (name listitem, r.description), '
63 'http://docbook.org/ns/docbook' AS "xmlns",
64 'http://www.w3.org/2001/XInclude' AS "xmlns:xi",
65 'http://www.w3.org/1999/xlink' AS "xmlns:xl",
67 'permissions_appendix' AS "xml:id"
74 XMLELEMENT (name title, 'Permissions List')
80 'permission_descriptions' AS "xml:id"
85 XMLELEMENT (name title, 'Permission Descriptions'),
101 LANGUAGE 'plpgsql' VOLATILE