This transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:d="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:copy-of select="/*/*[self::d:variable or self::d:group]"/>
</xsl:template>
</xsl:stylesheet>
when applied on the provided XML document:
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"
location="file:/dev/null" iosp="lasp.tss.iosp.ValueGeneratorIOSP"
start="0" increment="1">
<attribute name="title" value="Vector time series"/>
<dimension name="time" length="100"/>
<variable name="time" shape="time" type="double">
<attribute name="units" type="String"
value="seconds since 1970-01-01T00:00"/>
</variable>
<group name="Vector" tsdsType="Structure" shape="time">
<variable name="x" shape="time" type="double"/>
<variable name="y" shape="time" type="double"/>
<variable name="z" shape="time" type="double"/>
</group>
</netcdf>
produces (what I guess is) the wanted result:
<variable xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" name="time" shape="time" type="double">
<attribute name="units" type="String" value="seconds since 1970-01-01T00:00"/>
</variable>
<group xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" name="Vector" tsdsType="Structure" shape="time">
<variable name="x" shape="time" type="double"/>
<variable name="y" shape="time" type="double"/>
<variable name="z" shape="time" type="double"/>
</group>
Do note: <xsl:value-of>
outputs the string value, while <xsl:copy-of>
outputs the node(s). In your case the string value of either element is empty on white-space only, so you probably want the elements themselves.
This is really an XPath question and there are different possible solutions:
/*/*[self::d:variable or self::d:group]
(the above is used in the transformation above), or:
/*/d:variable | /*d:group
This one uses the XPath union operator /