php xml xsl问题

oofdd098 2011-02-17 11:55:46
请问php如何向xml+xsl生成的网页传参数?比如打开http://localhost/index.php?id=3,
这个index.php 代码如下:
<?php
header("Content-Type: text/html; charset=UTF-8");
$xml = new DOMDocument();
$xml->Load("a.xml");
$xsl = new DOMDocument();
$xsl->Load("a.xsl");
$xslproc = new XSLTProcessor();
$xslproc->importStylesheet($xsl);
$xslproc->transformToURI($xml, 'out.html');//用于转换成html文件
echo $xslproc->transformToXML($xml);

?>

a.xml代码如下
<?xml version="1.0" encoding="UTF-8"?>
<works>
<work name="架构" />
<work name="管理" />
<work name="业务" />
</works>

a.xsl代码如下

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="/works/work">
<xsl:value-of select="@name" /><br />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


请问如何写代码能在最后生成的out.html文件中拿到url中的参数id的值,请各位帮帮小弟,万分感谢,元宵节快乐



...全文
59 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

4,250

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧