Xslt 如何获取当前节点的父节点名称?
获取当前节点的父节点名称的正确语法是什么?我知道这是关于AxisName父级的,但正确的语法是什么? 例如,下面的xmlXslt 如何获取当前节点的父节点名称?,xslt,xpath,netcdf,ncml,Xslt,Xpath,Netcdf,Ncml,获取当前节点的父节点名称的正确语法是什么?我知道这是关于AxisName父级的,但正确的语法是什么? 例如,下面的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 nam
<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>
对于元素变量,我应该得到netcdf或group。提前感谢。姓名(家长::*)
应该这样做。显然,只有一位家长。使用:
name(..)
。
缩写是parent::node()
的缩写
请注意:并非每个家长都有自己的名字。例如,文档节点(
/
)是文档顶部元素(/*
)的父节点,并且没有名称。在我的案例中,使用该节点作为检索父节点名称会导致驱动器输出内存错误,而使用name(父节点::*)@carloscoom,这只表明您使用的特定XPath实现存在缺陷。如果您能提供一个XML文档(最好是很短的)和精确的XPath表达式,那将非常有趣。