Hello Cocoon World I contact you again because I'm desperate....

I've a match process inside a pipeline that receives XML data from a Web Service , it merges with other translated data.

After this process the results is :


<?xml version="1.0" encoding="ISO-8859-1"?>
<page xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<meta-data>Castelano</meta-data>
   &lt;data&gt;
	&lt;product&gt;Hearth Failure Management&lt;/product&gt;
	&lt;error_code&gt;200&lt;/error_code&gt;
	&lt;command&gt;List of Patient&lt;/command&gt;
	&lt;rows&gt;
		&lt;row&gt;
			&lt;status&gt;Alert!&lt;/status&gt;
			&lt;surname&gt;Rodriguez&lt;/surname&gt;
			&lt;name&gt;Manuel&lt;/name&gt;
			&lt;chn&gt;1234556789&lt;/chn&gt;
			&lt;age&gt;60&lt;/age&gt;
			&lt;gender&gt;F&lt;/gender&gt;
			&lt;lastSeen&gt;lastSeen&lt;/lastSeen&gt;
			&lt;patientID&gt;1563&lt;/patientID&gt;
		&lt;/row&gt;
	&lt;/rows&gt;
&lt;/data&gt;
</page>
I want to transform this result in a XHTML table.
I add the 3 following stylesheet:
  • tagger.xsl that transform < > html codes in  ><
  • nonamespace.xsl  that removes namespaces
This is the partial result :

<?xml version="1.0" encoding="ISO-8859-1"?>
<page>
<meta-data>Castelano</meta-data>
   <data>
	<product>Hearth Failure Management</product>
	<error_code>200</error_code>
	<command>List of Patient</command>
	<rows>
		<row>
			<status>Alert!</status>
			<surname>Rodriguez</surname>
			<name>Manuel</name>
			<chn>1234556789</chn>
			<age>60</age>
			<gender>F</gender>
			<lastSeen>lastSeen</lastSeen>
			<patientID>1563</patientID>
		</row>

	</rows>
</data>

</page>
  • table.xsl is the styleshhet to format the table. I use this code:
<xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
  <xsl:template match="page">
  <html>  <body>       <xsl:apply-templates/>  </body></html>
  </xsl:template>
 <xsl:template match="rows">
    <table border="1">    <tbody>   <tr>  <th></th>  </tr>   </tbody>
     <xsl:apply-templates/>
             </table>
      </xsl:template>
   <xsl:template match="row">
    <tr><xsl:apply-templates/></tr>
      </xsl:template>
 <xsl:template match="status">
    <td>     <xsl:apply-templates/>       </td>
      </xsl:template>
 <xsl:template match="status">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
       <xsl:template match="surname">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
       <xsl:template match="name">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
           <xsl:template match="chn">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
           <xsl:template match="age">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
           <xsl:template match="gender">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
           <xsl:template match="lastSeen">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
           <xsl:template match="patientID">
    <td>      <xsl:apply-templates/>       </td>
      </xsl:template>
</xsl:stylesheet>

But this is the result:
  <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><body>
Castelano
   &lt;data&gt;
	&lt;product&gt;Hearth Failure Management&lt;/product&gt;
	&lt;error_code&gt;200&lt;/error_code&gt;
	&lt;command&gt;List of Patient&lt;/command&gt;
	&lt;rows&gt;
		&lt;row&gt;
			&lt;status&gt;Alert!&lt;/status&gt;
			&lt;surname&gt;Rodriguez&lt;/surname&gt;
			&lt;name&gt;Manuel&lt;/name&gt;
			&lt;chn&gt;1234556789&lt;/chn&gt;
			&lt;age&gt;60&lt;/age&gt;
			&lt;gender&gt;F&lt;/gender&gt;
			&lt;lastSeen&gt;lastSeen&lt;/lastSeen&gt;
			&lt;patientID&gt;1563&lt;/patientID&gt;
		&lt;/row&gt;
		

	&lt;/rows&gt;
&lt;/data&gt;

</body></html>

 
The table.xsl transformer does not works and also it converts tag in html code .... :(
But if I save the partial result [see the  XML shown before table.xsl code] in a file and I apply the table.xsl styleshett it works correctly. I also test this feature inside a match process of Cocoon's pipeline and it works fine... [
http://idle.lst.tfo.upm.es:8080/cocoon/hfm/prova ]
This is the the code of the pipeline:

 <map:match pattern="result">
      <map:generate type="jx"  src=""/>
                <map:transform type="i18n">
                <map:parameter name="default-catalogue-id" value="messages"  location="translations"/>
            <map:parameter name="locale" value="{../locale}"/>
          </map:transform>
        <map:transform src=""/>   
            <map:transform src=""/>  
                <map:transform src=""/> 
            <map:serialize type="xhtml"/>
   </map:match> 

and if you want to see the results:

http://idle.lst.tfo.upm.es:8080/cocoon/hfm/product?data="">

And this is very strange:

http://idle.lst.tfo.upm.es:8080/cocoon/hfm/prova   is a process that use the partial XML as static file and apply the table.xsl transformer..... this work!!!

Why it does not work in my process.....????


THANKS VERY MUCH


manuel ottaviano
*









Reply via email to