Re: XML / XSLT parsing using PHP

From: Date: Thu, 24 Jan 2002 18:15:51 +0000
Subject: Re: XML / XSLT parsing using PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-81927@lists.php.net to get a copy of this message
"Lasse Laursen" <laursen@netgroup.dk> wrote in message news:02c301c1a4c4$42e03620$1ac629c3@oxygen.net... > Hi, > > We are about to develop a CMS that uses XML and XSLT. > > The XML files contains some static information (header, footers and common > non-dynamic information). We would like to have a XML file that would > contain a field like: > > <MENU> > <...> > <...> > <...> > <MENU/> > > Before the XML file is loaded into the PHP script that uses the xslt_process > routine to convert the XML/XSLT files into plain HTML we would like to > replace the <MENU> field with come dynamic content (eg. some other > variables, etc.) > > What's the easiest way to do that? SAX or? > Load the XML into a variable, do whatever changes to it, then process the variable with xslt_process. > Furthermore the 'xslt_process' function requires the following parameters: > > xslt_process (resource xh, string xml, string xsl [, string result [, array > arguments [, array parameters]]]) > > where the XML and XSLT variables are references to files. - The XML file is > in our example a variable (eg. $current_xml_file = "xxxxx";) and therefor we > cannot use the xslt_process function? Of cause we can store the XML var. in > a temporary location and then read the file, but that's an extreamly ugly > approach! :) Any ideas? > Have a look at: http://www.php.net/manual/en/function.xslt-process.php Example 3 Using the xslt_process() to transform a variable containing XML data and a variable containing XSL data into a variable containing the resulting XML data > I'm looking forward to your replies :) > > > Yours > -- > Lasse Laursen <laursen@netgroup.dk> - Systems Developer > NetGroup A/S, St. Kongensgade 40H, DK-1264 København K, Denmark > Phone: +45 3370 1526 - Fax: +45 3313 0066 - Web: www.netgroup.dk Peter Clarke

« previous php.general (#81927) next »