|
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> <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>
I want to transform this result in a XHTML table. I add the 3 following stylesheet:
<?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>
<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 <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> </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 * |
- XSLT Transformer Problem: STILL I'm Lost :( Manuel Ottaviano
- Re: XSLT Transformer Problem: STILL I'm Lost :( Askild Aaberg Olsen
- RE: XSLT Transformer Problem: STILL I'm Lost :( Jasha Joachimsthal
- Re: XSLT Transformer Problem: STILL I'm Lost ... Manuel Ottaviano
