velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stéphane MOR <>
Subject DVSL XPATH : Help Neede !
Date Mon, 12 Aug 2002 08:51:44 GMT
Hi !

I'm trying to use XPath expressions in a DVSL template.
In Maven, I have a file that looks like:

  <plugin name="foo">
    <goal id="0" name="foo:bar">
      <prerequisite name="prereq:one"/>
      <prerequisite name="prereq:two"/>
  <plugin name="prereq">
    <goal id="1" name="prereq:one"/>
    <goal id="2" name="prereq:two"/>

Ok, now what I would like to do is :

for each <goal>, I'd like to retrieve the ids of the prerequisites,
so that I have something like:
"'foo:bar' depends on '1' and '2'".

For this I need to get the node "/plugin/goal" whose name equals

What I have right now:

  #set ( $pluginName = $ )

  #foreach( $goal in $node.selectNodes("goal") )
    #foreach ( $prereq in $goal.selectNodes("prerequisite") )
      #set ( $prereqName = $prereq.attrib("name") )

      #* Here is the bloody XPath expression ... *#
      #* There IS a match for every goal, so it should return something 
every time ... *#
      #set ( $prereqGoal = $node.get("/plugin/goal[@name='$prereqName']") )
      #set ( $prereqId = $prereqGoal.attrib("id") )

      "$goal.attrib("name") depends on '$prereqId'".

I thought that this would give me:
"foo:bar depends on '1'".
"foo:bar depends on '2'".

but it didn't :(

I don't know what is wrong, and I tried MANY combinations of expressions 
& tricks, without

If someone with more experience than me with XPath / DVSL / both could 
give me some
advice, it'd be very cool !


PS: if my big, fat XSLT / XPath book continues staring at me like it 
does, it's gonna learn how to fly very soon ! :)

Do You Yahoo!? -- Une adresse gratuite et en français !
Yahoo! Mail :

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message