It should be
BatchTable/UUThref/@Version
not
BatchTable/UUThref/[@Version]
... where do you get the square brackets from?
I tested the following and it definitely works:
xmlstarlet sel -t -m 'BatchTable/UUThref/@Version' -v . <test.xml
... this command line works by applying the following XSLT:
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" version="1.0" extension-element-prefixes="exslt"> <xsl:output omit-xml-declaration="yes" indent="no"/> <xsl:template match="/"> <xsl:for-each select="BatchTable/UUThref/@Version"> <xsl:call-template name="value-of-template"> <xsl:with-param name="select" select="."/> </xsl:call-template> </xsl:for-each> </xsl:template> <xsl:template name="value-of-template"> <xsl:param name="select"/> <xsl:value-of select="$select"/> <xsl:for-each select="exslt:node-set($select)[position()>1]"> <xsl:value-of select="' '"/> <xsl:value-of select="."/> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Charles Duffy
source share