Reference Macro in XML generation

Hello,

I am trying to add a Reference Macro in an xml file to reference a Mapping Label's value assigned with a $MAP_SRC$ macro but mps does not let me do that. However, using Reference Macro in a java class is perfectly fine. Is there a reason for this?

What I am trying to do is that I am generating unique names for some xml elements and I need to use these strings in another xml document. So I mapped these strings to a mapping label using $MAP_SRC$ and I tried to use them with a Property Macro trying to get an output node by using the genContext.get output <label> for (node). But when I try to build the sandbox, MPS gives an error stating "get output by input and label cannot be used here". Here is a screenshot:

Using a reference macro is not necessary actually, but as I said, I need to use the mapping label's value somehow and I don't know any other method than this. So if you have another idea please let me know.

Thanks

3 comments

Hi,

from the screenshot it seems that you are setting a PropertyMacro, not a ReferenceMacro. Could this be the issue?

Vaclav

0

Hi Vaclav,

The reason I used a PropertyMacro to get the mapping label's value is because MPS did not let me use a ReferenceMacro in the XML document. And if I used a PropertyMacro like in the screenshot I provided, this time MPS gives errors. So I am stuck here. How can I extract the value stored in a mapping label in an XML document to be generated?

Thanks

0

I suspect it may be some other issue in your generator setup. Does unchecking the "strict mode" checkbox in the Generator settings page help?

 

0

Please sign in to leave a comment.