commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Vinson <vinson.li...@charter.net>
Subject Re: [JELLY] Using an attribute's value selected using xpath expression as variable
Date Mon, 28 Nov 2005 03:40:01 GMT
Hi Benoit,

You'll want to use the single attribute on your jelly:xml tags in order to pull a single node
value.  Otherwise,
+you'll get back a List of nodes (even if there is only one).  Try this:

<x:set select="@name" var="name" single="true"/>

Hope This Helps,
Jason

On Sun, Nov 27, 2005 at 03:22:29PM +0100, benoit.callebaut@euphonynet.be wrote:
> Hello,
> I want to output the result of the processing of a stylesheet to a file
> based on the value of an attribute.
> I retrieve the value of the attribute using an "<x:set..." from the XML
> tag library and  I use it later.
> Insteadof giving me the value of the attribute as a string, It returns an
> object (DefaultAttribute).
> If I try to get the value of that object using "${name.getValue()}", the
> result is an empty string
> 
> How can I do it ?
> 
> The code sample is :
> <x:forEach select="xsd:complexType">
> 	    <x:set select="@name" var="name"/>
>             package test;
>                 <x:expr select="@name" />
> 		getName() result: <j:expr value="${name}"/>
> 		<j:expr value="${name.getValue()}"/>
> <j:file name="${name}.java">
> ...
> 
> The name of the created file is something like :
> [org.dom4j.tree.DefaultAttribute@143c8b3 [Attribute: name name value
> "empty"]]
> 
> Thanks
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message