<report>
<report_param>
<title>库存历史事务表</title>
<unit>平方米</unit>
<date>20020611</date>
</report_param>
<report_records>
<record>
<llprod>W2308</llprod>
<lloc>1234</lloc>
<lcls>a</lcls>
<lwhs>01</lwhs>
<lloct>0001</lloct>
<lnum>200</lnum>
<ldate>20020609</ldate>
</record>
<record>
<llprod>W2307</llprod>
<lloc>4321</lloc>
<lcls>a</lcls>
<lwhs>01</lwhs>
<lloct>0001</lloct>
<lnum>100</lnum>
<ldate>20020609</ldate>
</record>
</report_records>
</report>
该文档包含了这张报表的所有有用信息,我们需要用特定的XSL样式单为其加上格式信息。XMLTransformer执行转换的代码如下:
<?php
$xslt = new XMLTransformer ("report.xsl", "report.xml");
$xslt->apply("pdfreport.xml");
?>
转换后生成的新的XML文档如下:
<?xml version="1.0" encoding="gb2312"?>
<pdfreport pagetype="a4" pagesize="25" top="20" bottom="20" left="20" right="20">
<head>
<line top="5" bottom="5" size="50%" linetype="single" show="false"/>
<text fontsize="30" fontlaguage="cn" align="center">库存历史事务表</text>
<line top="5" bottom="30" size="80%" linetype="double" show="true"/>