Prepare for your Next Interview
This is a discussion on requset for answer within the PHP forums, part of the Web Development category; 1. how to integrated php to xml. 2. how to use in xsl,css in php....
|
|||
|
Re: requset for answer
You can use css as below in php.
echo '<head><link rel="css.css" type="text/css"></head>'; OR echo '<head><style type="text/css">' . include('css.css') . '</style></head>'; For using xsl, you can use Saxon XSLT Processor as below: 1. Install the JavaBridge for PHP 2. Download the freeware (B) Saxon distribution from http://saxon.sourceforge.net/ 3. Put the jar files in a directory whre you have access 4. Use this sample of code // Directory where the jar files are located define("SAXON_DIR", $_SERVER['DOCUMENT_ROOT']."/saxonb8.9.0/"); // include the jars java_require(SAXON_DIR."saxon8.jar;".SAXON_DIR."saxon8-dom.jar"); $sXslFile = $_SERVER['DOCUMENT_ROOT']."/myfirst.xsl"; // The xsl file $sXmlFile = $_SERVER['DOCUMENT_ROOT']."/myfirst.xml"; // The xml file try { $oXslSource = new java("javax.xml.transform.stream.StreamSource", "file://".$sXslFile); $oXmlSource = new java("javax.xml.transform.stream.StreamSource", "file://".$sXmlFile); $oFeatureKeys = new JavaClass("net.sf.saxon.FeatureKeys"); // Create the Factory $oTransformerFactory = new java("net.sf.saxon.TransformerFactoryImpl"); //Disable source document validation $oTransformerFactory->setAttribute($oFeatureKeys->SCHEMA_VALIDATION, 4); // Create a new Transformer $oTransFormer = $oTransformerFactory->newTransformer($oXslSource); // Create a StreamResult to store the output $oResultStringWriter = new java("java.io.StringWriter"); $oResultStream = new java("javax.xml.transform.stream.StreamResult", $oResultStringWriter); // Transform $oTransFormer->transform($oXmlSource, $oResultStream); // Echo the output from the transformation echo java_cast($oResultStringWriter->toString(), "string"); } catch(JavaException $e){ echo java_cast($e->getCause()->toString(), "string"); exit; } 5. Enjoy |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What will be the answer | kanchhana | MainFrame | 0 | 06-25-2007 05:01 AM |
| can i get answer for this | gujjar | Oracle Certification | 12 | 02-26-2007 07:52 AM |
| can i get answer for this | gujjar | Oracle Certification | 6 | 02-23-2007 07:17 AM |
| what is the answer ? | psuresh1982 | Brainteasers | 3 | 01-12-2007 02:02 AM |
| Think and Answer | fred | Brainteasers | 1 | 08-08-2006 03:22 PM |