我一直在阅读 Muenchian 方法,但我只是不了解如何生成我需要的 html 格式的分组。
这是源xml。
<?xml version="1.0" encoding="UTF-8"?>
<env>
<paramCount>4</paramCount>
<param parameter="id" value="1371"/>
<param parameter="xform" value="none"/>
<param parameter="user" value="Administrator"/>
<param parameter="time-stamp" value="Jun 5, 2012 2:29:45 PM"/>
<sql name="Matrix Demo" qid="1371">
<row num="1">
<col meta="MATRIX.X_TITLE" grp="0" label="X" type="12" name="X">1-Sample Topic</col>
<col meta="MATRIX.X_ID" grp="0" label="X_ID" type="2" name="X_ID">3838</col>
<col meta="MATRIX.Y_TITLE" grp="0" label="Y" type="12" name="Y">DC</col>
<col meta="MATRIX.Y_ID" grp="0" label="Y_ID" type="2" name="Y_ID">4909</col>
<col meta="MATRIX.PRIORITY" grp="0" label="Priority" type="2" name="Priority">1740</col>
</row>
<row num="2">
<col meta="MATRIX.X_TITLE" grp="0" label="X" type="12" name="X">1-Sample Topic</col>
<col meta="MATRIX.X_ID" grp="0" label="X_ID" type="2" name="X_ID">3838</col>
<col meta="MATRIX.Y_TITLE" grp="0" label="Y" type="12" name="Y">Maryland</col>
<col meta="MATRIX.Y_ID" grp="0" label="Y_ID" type="2" name="Y_ID">4910</col>
<col meta="MATRIX.PRIORITY" grp="0" label="Priority" type="2" name="Priority">1740</col>
</row>
<row num="3">
<col meta="MATRIX.X_TITLE" grp="0" label="X" type="12" name="X">1-Sample Topic</col>
<col meta="MATRIX.X_ID" grp="0" label="X_ID" type="2" name="X_ID">3838</col>
<col meta="MATRIX.Y_TITLE" grp="0" label="Y" type="12" name="Y">Virginia</col>
<col meta="MATRIX.Y_ID" grp="0" label="Y_ID" type="2" name="Y_ID">4908</col>
<col meta="MATRIX.PRIORITY" grp="0" label="Priority" type="2" name="Priority">1740</col>
</row>
<row num="4">
<col meta="MATRIX.X_TITLE" grp="0" label="X" type="12" name="X">2-Sample Topic</col>
<col meta="MATRIX.X_ID" grp="0" label="X_ID" type="2" name="X_ID">4901</col>
<col meta="MATRIX.Y_TITLE" grp="0" label="Y" type="12" name="Y">DC</col>
<col meta="MATRIX.Y_ID" grp="0" label="Y_ID" type="2" name="Y_ID">4909</col>
<col meta="MATRIX.PRIORITY" grp="0" label="Priority" type="2" name="Priority">1741</col>
</row>
<row num="5">
<col meta="MATRIX.X_TITLE" grp="0" label="X" type="12" name="X">2-Sample Topic</col>
<col meta="MATRIX.X_ID" grp="0" label="X_ID" type="2" name="X_ID">4901</col>
<col meta="MATRIX.Y_TITLE" grp="0" label="Y" type="12" name="Y">Maryland</col>
<col meta="MATRIX.Y_ID" grp="0" label="Y_ID" type="2" name="Y_ID">4910</col>
<col meta="MATRIX.PRIORITY" grp="0" label="Priority" type="2" name="Priority">1741</col>
</row>
<row num="6">
<col meta="MATRIX.X_TITLE" grp="0" label="X" type="12" name="X">2-Sample Topic</col>
<col meta="MATRIX.X_ID" grp="0" label="X_ID" type="2" name="X_ID">4901</col>
<col meta="MATRIX.Y_TITLE" grp="0" label="Y" type="12" name="Y">Virginia</col>
<col meta="MATRIX.Y_ID" grp="0" label="Y_ID" type="2" name="Y_ID">4908</col>
<col meta="MATRIX.PRIORITY" grp="0" label="Priority" type="2" name="Priority">1741</col>
</row>
...
</sql>
</env>
这就是我想要达到的目标。
<html>
<body>
<table border="1" width="500px">
<thead>
<tr>
<th> </th>
<th>1-Sample Topic</th>
<th>2-Sample Topic</th>
<th>3-Sample Topic</th>
</tr>
</thead>
<tbody>
<tr>
<td>DC</td>
<td>1740</td>
<td>1741</td>
<td>1742</td>
</tr>
<tr>
<td>Maryland</td>
<td>1740</td>
<td>1741</td>
<td>1742</td>
</tr>
<tr>
<td>Virginia</td>
<td>1740</td>
<td>1741</td>
<td>1742</td>
</tr>
</tbody>
</table>
</body>
</html>
我还没有真正接近获得我需要的输出。我确实从http://www.jenitennison.com/xslt/grouping/muenchian.html得到了这个例子,但没有比这更进一步。
我可以控制 col 部分中输出的数据,但我无法更改整体树。任何帮助将不胜感激。