On 9/6/2006 7:35 PM, Tony Edwards wrote:
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.
(I don't know why it would work in XML-Spy, maybe its more lenient??)

See how you go.

Regards
Tony

Tony, "/page" does not try to select a child element. Any XPath expression starting with "/" starts from the root node. So this expression should work, regardless of what XSLT processor you use, and regardless of the context node.
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
*
That is strange... looks right to me.
I tried it in the Oxygen debugger and it produced a table with multiple rows.

I would double-check that the input to the stylesheet is really what you think it is...

Lars


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to