s1kd-icncatalog(1) s1kd-tools s1kd-icncatalog(1) NAME s1kd-icncatalog - Manage the catalog used to resolve ICNs SYNOPSIS s1kd-icncatalog [options] [...] DESCRIPTION The s1kd-icncatalog tool is used to manage a catalog of ICNs for a project, and to resolve ICNs using this catalog. Resolving an ICN means placing the actual filename of the ICN in to the SYSTEM ID of the ENTITY declaration within CSDB objects. OPTIONS -a, --add Add an ICN to the catalog. Follow with the -u and -n options to specify the URI and notation to use for this ICN. The -m option specifies a media group to add the ICN to. -C, --create Create a new empty catalog. -c, --catalog Specify the catalog file to manage or resolve against. By de‐ fault, the file .icncatalog in the current directory is used. If the current directory does not contain this file, the parent directories will be searched. -d, --del Delete an ICN from the catalog. The -m option specifies a media group to delete the ICN from. -f, --overwrite Overwrite the input CSDB objects when resolving ICNs, or over‐ write the catalog file when modifying it. Otherwise, output is written to stdout. -h, -?, --help Show help/usage message. -l, --list Treat input (stdin or arguments) as lists of filenames of CSDB objects, rather than CSDB objects themselves. -m, --media Resolve ICNs for this intended output media. The catalog may contain alternative formats for the same ICN to be used for dif‐ ferent output media. -n, --ndata Specify the notation to reference when adding an ICN with the -a option. -q, --quiet Quiet mode. Errors are not printed. -t, --type Specify the type of catalog entry when adding an ICN with the -a option. -u, --uri Specify the URI when adding an ICN with the -a option. -v, --verbose Verbose output. --version Show version information. In addition, the following options allow configuration of the XML pars‐ er: --dtdload Load the external DTD. --huge Remove any internal arbitrary parser limits. --net Allow network access to load external DTD and entities. --noent Resolve entities. --parser-errors Emit errors from parser. --parser-warnings Emit warnings from parser. --xinclude Do XInclude processing. --xml-catalog Use an XML catalog when resolving entities. Multiple catalogs may be loaded by specifying this option multiple times. EXAMPLES Resolving ICNs to filenames A CSDB object may reference an ICN as follows: The SYSTEM ID of this ENTITY indicates that the ICN file will be in the same directory relative to the CSDB object. However, the ICN files in this example are located in a separate folder called 'graphics'. Rather than manually updating every ENTITY declaration in every CSDB object, a catalog file can be used to map ICNs to actual filenames: Then, using this tool, the ICN can be resolved against the catalog: $ s1kd-icncatalog -c Producing the following output: Alternative ICN formats A catalog can also be used to provide alternative file formats for an ICN depending on the intended output media. For example: The -m option allows for specifying which type of media to resolve for: $ s1kd-icncatalog -c -m pdf $ s1kd-icncatalog -c -m web Reconstructing ICN entity declarations Some processing, such as XSL transformations, may remove the DTD and external entity declarations as part of parsing an XML CSDB object. A catalog can be used to restore the necessary external entity declara‐ tions afterwards. For example: $ xsltproc ex.xsl The resulting XML will not include a DTD or the external entity decla‐ rations for the ICNs referenced in the object, so it will not be valid according to the S1000D schema: $ xsltproc ex.xsl | s1kd-validate -:49:element graphic: Schemas validity error: Element 'graphic', attribute 'infoEntityIdent': 'ICN-12345-00001-001-01' is not a valid value of the atomic type 'xs:ENTITY'. Passing the result to this tool, with a catalog containing all the ICNs used by the project: $ xsltproc ex.xsl | s1kd-icncatalog -c will reconstruct the required external entity declarations in the DTD. The s1kd-tools will copy the DTD and external entity declarations auto‐ matically when performing transformations, so this is only necessary when using more generic XML tools. ICN pattern rules By default, each catalog entry matches a single ICN, but multiple ICNs can be resolved with a single entry by using a pattern rule. An entry with attribute type="pattern" specifies a regular expression to use to match ICNs and a template used to construct the resolved URI: The above entry would match a series of CAGE-based ICNs, resolving them to a subfolder of 'graphics' based on their CAGE code. Using this en‐ try, the following input: ]> would be resolved as follows: ]> The regular expressions must conform to the extended POSIX regular ex‐ pression syntax. Backreferences \1 through \9 can be used in the URI template to substitute captured groups. CATALOG SCHEMA The following describes the schema of an ICN catalog file. Catalog Markup element: Attributes: · None Child elements: · · · Notation The element represents a NOTATION declaration. Markup element: Attributes: · name, the NDATA name. · publicId, the optional PUBLIC ID of the notation. · systemId, the optional SYSTEM ID of the notation. Child elements: · None Media The element groups a set of alternative ICN formats for a par‐ ticular output media type. Markup element: Attributes: · name, the identifier of the output media. Child elements: · ICN The element maps an ICN to a filename and optionally a notation. When this element occurs as a child of a element, it will be used when that output media is specified with the -m option. When it occurs as a child of , it will be used if no media is spec‐ ified. Markup element: Attributes: · type, the type of ICN entry, with one of the following values: · "single" (D) - Specifies a single ICN to resolve. · "pattern" - Specifies a pattern to resolve one or more ICNs. · infoEntityIdent, the ICN, or pattern used to match ICNs. · uri, the filename the ICN will resolve to. · notation, a reference to a previously declared element. Child elements: · None Example ICN catalog AUTHORS khzae.net. 2021-04-16 s1kd-icncatalog(1)