PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<XSLTProcessor->setParameter()XSLTProcessor->transformToURI()>
Last updated: Mon, 16 Jul 2012

XSLTProcessor->transformToDoc()

(no version information, might be only in CVS)

XSLTProcessor->transformToDoc() -- Transform to a DOMDocument

说明

class XSLTProcessor {

DOMDocument transformToDoc ( DOMNode doc )

}

Transforms the source node to a DOMDocument applying the stylesheet given by the XSLTProcessor->importStylesheet() method.

参数

doc

The node to be transformed.

返回值

The resulting DOMDocument or FALSE on error.

例子 1. Transforming to a DOMDocument

<?php

// Load the XML source
$xml = new DOMDocument;
$xml->load('collection.xml');

$xsl = new DOMDocument;
$xsl->load('collection.xsl');

// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules

echo trim($proc->transformToDoc($xml)->firstChild->wholeText);

?>

上例将输出:

Hey! Welcome to Nicolas Eliaszewicz's sweet CD collection!




<XSLTProcessor->setParameter()XSLTProcessor->transformToURI()>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST