You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Fitzpatrick, Niamh (CE)" <ce...@bearingpoint.com> on 2004/04/28 16:19:22 UTC

Accessing Namespace elements in Velocity

Hi there,
 I'm new to Velocity and Anakia and am trying to access elements in an xml input file that are prefixed by namespaces, but for some reason velocity can't seem to find them.

my input xml is of the form:
<metadata>
  <description>A description</description>
  <ns:Author xmlns:ns="http://blah.blah.blah/ns">John D</ns:Author>
<metadata>

my vsl file tries the following
	<td>$xpath.applyTo("MetaData/Publishdescription", $root) </td>
	<td>$xpath.applyTo("MetaData/ns:Author", $root)  </td>

The first line works perfectly, the second doesn't. I've added the namespace definition to the top of my vsl file as well <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:ns="http://blah.blah.blah/ns> but that makes no difference:
Is there something I need to know about accesssing namespaced-elements in vsl files ?
Any help greatly appreciated,
Niamh



***************************************************************************************************
The information in this email is confidential and may be legally privileged.  Access to this email by anyone other than the intended addressee is unauthorized.  If you are not the intended recipient of this message, any review, disclosure, copying, distribution, retention, or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful.  If you are not the intended recipient, please reply to or forward a copy of this message to the sender and delete the message, any attachments, and any copies thereof from your system.
***************************************************************************************************

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