Difference between revisions of "Command/xmlinclude"
< Command
Jump to navigation
Jump to search
(Create entire page) |
|||
Line 33: | Line 33: | ||
* If no attribute is specified, {{code|href}} is assumed. | * If no attribute is specified, {{code|href}} is assumed. | ||
* If the file is empty or not found, the inclusion tag is replaced with nothing. | * If the file is empty or not found, the inclusion tag is replaced with nothing. | ||
− | * Inclusion is recursive: if the tree you | + | * Inclusion is recursive: if there are inclusion tags in the external tree you pull in, then they, in turn are acted on, too. If you do not want recursive inclusion, you must use the {{code|xml.include))}} command directly, like so: |
+ | |||
+ | \ctxlxml{include("main","include","filename|href",false)} % false means no recursion | ||
== Example == | == Example == |
Revision as of 22:01, 16 December 2012
\xmlinclude
Syntax
\xmlinclude{...}{...}{...} | |
{...} | xmldata, usually main |
{...} | pattern that matches tags that stand for 'include external file'. Default: include |
{...} | names of attribute containing URL of file to include, separated by pipes. Default: href |
Description
\xmlinclude{main}{include}{filename|href|name} merges XML trees in external files into the tree called main
. External files are merged in at every include
tag; which file to merge in is determined by looking at the filename
attribute; if that is absent the href
and name
attributes are tried in order.
Further behaviour:
- If no attribute is specified,
href
is assumed. - If the file is empty or not found, the inclusion tag is replaced with nothing.
- Inclusion is recursive: if there are inclusion tags in the external tree you pull in, then they, in turn are acted on, too. If you do not want recursive inclusion, you must use the
xml.include))
command directly, like so:
\ctxlxml{include("main","include","filename|href",false)} % false means no recursion
Example
<example> <chapter>text 1</chapter> <chapter>text 2</chapter> </example>
\xmlinclude...
See also
Help from ConTeXt-Mailinglist/Forum
All issues with: