cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: XSLT table formatting problem
Date Thu, 07 Sep 2006 07:54:41 GMT

> 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: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message