1
对于XSL(以及对于这个问题的XML)来说很新颖,但是我需要通过一个XML来逐步打印所需的选择,数据。我遇到的问题是一个选择(时间)与其他节点不同7.我还不知道我需要做什么,以获得所需的输出。这是我的数据和样式表,如果有人不介意帮助我:XSL帮助从单个行上的多个节点打印变量
XSL样式表
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Storage IO</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Time</th>
<th>Reads per Second</th>
<th>Writes per Second</th>
<th>KB Read per Second</th>
<th>KB Written per Second</th>
<th>Read Cache Hit %</th>
<th>Write Cache Hit %</th>
<th>Sequential Read %</th>
<th>Write Pending Tracks</th>
</tr>
<xsl:for-each select="/SymCLI_ML/Statistics/Request_Totals">
<tr>
<td><xsl:value-of select="time"/></td>
<td><xsl:value-of select="r_per_second"/></td>
<td><xsl:value-of select="w_per_second"/></td>
<td><xsl:value-of select="kb_r_per_second"/></td>
<td><xsl:value-of select="kb_w_per_second"/></td>
<td><xsl:value-of select="r_cache_hit_pct"/></td>
<td><xsl:value-of select="w_cache_hit_pct"/></td>
<td><xsl:value-of select="sequential_r_pct"/></td>
<td><xsl:value-of select="wp_tracks"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XML文件
<?xml version="1.0" standalone="yes" ?>
<?xml-stylesheet type="text/xsl" href="totals.xsl"?>
<SymCLI_ML>
<Statistics>
<time>Mon Mar 19 2012 15:24:53</time>
</Statistics>
<Statistics>
<time>Mon Mar 19 2012 15:25:04</time>
<Request>
<dev_name>0052</dev_name>
<pd_name>Not Visible</pd_name>
<r_per_second>0</r_per_second>
<w_per_second>0</w_per_second>
<kb_r_per_second>0</kb_r_per_second>
<kb_w_per_second>0</kb_w_per_second>
<r_cache_hit_pct>N/A</r_cache_hit_pct>
<w_cache_hit_pct>N/A</w_cache_hit_pct>
<sequential_r_pct>N/A</sequential_r_pct>
<wp_tracks>0</wp_tracks>
</Request>
<Request>
<dev_name>1AAF</dev_name>
<pd_name>Not Visible</pd_name>
<r_per_second>0</r_per_second>
<w_per_second>0</w_per_second>
<kb_r_per_second>0</kb_r_per_second>
<kb_w_per_second>0</kb_w_per_second>
<r_cache_hit_pct>N/A</r_cache_hit_pct>
<w_cache_hit_pct>N/A</w_cache_hit_pct>
<sequential_r_pct>N/A</sequential_r_pct>
<wp_tracks>0</wp_tracks>
</Request>
<Request>
<dev_name>1B2F</dev_name>
<pd_name>Not Visible</pd_name>
<r_per_second>0</r_per_second>
<w_per_second>0</w_per_second>
<kb_r_per_second>0</kb_r_per_second>
<kb_w_per_second>0</kb_w_per_second>
<r_cache_hit_pct>N/A</r_cache_hit_pct>
<w_cache_hit_pct>N/A</w_cache_hit_pct>
<sequential_r_pct>N/A</sequential_r_pct>
<wp_tracks>0</wp_tracks>
</Request>
<Request_Totals>
<r_per_second>1032</r_per_second>
<w_per_second>1309</w_per_second>
<kb_r_per_second>28003</kb_r_per_second>
<kb_w_per_second>19347</kb_w_per_second>
<r_cache_hit_pct>74</r_cache_hit_pct>
<w_cache_hit_pct>99</w_cache_hit_pct>
<sequential_r_pct>6</sequential_r_pct>
<wp_tracks>9994</wp_tracks>
</Request_Totals>
</Statistics>
</SymCLI_ML>
非常感谢你,我真的很感激它,解决了我的问题,并帮助我更好地理解它是如何工作的。还有很多要学习,但感谢您的帮助。 – desimus0019 2012-03-20 18:47:24
@ desimus0019 - 你非常欢迎。 – 2012-03-20 19:10:59