Debian Codegraph @

src/select-usage.txt

raw
1 XMLStarlet Toolkit: Select from XML document(s)
2 Usage: PROG sel <global-options> {<template>} [ <xml-file> ... ]
3 where
4 <global-options> - global options for selecting
5 <xml-file> - input XML document file name/uri (stdin is used if missing)
6 <template> - template for querying XML document with following syntax:
7
8 <global-options> are:
9 -Q or --quiet - do not write anything to standard output.
10 -C or --comp - display generated XSLT
11 -R or --root - print root element <xsl-select>
12 -T or --text - output is text (default is XML)
13 -I or --indent - indent output
14 -D or --xml-decl - do not omit xml declaration line
15 -B or --noblanks - remove insignificant spaces from XML tree
16 -E or --encode <encoding> - output in the given encoding (utf-8, unicode...)
17 -N <name>=<value> - predefine namespaces (name without 'xmlns:')
18 ex: xsql=urn:oracle-xsql
19 Multiple -N options are allowed.
20 --net - allow fetch DTDs or entities over network
21 --help - display help
22
23 Syntax for templates: -t|--template <options>
24 where <options>
25 -c or --copy-of <xpath> - print copy of XPATH expression
26 -v or --value-of <xpath> - print value of XPATH expression
27 -o or --output <string> - output string literal
28 -n or --nl - print new line
29 -f or --inp-name - print input file name (or URL)
30 -m or --match <xpath> - match XPATH expression
31 --var <name> <value> --break or
32 --var <name>=<value> - declare a variable (referenced by $name)
33 -i or --if <test-xpath> - check condition <xsl:if test="test-xpath">
34 --elif <test-xpath> - check condition if previous conditions failed
35 --else - check if previous conditions failed
36 -e or --elem <name> - print out element <xsl:element name="name">
37 -a or --attr <name> - add attribute <xsl:attribute name="name">
38 -b or --break - break nesting
39 -s or --sort op xpath - sort in order (used after -m) where
40 op is X:Y:Z,
41 X is A - for order="ascending"
42 X is D - for order="descending"
43 Y is N - for data-type="numeric"
44 Y is T - for data-type="text"
45 Z is U - for case-order="upper-first"
46 Z is L - for case-order="lower-first"
47
48 There can be multiple --match, --copy-of, --value-of, etc options
49 in a single template. The effect of applying command line templates
50 can be illustrated with the following XSLT analogue
51
52 PROG sel -t -c "xpath0" -m "xpath1" -m "xpath2" -v "xpath3" \
53 -t -m "xpath4" -c "xpath5"
54
55 is equivalent to applying the following XSLT
56
57 <?xml version="1.0"?>
58 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
59 <xsl:template match="/">
60 <xsl:call-template name="t1"/>
61 <xsl:call-template name="t2"/>
62 </xsl:template>
63 <xsl:template name="t1">
64 <xsl:copy-of select="xpath0"/>
65 <xsl:for-each select="xpath1">
66 <xsl:for-each select="xpath2">
67 <xsl:value-of select="xpath3"/>
68 </xsl:for-each>
69 </xsl:for-each>
70 </xsl:template>
71 <xsl:template name="t2">
72 <xsl:for-each select="xpath4">
73 <xsl:copy-of select="xpath5"/>
74 </xsl:for-each>
75 </xsl:template>
76 </xsl:stylesheet>
77