私はこのxmlファイルを持っています
<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>
そして、このような出力を与えるxsltファイルが必要です
1.time
2.Vector
variable と group の 2 つのタグの name 属性です。現在、私はこのようなコードを持っています
<xsl:for-each select="document($path)//*[local-name()='variable']">
<xsl:if test="string-length( @*[local-name()='name'] ) >1">
<li>
<xsl:value-of select="position()"/>
<xsl:value-of select="@*[local-name()='name']"/>
</li>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="document($path)//*[local-name()='group']">
<li>
<xsl:value-of select="position()"/>
<xsl:value-of select="@*[local-name()='name']"/>
</li>
</xsl:for-each>
そしてそれは私に与えるでしょう
1.time
1.Vector
では、この position() 関数を使用して目標を達成するにはどうすればよいでしょうか? または、XSLT でこれを行うための他のより良い方法はありますか? よろしくお願いします。