Solved

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

  • 24 August 2021
  • 2 replies
  • 8 views

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...

icon

Best answer by thijsknapen 8 September 2021, 18:57

View original

2 replies

Badge +3

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

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.

Reply