看手册上的例子:  http://ca3.php.net/manual/en/function.xslt-process.php

解决方案 »

  1.   

    <?php// XML string
    $xml = '<?xml version="1.0"?>
    <para>
     change me
    </para>';// XSL string
    $xsl = '
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="ISO-8859-1" indent="no" 
     omit-xml-declaration="yes"  media-type="text/html"/>
     <xsl:param name="myvar"/>
     <xsl:param name="mynode"/>
     <xsl:template match="/">
    My PHP variable : <xsl:value-of select="$myvar"/><br />
    My node set : <xsl:value-of select="$mynode"/>
     </xsl:template>
    </xsl:stylesheet>';
    $xh = xslt_create();// the second parameter will be interpreted as a string
    $parameters = array (
      'myvar' => 'test',
      'mynode' => '<foo>bar</foo>'
    );$arguments = array (
      '/_xml' => $xml,
      '/_xsl' => $xsl
    );echo xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments, $parameters);?>
      

  2.   

    懂了,谢谢二位,刚开始没法理解arg:/_xml,哈哈!给分