Skip to main content
Solved

In XMLTemplater, is it possible to process attributes of an XML element through a distinct sub-template (i.e. through {fme:process-template(" ")} ) ?

  • August 24, 2021
  • 2 replies
  • 64 views

jfd553

I convert input features to XML using XMLTemplater. Everything is fine as long it is done through the same sub-template. When I try to process some attributes (coordinates reading) by calling another sub-template it fails.

 

This sub-template works properly 

**OBJECT Sub-Template**

{<object

  id="{fme:get-attribute("id")}"

  visible="{fme:get-attribute("visible")}"

  lon="{geom:get-y-coord()}" 

  lat="{geom:get-x-coord()}" >

</object>}

 

This one, calling another sub-template, doesn't work.

**OBJECT Sub-Template**

{<object

  id="{fme:get-attribute("id")}"

  visible="{fme:get-attribute("visible")}"

  {fme:process-template("XY")} > Here is the syntax error: unexpected character "{" near line 4, column 5 .

</object>}

 

**XY Sub-Template**

{ lon="{geom:get-y-coord()}" 

  lat="{geom:get-x-coord()}" }

 

I did try a lot of things but I still don't see what the problem is 😞

Thanks for any help...

Best answer by thijsknapen

I'm not entirely sure, but I think your issue might be related that you try to use an sub template for a set of XML attributes, and not for an XML document itself.

I guess the latter is a requirement for the XMLTemplator

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

thijsknapen
Contributor
Forum|alt.badge.img+11
  • Contributor
  • 155 replies
  • Best Answer
  • September 8, 2021

I'm not entirely sure, but I think your issue might be related that you try to use an sub template for a set of XML attributes, and not for an XML document itself.

I guess the latter is a requirement for the XMLTemplator


jfd553
  • Author
  • 13 replies
  • September 13, 2021

Right, with some help (yours and FME support), I found that a sub-template deals only with complete xml elements. (i.e. must return a whole <element>… </element>. Thank.