我有这个xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<product name="civil">
<day>Moonday</day>
<dataseries>
<data timepoint="3h"> 03:00 </data>
<data timepoint="6h"> 06:00 </data>
<data timepoint="9h"> 09:00 </data>
<data timepoint="12h"> 12:00 </data>
<data timepoint="15h"> 15:00 </data>
<data timepoint="18h"> 18:00 </data>
<data timepoint="21h"> 21:00 </data>
<data timepoint="24h"> 00:00 </data>
</dataseries>
如何显示交替节点?这样:3小时,9小时,15小时......有点像:
<xsl:for-each select="product/dataseries/data" timepoint="@6h">
但这段代码错了。
答案 0 :(得分:0)
尝试以下
<xsl:for-each select="product/dataseries/data[@timepoint='6h']>
在方括号中,可能还有更复杂的条件(例如使用或运算符,某些aritmetics等)来选择所需的节点。