I'm using xmllint --shell to inspect a very large XML file. I've written an XPath query that returns the results that I want, but in order to view and save the results, I'm having to cd to each node and then write filename.xml. This wouldn't be so bad if I didn't have to search each time, selecting the result index that I want. Example:xpath count(/root/entry/subentry[special_id = /root/entry/subentry/special_id])Object is a Node Set :Set contains 121 nodes:cd (/root/entry/subentry[special_id = /root/entry/subentry/special_id])[1]write node1.xmlcd (/root/entry/subentry[special_id = /root/entry/subentry/special_id])[2]write node2.xmlcd (/root/entry/subentry[special_id = /root/entry/subentry/special_id])[3]write node3.xml...cd (/root/entry/subentry[special_id = /root/entry/subentry/special_id])[121]write node121.xmlThe above is more or less what I'm doing. Is there a way to save the XML nodes out as a file straight from the search without having to cd to them individually and continue to repeat the search? Or is there a way to preserve the search results, or get their position numbers in one query? 
How do I write the contents of an XMLLint --shell query?
xmllint
This doesn't seem to be possible, so I wrote up an XSLT to do it. <?xml version=1.0 encoding=UTF-8?><xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform    version=2.0>    <xsl:template match=/>        <root>            <xsl:for-each select=/root/entry/subentry[special_id = /root/entry/subentry/special_id]>                <xsl:copy-of select=./>            </xsl:for-each>        </root>    </xsl:template></xsl:stylesheet>