1. how to integrated php to xml.
2. how to use in xsl,css in php.
Printable View
1. how to integrated php to xml.
2. how to use in xsl,css in php.
You can use [B][U]css [/U][/B]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 [B][U]xsl[/U][/B], you can use Saxon XSLT Processor as below:
1. Install the JavaBridge for PHP
2. Download the freeware (B) Saxon distribution from [url]http://saxon.sourceforge.net/[/url]
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
Please find the details [URL="http://www.google.com/search?source=ig&hl=en&rlz=&q=integrate+php+to+xml"]here.[/URL]
<?php
<applet> hi i me</applet>
?>