Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

XSLTProcessor->importStylesheet()

(no version information, might be only in CVS)

XSLTProcessor->importStylesheet() -- Import stylesheet

Описание

class XSLTProcessor {

void importStylesheet ( DOMDocument stylesheet )

}

This method import the stylesheet into the XSLTProcessor for transformations.

Список параметров

stylesheet

The imported style sheet as a DOMDocument object.

Возвращаемые значения

Эта функция не возвращает значения после выполнения.



add a note add a note User Contributed Notes
XSLTProcessor->importStylesheet()
fcartegnie
21-Jul-2007 06:11
PHP5 xsl processor has a different behaviour than PHP4's one with CDATA sections. (see http://bugs.php.net/bug.php?id=29837)
Loaded XSL sheet CDATA sections does not allow, by default, output-escaping handling (everything in the CDATA is escaped by default).

So in this case you can't build your XSL Dom the usual way:
    $xsldom = DomDocument::loadXML(file_get_contents('sheet.xsl'));

and must go through this one (allowing LIBXML_NOCDATA parameter):
    $xsldom = new DomDocument;
    $xsldom->load('sheet.xsl', LIBXML_NOCDATA);

Then the CDATA output-escaping behaviour will be correct.
diesel at spbnet dot ru
19-Mar-2007 10:07
This is not a problem. You may set DOMDocument's documentURI property.
Something like this
$xsl = new DOMDocument('1.0','UTF-8');
    
$xsl->loadXML(file_get_contents('/foo/bar/somefile.xsl');
$xsl->documentURI = '/foo/bar/somefile.xsl';

$xslProc = new XSLTProcessor();
$xslProc->importStylesheet($xsl);

and document('other.xsl') will work fine!
bbrosseau at gmail
01-Mar-2005 08:46
For those who wants to use external documents, it is important not to use the DomDocument::loadXML because the processor will not have the path to look for other files
 
So if you want to transform some xml with a pre-generated stylesheet $f:

$f = 'somestylesheet.xsl';

  $xsl = DomDocument::loadXML(file_get_contents($f));

document('other.xml') will not work with relative path and

  $xsl = DomDocument::load($f);   
   
will!

 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571