xml-xsp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josep Riudavets" <jriudave...@uoc.edu>
Subject Obtain XML from XSP
Date Mon, 01 Sep 2003 10:28:23 GMT
Hi. 

I'm trying to obtain the XML file that produces an XSP page, before pass it through XSL stylesheet.
For example: procesa.xsp is an XML file whit XSP directives. My server is running under cocoon.
When procesa.xsp is required, cocoon executes the XSP code inside it, and creates an XML structure.
This XML structure is passed througth an XSL file, and finally it is obtained the HTML file.


I want to capture in a file the XML resulted of the execution of the XSP code inside XML initial
file. 

procesa.xsp
<?xml version="1.0" encoding="UTF-8"?>

<?cocoon-process type="xsp"?>

<?cocoon-process type="xslt"?>

<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:esql="http://apache.org/cocoon/SQL/v2">

<procesa>

<xsp:logic>

String nom = request.getParameter("nom");

String cognoms = <xsp-request:get-parameter name="cognoms"/>;

String dni = <xsp-request:get-parameter name="dni"/>;

String objecte = <xsp-request:get-parameter name="objecte"/>;

String validador = <xsp-request:get-parameter name="validador"/>;


<xsp:content>

<titulo>Certificat academic</titulo>

<esql:connection>

<esql:pool>conexionBBDD</esql:pool>

<esql:execute-query>

<esql:query>SELECT exped FROM expedients WHERE nom='<xsp:expr>nom</xsp:expr>'
AND cognoms='<xsp:expr>cognoms</xsp:expr>' AND dni='<xsp:expr>dni</xsp:expr>';

</esql:query>

<esql:results>


<esql:row-results>


<nom><xsp:expr>nom</xsp:expr></nom>

<cognoms><xsp:expr>cognoms</xsp:expr></cognoms>

<dni><xsp:expr>dni</xsp:expr></dni>

<exped><esql:get-string column="exped"/></exped>

<objecte><xsp:expr>objecte</xsp:expr></objecte>

<validador><xsp:expr>validador</xsp:expr></validador>

</esql:row-results>


</esql:results>

</esql:execute-query>

</esql:connection>

</xsp:content>



</xsp:logic>

</procesa>

</xsp:page>



procesa.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="procesa">
<html>
<head>
<title>
<xsl:value-of select="titulo" />
</title>
</head>
<body bgcolor="#ffffff">
<xsl:value-of select="nom"/>  <xsl:value-of select="cognoms"/><br/>
<xsl:value-of select="dni"/><br/>

El teu <b><xsl:value-of select="objecte"/></b> s'enviarà al teu mail automàticament<br/>
El validador autoritzat és: <b><xsl:value-of select="validador"/></b><br/>
Expedient academic: <b><xsl:value-of select="exped"/></b><br/>

<br/>
<br/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


Mime
View raw message