Hello Cocoon World, thanks for the suggestion but I'm still lost....
:(
I've modified my stylesheet as suggest Ard.
I've declared a pipeline process using the same XML output of my
pipeline using the stylesheet and this works :)
but in my dynamic pipeline process it does not work......
I've delete all the XML namespace using a trasformer suggested in
http://www.planetcocoon.com/node/2425 that removes all namespaces.
So, inside the pipeline there are decleare 2 process:
Test proces:
<map:match pattern="prova">
<map:generate src=""/>
<map:transform src=""/>
<map:transform src=""/>
<map:serialize type="xml"/>
</map:match>
Dynamic process
<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="xml"/>
</map:match>
I use jx XML file to merge with a Web Service XML response and it
works fine , also with i18n capabilities. I use the 'tagger' styleshet
to convert html tag symbols in "<" and ">" . The
nonamespace.xsl
is the trasformer that removes the namespaces .
The XML result for the 2 process, [by removing the prova1.xsl
stylesheet] is the same:
XML partial result before the trasformation of prova1.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<page>
<program>Castelanoxxxxxxxxx</program>
<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>
<row>
.... more data
</row>
</rows>
</data>
</page>
The 2 pipeline process generates the same XML file but the test
process shows the correct result and the dynamic does not works
properly.
The 2 resulsts [after prova1.xsl trasformation and HTMLserializer]
Test:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h2>List of Patient</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Status</th><th align="left">Surname</th>
</tr>
<tr>
<td>Alert!</td><td>Rodriguez</td>
</tr>
<tr>
<td>Alert!</td><td>Rodriguez</td>
</tr>
<tr>
<td>Alert!</td><td>Rodriguez</td>
</tr>
<tr>
<td>Alert!</td><td>Rodriguez</td>
</tr>
</table>
</body>
</html>
That is the coorect result
Dynamic
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h2>List of Patient</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Status</th><th align="left">Surname</th>
</tr>
</table>
</body>
</html>
Where are the data??
Why?? :(
Thanks very much
Manuel Ottaviano
*************************
Ard Schrijvers escribió:
Try this:
<xsl:for-each select="data/rows/row">
You're already at the /page element when you call the
for-each so it can't find a /page child.
For neatness reasons, I do agree with you that select="data/rows/row" is nicer then select="/page/data/rows/row", but why do you think that the latter wouldn't work? It has a "/" in front, you know....
Anyway, if you are precise, and want nice xsls, without starting with a "/" (which I really consider bad practice), you use apply-templates instead of for-each.
So, as Jasha stated, probably it is a namespace. rows/row typically look like an sql transformer output, so the paths
select="/page/data/sql:rows/sql:row" or
select="data/sql:rows/sql:row"
should both work (of course, add the sql namespace to your xsl).
Ard
(I don't know why it would work in XML-Spy, maybe its more lenient??)
See how you go.
Regards
Tony
Manuel Ottaviano wrote:
*Hello cocoon users , I've a problem with a trasformation
of an XML file.
This is the XML file, generated by a pipeline process:*
<page xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
<program>program</program>
<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>
<row>
...
.... [much more data....]
.....
</row>
</rows>
</data>
</page>
*I've created a test stylesheet to generate a table , like
the following:*
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/page">
<html>
<body>
<h2>List of Patient</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Status</th>
<th align="left">Surname</th>
</tr>
<xsl:for-each select="/page/data/rows/row">
<tr>
<td><xsl:value-of select="status"/></td>
<td><xsl:value-of select="surname"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
*If I test with a browser or with XML-spy I obtain a
table, but if I
insert the stylesheet inside the pipeline, as a transformer
it doesn't
work....... only can be seen the table header....
*<html>
<body>
<h2>List of Patient</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Status</th>
<th align="left">Surname</th>
</tr>
</table>
</body>
</html>*
*
*I'm a bit lost....
ANY suggestion??
thanks very much.
manuel ottaviano
*
--
This email is from Civica Pty Limited and it, together with
any attachments, is confidential to the intended recipient(s)
and the contents may be legally privileged or contain
proprietary and private information. It is intended solely
for the person to whom it is addressed. If you are not an
intended recipient, you may not review, copy or distribute
this email. If received in error, please notify the sender
and delete the message from your system immediately. Any
views or opinions expressed in this email and any files
transmitted with it are those of the author only and may
not necessarily reflect the views of Civica and do not create
any legally binding rights or obligations whatsoever. Unless
otherwise pre-agreed by exchange of hard copy documents
signed by duly authorised representatives, contracts may not
be concluded on behalf of Civica by email. Please note that
neither Civica nor the sender accepts any responsibility for
any viruses and it is your responsibility to scan the email
and the attachments (if any). All email received and sent by
Civica may be monitored to protect the business interests of
Civica.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
|