Skip to main content
Solved

Other way to create an XML-file

  • September 7, 2018
  • 5 replies
  • 38 views

Forum|alt.badge.img

Hallo community! I want to give you some vision about my try to create an xml document with the "XMLTemplater". The problem in my workflow is that i can't create an variable in one subtemplate to read it in an other subtemplate. (second picture show what i mean with subtemplate). Thats why i can't fill the right geometry information into my structure because my subtemplate "GEOMETRY" doesn't know in which road he is and so he can't get the right nodes out of a list which includes all nodes.

So my question is now which possible ways do i have to solve that problem or how to create the xml-file with an defined structure over an other way (not over an "XMLTemplater") ?

Best answer by revesz

Hi,

I cannot see the templates, my best guess is that you want a single XML with multiple "ROAD"s as sub-elements and each ROAD sub-element has multiple vertices.

In XMLTemplater you can nest Sub Templates. Eg:

If you use use in ROOT:

{fme:process-features("ROAD")}

you can use in the ROAD template:

 

{fme:process-features("GEOMETRY""COUNTER_2_ATTR", fme:get-attribute("COUNTER_2_ATTR"))}

COUNTER_2_ATTR is the Count Output Attribute that you set in the Counter_2 transformer.

Is it something you wanted to achieve?

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

5 replies

revesz
Contributor
Forum|alt.badge.img+15
  • Contributor
  • Best Answer
  • September 7, 2018

Hi,

I cannot see the templates, my best guess is that you want a single XML with multiple "ROAD"s as sub-elements and each ROAD sub-element has multiple vertices.

In XMLTemplater you can nest Sub Templates. Eg:

If you use use in ROOT:

{fme:process-features("ROAD")}

you can use in the ROAD template:

 

{fme:process-features("GEOMETRY""COUNTER_2_ATTR", fme:get-attribute("COUNTER_2_ATTR"))}

COUNTER_2_ATTR is the Count Output Attribute that you set in the Counter_2 transformer.

Is it something you wanted to achieve?


takashi
Influencer
  • September 7, 2018
It's hard to find a solution unless attributes which the input features have and the XML schema you need to create from them would be clarified. Could you please elaborate the conditions and the requirements specifically?

 

 


Forum|alt.badge.img
revesz wrote:

Hi,

I cannot see the templates, my best guess is that you want a single XML with multiple "ROAD"s as sub-elements and each ROAD sub-element has multiple vertices.

In XMLTemplater you can nest Sub Templates. Eg:

If you use use in ROOT:

{fme:process-features("ROAD")}

you can use in the ROAD template:

 

{fme:process-features("GEOMETRY""COUNTER_2_ATTR", fme:get-attribute("COUNTER_2_ATTR"))}

COUNTER_2_ATTR is the Count Output Attribute that you set in the Counter_2 transformer.

Is it something you wanted to achieve?

Thats exactly what i need. It just looks like a matlab function which i can give parameters with it.

 

Thanks!

 


Forum|alt.badge.img
revesz wrote:

Hi,

I cannot see the templates, my best guess is that you want a single XML with multiple "ROAD"s as sub-elements and each ROAD sub-element has multiple vertices.

In XMLTemplater you can nest Sub Templates. Eg:

If you use use in ROOT:

{fme:process-features("ROAD")}

you can use in the ROAD template:

 

{fme:process-features("GEOMETRY""COUNTER_2_ATTR", fme:get-attribute("COUNTER_2_ATTR"))}

COUNTER_2_ATTR is the Count Output Attribute that you set in the Counter_2 transformer.

Is it something you wanted to achieve?

Can you also show me where and how i have to define the variable "Counter_2_ATTR" ?

 

Is that like:

 

Definition:

 

COUNTER_ROAD :@Count("road"
give the variable like a parameter to my subtemplate "GEOMETRY":

 

{fme:process-features("GEOMETRY","COUNTER_ROAD",fme:get-attribute("COUNTER_ROAD")
But i think i can't declare and use the variable in the same subtemplate "ROAD". So that means that i should split the declaration and the hand over to "GEOMETRY" is that right ?

 


takashi
Influencer
  • September 7, 2018
rolandpilsinger wrote:
Can you also show me where and how i have to define the variable "Counter_2_ATTR" ?

 

Is that like:

 

Definition:

 

COUNTER_ROAD :@Count("road"
give the variable like a parameter to my subtemplate "GEOMETRY":

 

{fme:process-features("GEOMETRY","COUNTER_ROAD",fme:get-attribute("COUNTER_ROAD")
But i think i can't declare and use the variable in the same subtemplate "ROAD". So that means that i should split the declaration and the hand over to "GEOMETRY" is that right ?

 

Please read @revesz's answer more carefully.

 

"COUNTER_2_ATTR is the Count Output Attribute that you set in the Counter_2 transformer."

 


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