Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [JET] Returning a List from a custom XPath function.
[JET] Returning a List from a custom XPath function. [message #33901] Mon, 17 September 2007 13:26 Go to next message
Juan Pedro Silva is currently offline Juan Pedro SilvaFriend
Messages: 258
Registered: July 2009
Senior Member
Hi Paul, everybody.

I'm working on a second XPath function (stereotypeSearch)that returns a
list containing all elements from a model stereotyped with an stereotype
provided as an input parameter.

The XPath function works fine, and returns what it is supposed to
return. However, I can't find the way to access the elements contained
in the result List.

For example, when looking for the elements stereotyped 'message', I
tried using:

A) <c:iterate var="stereotypedElements"
select="stereotypeSearch($someElement, 'message')">

and

B) <c:setVariable select="stereotypeSearch($someElement, 'message')"
var="messages"/>
<c:iterate select="messages"...

with no satisfactory results. With A I got a message "Cannot iterate if
expression is: stereotypeSearch(...", and with B I get no results (no
iteration).

I am assuming that a List (or any kind of set) is not a valid return
type for an XPath function to be handled by JET, am I right?. Is there
any way to do this?.
Thank you in advance.

Regards,
Juan Pedro
Re: [JET] Returning a List from a custom XPath function. [message #33966 is a reply to message #33901] Wed, 19 September 2007 13:44 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Juan Pedro:

The XPath engine is looking for instances of org.eclipse.jet.xpath.NodeSet.
I have submitted a bugzilla suggesting an enhancement to the XPath engine so
that it would recognize Java collections and arrays as equivalent to
NodeSet. In the meantime, I have created a utility class that will wrap an
Java collections and arrays.

The bugzilla is: 203970
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=203970)

The utility class is attached to the bugzilla, and to this post.

Let me know if this helps.

Paul


"Juan Pedro Silva" <jpsilvagallino@gmail.com> wrote in message
news:fclva5$hlr$1@build.eclipse.org...
> Hi Paul, everybody.
>
> I'm working on a second XPath function (stereotypeSearch)that returns a
> list containing all elements from a model stereotyped with an stereotype
> provided as an input parameter.
>
> The XPath function works fine, and returns what it is supposed to
> return. However, I can't find the way to access the elements contained
> in the result List.
>
> For example, when looking for the elements stereotyped 'message', I
> tried using:
>
> A) <c:iterate var="stereotypedElements"
> select="stereotypeSearch($someElement, 'message')">
>
> and
>
> B) <c:setVariable select="stereotypeSearch($someElement, 'message')"
> var="messages"/>
> <c:iterate select="messages"...
>
> with no satisfactory results. With A I got a message "Cannot iterate if
> expression is: stereotypeSearch(...", and with B I get no results (no
> iteration).
>
> I am assuming that a List (or any kind of set) is not a valid return
> type for an XPath function to be handled by JET, am I right?. Is there
> any way to do this?.
> Thank you in advance.
>
> Regards,
> Juan Pedro


Re: [JET] Returning a List from a custom XPath function. [message #34058 is a reply to message #33966] Wed, 19 September 2007 15:08 Go to previous message
Juan Pedro Silva is currently offline Juan Pedro SilvaFriend
Messages: 258
Registered: July 2009
Senior Member
Paul, so far I've only tried a simple use of public static NodeSet
asNodeSet(Collection collection), but so far it's working fine.
I was going in that direction myself.
Thank you very much for you help.
Regards,
Juan Pedro

Paul Elder escribió:
> Juan Pedro:
>
> The XPath engine is looking for instances of org.eclipse.jet.xpath.NodeSet.
> I have submitted a bugzilla suggesting an enhancement to the XPath engine so
> that it would recognize Java collections and arrays as equivalent to
> NodeSet. In the meantime, I have created a utility class that will wrap an
> Java collections and arrays.
>
> The bugzilla is: 203970
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=203970)
>
> The utility class is attached to the bugzilla, and to this post.
>
> Let me know if this helps.
>
> Paul
>
>
> "Juan Pedro Silva" <jpsilvagallino@gmail.com> wrote in message
> news:fclva5$hlr$1@build.eclipse.org...
>> Hi Paul, everybody.
>>
>> I'm working on a second XPath function (stereotypeSearch)that returns a
>> list containing all elements from a model stereotyped with an stereotype
>> provided as an input parameter.
>>
>> The XPath function works fine, and returns what it is supposed to
>> return. However, I can't find the way to access the elements contained
>> in the result List.
>>
>> For example, when looking for the elements stereotyped 'message', I
>> tried using:
>>
>> A) <c:iterate var="stereotypedElements"
>> select="stereotypeSearch($someElement, 'message')">
>>
>> and
>>
>> B) <c:setVariable select="stereotypeSearch($someElement, 'message')"
>> var="messages"/>
>> <c:iterate select="messages"...
>>
>> with no satisfactory results. With A I got a message "Cannot iterate if
>> expression is: stereotypeSearch(...", and with B I get no results (no
>> iteration).
>>
>> I am assuming that a List (or any kind of set) is not a valid return
>> type for an XPath function to be handled by JET, am I right?. Is there
>> any way to do this?.
>> Thank you in advance.
>>
>> Regards,
>> Juan Pedro
>
>
Previous Topic:Merging of import statements not working?
Next Topic:[JET2] Customizing an iterate sentence
Goto Forum:
  


Current Time: Fri Apr 26 01:07:03 GMT 2024

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

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

Back to the top