Junior Member
requset for answer
1. how to integrated php to xml.
2. how to use in xsl,css in php.
Junior Member
Re: requset for answer
You can use css as below in php.
echo ' ';
OR
echo '';
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
Re: requset for answer
Please find the details here.
Junior Member
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules