用XSLT 怎样产生较好的页面布局?
Andy 2002-06-04 10:56:27 xml文件如下:
<?xml version="1.0" encoding="GB2312"?>
<books>
<col>2</col>
<book>
<name>标题a</name>
<content>内容a</content>
</book>
<book>
<name>标题b</name>
<content>内容b</content>
</book>
<book>
<name>标题c</name>
<content>内容c</content>
</book>
</books>
在上面的文件中,<col>2</col> 表示使用xslt生成的表格有两列,每列显示一个book元素,如果col为3则要显示3列,例如:最终的html如下所示:
<table>
<tr>
<td>标题a: 内容a<td>
<td>标题b: 内容b<td>
</tr>
<tr>
<td>标题c: 内容c<td>
<td><td>
</tr>
</table>
使用xslt该如何写呢?
这只是把一个xml文件转化为一个较为简单的html文件,更进一步说,如何才能产生更好的页面布局,xslt提供的功能是不是太弱了。