Ignore Namespaces in XPath Query

e.g. Query for all xxx nodes ignoring their namespace:

xmllint --xpath '//*[local-name()="xxx"]' input.xml

An example parsing URLs from a sitemap XML.

The URLs are located in //url/loc where all nodes are bound to the namespace http://www.sitemaps.org/schemas/sitemap/0.9.

The following query ignores the namespace

xmllint --xpath '//*[local-name()="url"]/*[local-name()="loc"]' sitemap.xml

Pretty Print XML in the Console using xmllint

echo '<blogs><blog url="https://www.hascode.com/">hasCode.com</blog></blogs>' | xmllint --format -
<?xml version="1.0"?>
<blogs>
    <blog url="https://www.hascode.com/">hasCode.com</blog>
</blogs>

XSLT Strip Namespaces for Output

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:foo="http://foo"
xmlns:bar="http://bar"
exclude-result-prefixes="foo bar">

Extract Nodes from XML via XPath in the console

 xmllint --format --xpath '//plugin/name/text()' application.xml