cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathaniel Alfred" <Alfred.Nathan...@swx.com>
Subject RE: Custom Logic Sheet, xsp:expr, etc.
Date Sun, 13 Jul 2003 10:36:21 GMT
Try to use:

  <gvs-tag:value>
    <esql:get-string>
      <xsp:attribute
name="column"><xsp:expr>alias</xsp:expr></xsp:attribute>
    </esql:get-string>
  </gvs-tag:value>

I'm not sure that will work, as it is all a subtle question of the order
the
different logicsheets are applied.  

As alternative thought, how about doing the alias assignment in your
SQL?

   select foo,alias=bar from ...

HTH, Alfred.

> -----Original Message-----
> From: Chintalapaty, Sreedhar [mailto:schintalapaty@ptc.com]
> Sent: Freitag, 11. Juli 2003 20:59
> To: users@cocoon.apache.org
> Subject: Custom Logic Sheet, xsp:expr, etc.
> 
> 
> Hi,
> 
> In my logic sheet, I have the need to pass a java variable 
> into an XSL variable. For instance:
> 
> 1.  <esql:results>
> 2.     <esql:row-results>
> 3.        <trans>
> 4.           <gvs-tag:row-id><esql:get-row-position/></gvs-tag:row-id>
> 5. 	       <xsp:logic>
> 6.              HashMap pAttributes = getItFromSomeWhere();
> 7.              String alias = (String) pAttributes.get("alias");
> 
> 8.  		    <xsl:variable 
> name="alias"><xsp:expr>String.valueOf(alias)</xsp:expr></xsl:variable>
> 9. 		    <gvs-tag:attribute>
> 10.		       
> <gvs-tag:value><esql:get-string><xsl:attribute 
> name="column"><xsl:value-of 
> select="$alias"/></xsl:attribute></esql:get-string></gvs-tag:value>
> 11.		    </gvs-tag:attribute>
> 12.	       </xsp:logic>
> 13.	    </trans>
> 14.    </esql:row-results>
> 15.  </esql:results>
> 
> 	
> 
> GENERATED VERSION:
> The Cocoon generated code for lines  9 - 10 is as follows:
> 	XSPObjectHelper.xspExpr (contentHandler, 
> 		EsqlHelper.getAscii(_esql_query.getResultSet(),
> 		"String.valueOf(alias)",
> 		"")
>     	);
> 
> The problem is the quotes around String.valueOf(alias). When 
> I run this, the query is run successfully, but the 
> esql:get-string (lines 9-11) fails with the exception "Error 
> getting ascii data for column String.valueOf(alias)". 
> 
> Obviously, it's trying to get the value of a column named 
> "String.valueOf(alias)".
> 
> MODIFIED VERSION:
> If I modify the generated code to
> 	XSPObjectHelper.xspExpr (contentHandler, 
> 		EsqlHelper.getAscii(_esql_query.getResultSet(),
> 		String.valueOf(alias),
> 		"")
>     	);
> by removing the quotes around String.valueOf(alias), and then 
> compile the modified java source, it runs fine, getting me 
> what I expect it to return.
> 
> The problem with this is that I have to modify the java 
> source by hand every time I change the logic sheet. While 
> this can be done in the short term, it is really not 
> practical over the long term. So the question is: How can I 
> write the logic scheet such that it will generate code that 
> looks like the modified version above? 
> 
> Thanks for your help,
> 
> Sreedhar
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please notify the sender urgently
and then immediately delete the message and any copies of it from your
system. Please also immediately destroy any hardcopies of the message.
You must not, directly or indirectly, use, disclose, distribute, print,
or copy any part of this message if you are not the intended recipient.
The sender's company reserves the right to monitor all e-mail
communications through their networks. Any views expressed in this
message are those of the individual sender, except where the message
states otherwise and the sender is authorised to state them to be the
views of the sender's company. 



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


Mime
View raw message