xml: add select, edit and transform subcommands.

This commit is contained in:
Daniel Birket
2021-08-20 23:20:02 -04:00
committed by Starbeamrainbowlabs
parent 82f626c693
commit 1202e84d48
3 changed files with 23 additions and 42 deletions

View File

@@ -1,27 +1,24 @@
# xml select
> Select from XML documents using XPATH.
> More information: <http://xmlstar.sourceforge.net/doc/xmlstarlet.pdft>.
> Select from XML documents using XPATHs.
> Tip: use `xml elements` to display the XPATHs of an XML document.
> More information: <http://xmlstar.sourceforge.net/docs.php>.
- TBD:
- Select all elements matching "XPATH1" and print the value of the element "XPATH2":
`xml select`
`xml select --template --match {{"XPATH1"}} --value-of {{"XPATH2"}} {{path/to/input.xml|URI}}`
- TBD:
- Match "XPATH1" and print the value of "XPATH2" as text with new-lines:
`xml select`
`xml select --text --template --match {{"XPATH1"}} --value-of {{"XPATH2"}} --nl {{path/to/input.xml|URI}}`
- TBD:
- Count the elements of "XPATH1":
`xml select`
`xml select --template --value-of "count({{XPATH1}})" {{path/to/input.xml|URI}}`
- TBD:
- Count all nodes in XML document(s):
`xml select`
- TBD:
`xml select`
`xml select --text --template --inp-name --output " " --value-of "count(node())" --nl {{path/to/input1.xml|URI}} {{path/to/input2.xml|URI}}`
- Display help for the `select` subcommand: