Skip to main content
Solved

XMLTemplater listattributes

  • March 4, 2016
  • 2 replies
  • 29 views

Forum|alt.badge.img

Hi everyone, 

I don't know how to work with listattributes inside the XMLTemplater Transformer. 

A feature contains a list networks.network{}, foreach element in the list, I want to create a new child element "networkNode".

Do I have to loop threw the elements and create the xml for each, or is it possible to do it directly in the XMLTemplater? 

networks.network{0}.type = type0
networks.network{0}.linkage = linkage0
networks.network{1}.type = type1
networks.network{1}.linkage= linkage1

What I want my XML to look like: 

<OnlineContact>
  <aixm:networkNode>  
            <aixm:network>type0</aixm:network>
            <aixm:linkage>linkage0</aixm:linkage>
         </aixm:OnlineContact>
     </aixm:networkNode>
    <aixm:networkNode>  
            <aixm:network>type1</aixm:network>
            <aixm:linkage>linkage1</aixm:linkage>
         </aixm:OnlineContact>
     </aixm:networkNode>
</OnlineContact>

I am using FME Desktop 2015

Thanks, Mel

Best answer by kim

One possibility is to use a ListExploder on the list, then add them into the XmlTemplater using a Sub template.

I've included a sample that I believe achieves what you are trying to do in the workspace below:

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

Forum|alt.badge.img+5
  • Best Answer
  • March 4, 2016

One possibility is to use a ListExploder on the list, then add them into the XmlTemplater using a Sub template.

I've included a sample that I believe achieves what you are trying to do in the workspace below:


Forum|alt.badge.img
  • Author
  • March 4, 2016

One possibility is to use a ListExploder on the list, then add them into the XmlTemplater using a Sub template.

I've included a sample that I believe achieves what you are trying to do in the workspace below:

Thanks, it does exactly what I want :)