Try not using - in your variable name. In JSTL and Jexl this is treated as a
subtraction. Underscores, mixedCase or dots are fine though.
Also Xpath expressions can be relative to the parent forEach tag. One last
tip is you can use the XPath string() function to turn any node you find
into its XPath string representation (e.g. to get the String value of an
Attribute or Element).
So it can be simplified a bit to this...
<goal name="copy-jars">
<x:parse var="pluginXml" xml="file:./plugin.xml"/>
<echo message="${pluginXml}"/>
<x:forEach select="$pluginXml/plugin/requires/import">
<x:set var="pluginValue" select="string(@plugin)"/>
<echo message="Plugin is ${pluginValue}"/>
</x:forEach>
</goal>
James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "J. Matthew Pryor" <[EMAIL PROTECTED]>
To: "'Turbine Maven Users List'" <[EMAIL PROTECTED]>
Sent: Friday, September 20, 2002 6:10 AM
Subject: [OT] Jelly scripting question about getting XML attribute values
> Sorry for posting this here, but I have searched all other places I
> could find
>
> If I have an XML snippet like this :
> <plugin>
> <requires>
> <import plugin="com.ibm.etools.commonedit"/>
> <import plugin="com.ibm.etools.ejbdeploy"/>
> </requires>
> </plugin>
>
> I am trying the following to (for now) print out a list with the value
> of each plugin attribute of each import element, but I get an empty
> string
>
> <goal name="copy-jars">
> <x:parse var="plugin-xml" xml="file:./plugin.xml"/>
> <echo message="${plugin-xml}"/>
> <x:forEach select="$plugin-xml/plugin/requires/import"
> var="import">
> <x:set var="plugin" select="$import/@plugin"/>
> <j:set var="plugin-value" value="${plugin.getValue()}"/>
> <echo message="Plugin is ${plugin-value}"/>
> </x:forEach>
> </goal>
>
> Please excuse the Jelly newbieness, but can anyone help me out ?
>
> Thanks,
> Matthew
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>