Use PHP to analyze XSLT to HTML with XSLT

xiaoxiao2021-03-06  67

/ ** * Convert XML file to HTML content according to XSL files * @Param string $ xslfile - xsl file * @Param string $ xmlfile - XML ​​file * Need to load related DLLs, such as: iconv, xslt, etc. * /

FUNCTION

Getxmlhtml

(

$ xslfile

=

False

,

$ xmlfile

=

False

) {

$ xslstring

=

Implode

(

'' '

,

File

(

$ xslfile

));

$ xmlstring

=

Implode

(

'' '

,

File

(

$ xmlfile

));

$ arguments

= array

'/ _xml'

=>

$ xmlstring

,

'/ _xsl'

=>

$ xslstring

);

$ xh

=

XSLT_CREATE

();

$ RESULT

=

XSLT_PROCESS

(

$ xh

,

'arg: / _ xml'

,

'arg: / _ xsl'

,

NULL

,

$ arguments

); If

$ RESULT

) {RETURN

$ RESULT

;

XSLT_Free

(

$ xh

} Else {return

"ERR"

;

XSLT_Free

(

$ xh

}}

// end function getXmlhtml ()

转载请注明原文地址:https://www.9cbs.com/read-110331.html

New Post(0)