Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » xml namespace parsing
xml namespace parsing [message #13380] Fri, 27 April 2007 18:16 Go to next message
Eclipse UserFriend
Originally posted by:


I am trying to parse an xml file and it looks like the Xpath is not
supported fully. Can you specify is you can have :

model file:
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f=""
< contentType="text/html;charset=UTF-8"
<ui:page binding="#{Page1.page1}" id="page1">
<ui:html binding="#{Page1.html1}" id="html1">
<ui:head binding="#{Page1.head1}" id="head1">
<ui:link binding="#{Page1.link1}" id="link1"
<ui:body binding="#{Page1.body1}" id="body1"
style="-rave-layout: grid">
<ui:form binding="#{Page1.form1}" id="form1"/>

<c:iterate select="/jsp:root/f:view/ui:page" var="curPage" >
<ws:file template="src-jet/dump.jet"
path="{$}/src-gen/test.txt " />

I am now getting :
Error: No namespace URI found for prefix "jsp"

I saw some workarounds on this issue on the newsgroups. I was thinking
this maybe a jet1 issue and the namespace has been better supported by now.

i have now :
eclipse 3.2.2
emft 0.7.2
Re: xml namespace parsing [message #13414 is a reply to message #13380] Mon, 30 April 2007 12:46 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member

You are correctly, the XPath implementation is not complete. In particular,
there is no mechanism exposed for associating namespace URIs to prefixes.
There are, however some alternatives:

1) If the namespaces jsp, f and ui do not have element names that conflict,
you can simply write your XPath expression like this:


2) If you absolutely need to select against namespaces, I suggest you do the

a) define XPath variables for the namepace URI's:

<%-- only need to do these one, in main.jet --%>
<c:setVariable var='f' select=" '' "/>
<c:setVariable var='h' select=" '' "/>
<c:setVariable var='jsp' select=" '' "/>
<c:setVariable var='ui' select=" '' "/>

b) Write you Xpath expressions like this:

/root[$jsp = namespace-uri()]/view[$f = namespace-uri()]/page[$ui =

Finally, I have created bug 184692
( ), which suggests
exposing a method of defining namespace prefixes for tag XPath expressions.

Previous Topic:Freshly Created JET2 Transformation Failure
Next Topic:passing parameters
Goto Forum:

Current Time: Tue Nov 29 22:41:29 GMT 2022

Powered by FUDForum. Page generated in 0.02743 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top