Re: Modular Glossary [FIXED BOGUS LINK]
Hussein Shafie <[email protected]>
| Newsgroups | gmane.editors.xxe.general |
|---|---|
| Message-ID | <[email protected]> |
On 7/31/20 9:03 PM, Tim Trese wrote:
>
> Using XXE for DocBook. I am trying to make a glossary document
> comprising of sibling <glossentry>s from other glossary files. If I were
> doing this in directly in XML, I think what I wish to do would look
> something like:
>
> ---------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <glossary version="5.1" xmlns="http://docbook.org/ns/docbook"
>
> xmlns:xlink="http://www.w3.org/1999/xlink"
>
> xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes"
>
> xmlns:xi="http://www.w3.org/2001/XInclude"
>
> xmlns:trans="http://docbook.org/ns/transclusion"
>
> xmlns:svg="http://www.w3.org/2000/svg"
>
> xmlns:m="http://www.w3.org/1998/Math/MathML"
>
> xmlns:html="http://www.w3.org/1999/xhtml"
>
> xmlns:db="http://docbook.org/ns/docbook">
>
> <glossdiv>
>
> <title>Glossary</title>
>
> <glossentry>
>
> <glossterm>My first entry</glossterm>
>
> <glossdef>
>
> <para>Definition of my first entry</para>
>
> </glossdef>
>
> </glossentry>
>
> <xi:xinclude href="MySecondGlossary.xml"
> xpointer="/glossary/glossdiv/glossentry"/>
>
> </glossdiv>
>
> </glossary>
>
> ------------------
>
> …although I’m somewhat new to this and it’s possible that I
> misunderstand proper usage of XInclude.
>
> Nothing like this appears to be possible directly in XXE. Is there a
> good workaround, or is there a way I can do this with custom
> configuration of XXE?
No need for a workaround or a custom configuration. All this can be
achieved after getting acquainted to "Copy As Reference"/Paste. See
tutorial: "Creating a modular document",
https://www.xmlmind.com/xmleditor/_tutorial/modular_doc/index.html
===================================================================
Recommended procedure: use XXE, no "hand editing" of the XML source
whatsoever
===================================================================
0) Use "Options|Preferences", "Edit" section and turn on "Allow advanced
use of XInclude".
See attached screenshot "0allow_advanced_xinclude_option.png"
See https://www.xmlmind.com/xmleditor/_distrib/doc/help/editOptions.html
1) Let's suppose you want to include some of the glossary entries found
in "glossary2.xml" after the first glossary entry of "glossary1.xml".
See attached screenshot "1two_glossaries.png".
REMEMBER: For most uses of XInclude, you are required to give an xml:id
attribute to your glossary entries.
2) Use XXE node selection to select a contiguous range of glossary
entries in "glossary2.xml".
See attached screenshot "2select_entries_in_glossary2.png".
See tutorial "101 ways to select nodes"
https://www.xmlmind.com/xmleditor/_tutorial/select_nodes/index.html
Then copy a *reference* to selected nodes using "Edit → Reference → Copy
as Reference" (keyboard shortcut: Ctrl+Shift-C). See
https://www.xmlmind.com/xmleditor/_distrib/doc/help/referenceMenu.html#copyAsInclusionAction
3) Now in "glossary1.xml", select first glossary entry.
See attached screenshot "3select_entry_glossary1.png".
4) Execute "Edit→Paste After" (keyboard shortcut: Ctrl-W).
See attached screenshot "4paste_after_selected_entry_of_glossary1.png".
Et voilà!
===================================================================
--> The recommended procedure let XXE generate this kind of advanced but
standard XInclude for you:
---
<xi:include href="glossary2.xml"
xpointer="xpointer(/*/*[1]/*[position() >= 2 and position() <=
last()])"/>
---
See attached screenshot "5advanced_xinclude.png"
See "XPointer Framework, W3C Recommendation 25 March 2003"
https://www.w3.org/TR/xptr-framework/
> The solution will also have to be supported by XSL
> Utility and XSL Server.
>
Sorry but using this kind of advanced XInclude (XPointer Framework)
probably do not work in XSL Utility and XSL Server.
XSL Utility and XSL Server both rely on the XML parser to implement
XInclude and this XML parser (namely Xerces) currently has limited
support for XInclude. See "E. Support of XInclude in XMLmind XSL
Utility",
https://www.xmlmind.com/foconverter/_distrib/xslutil/doc/help/xinclude_support.html
But may be you don't need XSL Utility and XSL Server. May be XXE suffices.
We have "xxetool", a command-line utility, which is basically the
XMLmind XML Editor desktop application, but without a graphical user
interface (GUI). Its main use is to convert XML documents to other
formats (HTML, PDF, RTF, etc) from within a script or a makefile.
More information "The xxetool command-line utility",
https://www.xmlmind.com/xmleditor/_distrib/doc/xxetool/index.html
0allow_advanced_xinclude_option.png
(image/png, 115.8 KB) - not displayed
1two_glossaries.png
(image/png, 141.3 KB) - not displayed
2select_entries_in_glossary2.png
(image/png, 123.4 KB) - not displayed
3select_entry_glossary1.png
(image/png, 138.2 KB) - not displayed
4paste_after_selected_entry_of_glossary1.png
(image/png, 134.5 KB) - not displayed
5advanced_xinclude.png
(image/png, 87.2 KB) - not displayed