Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Passing XPath result to custom tag
Passing XPath result to custom tag [message #26746] Tue, 17 July 2007 11:35 Go to next message
Zsolt Paroczi is currently offline Zsolt ParocziFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,

how can I pass an XPath result as custom tag attribute

<mj:getPackage classId="$entityClass/@id"/>

<mj:getPackage classId="{$entityClass/@id}"/>

none of them works, in the tag sorce I get the attribute as String
($entityClass/@id;="{$entityClass/@id})

In the tag plugin I set the attribute type xpath and tried with string
also.


thanks forward,
Zsolt
Re: Passing XPath result to custom tag [message #26786 is a reply to message #26746] Tue, 17 July 2007 13:06 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Zsolt:

Looking at your example, I think you'd probably want your users to write:

<mj:getPackage classId="{$entityClass/@id}"/>

In which case, all you have to do is use the method getAttribute(String) in
your tag handler. I suspect you are using using
TagInfo.getAttribute(String), which returns the 'raw' unprocessed attribute
value.

If, by change, you want to evaluate the XPath expressions yourself in the
tag handler (like c:get and c:iterate do), you need to use the class
XPathContextExtender:

XPathContextExtender xce = XPathContextExtender.getInstance(context);

// there is a whole family of resolveXXX methods. To resolve an xpath as a
boolean, you'd use:
boolean result = xce.resolveTest(currentXPathContext(),
getAttribute("test");

Paul
"Zsolt Paroczi" <paroczizs@ext.t-mobile.hu> wrote in message
news:d65dfc0ce27fa1f8529a6ea18ee50795$1@www.eclipse.org...
> Hi,
>
> how can I pass an XPath result as custom tag attribute
>
> <mj:getPackage classId="$entityClass/@id"/>
>
> <mj:getPackage classId="{$entityClass/@id}"/>
>
> none of them works, in the tag sorce I get the attribute as String
> ($entityClass/@id;="{$entityClass/@id})
>
> In the tag plugin I set the attribute type xpath and tried with string
> also.
>
>
> thanks forward,
> Zsolt
>
Previous Topic:How to run a jet transformation in the plug-ins?
Next Topic:XPath ancestor axis + XPath node
Goto Forum:
  


Current Time: Tue Apr 23 07:20:09 GMT 2024

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

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

Back to the top