473,508 Members | 2,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Php into XML

Heelo everybody.
I am using XML and XSL to analyse a text.
Now, I am trying to integrate php into the XML code, in order to make
the XML page dynamic.
Yet the parser doesn't even read the php code embedded in the xml page.
Here is the beginning of my XML page, inf-dev.xml
-----
?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE inferno SYSTEM
"file:/Users/davidebenini/Documents/Universita%CC%80/Dottorato/inferno/inferno.dtd">
<?xml-stylesheet
type="text/xsl" href="inf-dev.xslt"?>

<inferno>
<filtro>FILTRO: <?php
echo "Filtro passsato in php";
?>-</filtro>
<canto>
<n>1</n>
<passo>
<vv>1</vv>
<dante>
<v>Nel mezzo del cammin di nostra vita</v>
</dante>
<carson>
<v>Halfway through the story of my life</v>
</carson>
<nota>
<n>Carson introduce story</n>
</nota>
</passo>
<passo>
<vv>14</vv>
<dante>
<v>là dove terminava quella valle</v>
</dante>
<carson>
<v>hill; here, thre valley formed a cul-de-sac</v>
</carson>
<nota>Carson introduce cul-de-sac, uno dei termini che
spesso associa ai vicoli di
Belfast; prima nota di colore locale</nota>
</passo>

----- and so on.

Then, this is the XSLT, inf-dev.xslt
----
?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">

<html>
<head>
<title>Inferno: comparazione</title>
<link rel="stylesheet" title="main" href="stile-inf.css"
type="text/css" />
</head>
<body>
<div id="container">
<?php
echo"Php funziona<br>";
$risultato=$_POST[keyword];
echo "Hai inviato $risultato";
?>
<h1>Inferno</h1>
<xsl:value-of select="inferno/filtro"/>
<xsl:for-each select="inferno/canto">
<div class="cant">
<h2>
Canto <xsl:value-of select="n"/>
</h2>
<xsl:for-each select="passo">


<div class="pass">
<xsl:value-of select="../n"/>, <xsl:value-of
select="vv"/>
<table border="0" width="100%">
<tr>
<td width = "50%">
<xsl:for-each select="dante/v">
<xsl:value-of select="."/>
<br/>
</xsl:for-each>
</td>

<td>
<xsl:for-each select="carson/v">
<xsl:value-of select="."/>
<br/>
</xsl:for-each>
</td>
</tr>
</table>
<div class="note">
<xsl:for-each select="nota">
- <xsl:value-of select="."/>
<br/>
</xsl:for-each>
</div>

</div>

<br/>
</xsl:for-each>

</div>
</xsl:for-each>

</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
---
As you've probably noticed, the php code is only for testing purpouses...
Yet the output doesn't show the value of <filtro>, only the string; the
php code is ignored.
Any suggestion?
Cheers,
Davide
Jul 20 '05 #1
3 1015
Davide Benini wrote:
Heelo everybody.
I am using XML and XSL to analyse a text.
Now, I am trying to integrate php into the XML code, in order to make
the XML page dynamic.
Yet the parser doesn't even read the php code embedded in the xml page.


You need to configure your system to run PHP then XSLT. For example,
if you were using Apache you could make PHP the handler and then add
mod_transform as output filter. But since you didn't say what the
system is, I can only suggest you read its manual.

--
Nick Kew
Jul 20 '05 #2
Nick Kew wrote:
Davide Benini wrote:
Heelo everybody.
I am using XML and XSL to analyse a text.
Now, I am trying to integrate php into the XML code, in order to make
the XML page dynamic.
Yet the parser doesn't even read the php code embedded in the xml page.

You need to configure your system to run PHP then XSLT. For example,
if you were using Apache you could make PHP the handler and then add
mod_transform as output filter. But since you didn't say what the
system is, I can only suggest you read its manual.

Sorry; it's a mac with OS X, so it is apache indeed.
How do I perform the operation you suggested in detail?
Cheers,
Davide
Jul 20 '05 #3
Davide Benini wrote:
Heelo everybody.
I am using XML and XSL to analyse a text.
Now, I am trying to integrate php into the XML code, in order to make
the XML page dynamic.
Yet the parser doesn't even read the php code embedded in the xml page.


That is correct. It's not supposed to -- PHP statements use Processing
Instructions which XML software is required to ignore and pass through
for later action (in this case by PHP). PHP is not an XML technology,
so an XML parser cannot do anything with it. To make XML handle it, you
have to pass it through a PHP processor first, so that the PHP material
becomes XML.

///Peter
--
sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
&;top"
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11178
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
5773
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
22957
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
8433
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
8536
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
18214
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
6776
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
31341
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
23531
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.