Jump to content



Recommended Posts

I have an XML file that uses two different XSLs. How can I get these two documents into a HTML document* and works across all browsers?Can someone please help and give a full code of the HTML file...just keep the names simple too (example: data.xml; one.xsl; two.xsl).Thanks,Kevin*PHP format would also be helpful (if that's easier)

Link to comment
Share on other sites

Well, you could do the processing in PHP and include the result in the HTML. Let's say this is the HTML with the PHP include:

<html><head>...</head><body>...<?php include("XSLT1Processor.php"); ?><?php include("XSLT2Processor.php"); ?>...</body></html>

Where the XSLT#Processor.php files contain something like:

<?php$xml = new DomDocument;$xml->load('data.xml');$xsl = new DomDocument;$xsl->load('one.xsl');$xslt = new Xsltprocessor;$xslt->importStylesheet($xsl);$transformation = $xslt->transformToXml($xml);echo $transformation;?>

Note: The XSLT extension MUST be enabled on PHP for this to work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...