XMLStarlet: Difference between revisions
Jump to navigation
Jump to search
(→-t -c) |
(→-v) |
||
Line 29: | Line 29: | ||
The example is taken from [[XPath#Example|XPath | Example]]. | The example is taken from [[XPath#Example|XPath | Example]]. | ||
===<tt>-v</tt>=== | ===<span id='-v'></span><tt>-t -v</tt>=== | ||
=<tt>ed</tt> Command= | =<tt>ed</tt> Command= |
Revision as of 02:34, 1 July 2021
External
- https://www.baeldung.com/linux/evaluate-xpath#using-the-xmlstarlet-toolkit
- http://xmlstar.sourceforge.net/
Internal
Overview
XMLStartlet ships with one executable called xml
, which can be used as the short form of the xmlstarlet
command.
XPath Syntax
Usage
xml [options] <command> [command options]
sel Command
Select (query) an XML file using XPath. It can also generate an XSLT document. Internally, when sel
command is used, the tool converts internally the commands into an XSLT to perform the query.
xml sel --help
sel -t
Create an XSLT template using the provided options.
xml sel -t <template options> <xml-file-name>
Template Options
-t -c
Print a copy of XPath expression. Return the element (elements) that match the provided XPath expression, including the XML tags.
xml sel -t -c "<xpath-expression>" <xml-file-name>
xml sel -t -c "//book[@category='linux']" <xml-file-name>
The example is taken from XPath | Example.
-t -v
ed Command
Edit an XML file.
tr Command
Transform an XML file using XSLT.