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(" ")} ) ?


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

View original
Did this help you find an answer to your question?

2 replies

thijsknapen
Contributor
Forum|alt.badge.img+10
  • Contributor
  • 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
  • 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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings