D
Davide Benini
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">
<xslutput 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
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">
<xslutput 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