Xmlmind next previous links8/5/2023 The simplest syntax just has an id value in an xpointer attribute. You can organize your modules into logical units for writing and editing, and the select from within a file if you need just a piece of a module. In a modular source setup, that means you do not have to break out into a separate file every single piece of text that you want to include somewhere. That is something that system entities were never able to do. The XInclude standard permits you to select part of a file for inclusion instead of the whole file. Likewise, the included content must resolve to a single element, with its children. In that case, there can be only one, since a well-formed document can only have a single root element. You also do not want to repeat content that has any id attributes, because duplicate id values are invalid.Ī document's root element can be an XInclude element. You cannot select the whole document or that part of the document that has the XInclude element, because that would be a circular reference. When you omit the href attribute, and add an xpointer attribute, then it is interpreted as selecting from the current document. You can include parts of the including document in order to repeat part of its content in the same document, if you do it carefully. See the section “Selecting part of a file” for more information. You can select parts of an included document instead of the whole content. That is true for each of any nested includes as well, even when they are in different directories. A relative path is taken as relative to the document that contains the XInclude element (the including document). As such, it can be mapped with XML catalog entries, as described in the section “XIncludes and XML catalogs”. The href value in an XInclude can be an absolute path, a relative path, an HTTP URL that accesses a web server, or any other URI. Then the chapter file is included in the larger book file. This might be useful when keeping a collection of section modules that can be assembled into several different versions of a chapter. That means an included file can contain XIncludes to further modularize the content. It is the author's responsibility to make sure the included content is valid in the location where it is pulled in. When the XInclude is resolved during the processing, the element will be replaced by the included chapter element and all of its children. If no xpointer attribute is added, then it will pull in the whole file starting with its root element. The href contains a URI that points to the file you want to include. But the namespace prefix xi: can be any name, as long as it matches what is used on the include element. The URI in quotes must exactly match this string for it to work. The syntax for the inclusion is an empty element whose name is include, with the name augmented with a namespace prefix xi. The book file also has a DOCTYPE declaration, which says this document is a book. Unless otherwise specified, an XInclude gets the root element and all of its children. The chapter file has a complete DOCTYPE declaration that identifies the mini document as a chapter. See Chapter 24, Olinking between documents for general information about using olinks, and the section “Modular cross referencing” for using olinks with modular files. Olinks are resolved by the stylesheet at runtime, whether you are processing a single module or the assembled document. Olinks get around this problem by not using IDREF attributes to form the cross reference. When you try to open such a module in a structured editor, it will complain that the document is not valid. They will be together when you assemble your modules into a larger document, but the individual mini documents will be incomplete. That is because those elements use an IDREF-type attribute to form the link, and the ID it points to must be in the same document. If you try to use xref or link to cross reference to another file module, then your mini document is no longer valid. Olinks enable you to form cross references among your modular files. Conveniently, the module's DOCTYPE does not generate an error when its content is pulled in using the XInclude mechanism. With the introduction of the XInclude feature of XML, the modular files can be valid mini documents, complete with DOCTYPE declaration. This creates problems when you try to load a system entity file into a structured editor that expects to be able to validate the document. System entities were always a problem because they cannot have a DOCTYPE declaration, and therefore cannot be valid documents on their own. XIncludes replace the old way of doing modular files using system entities. The best tools for modular documentation are XIncludes and olinks. Smaller file units to load into an editing program.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |