Skip to main content
Question

XML Templater not get the expected result


boubcher
Contributor
Forum|alt.badge.img+11

@takashi

Hello there I have a table with the configuration bellow attribute name: fme_feature_type_name represent the parent and the attribute: name is the child, we want

to write to have an XML each parent with its child

when I use the template I am getting all features attributes name repeated for each parent name

i am sure I am missing something in the root or sub configuration

 

 

 

11 replies

danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • December 2, 2018

Hi @boubcher

 

Could you share us again the images? These files are broken.

 

Thanks,

Danilo


takashi
Influencer
  • December 2, 2018

It would be better if you would copy and paste the template expressions as-is here, rather than images. Also, please post the error messages logged when you run the workspace.


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • December 3, 2018

@takashi

@danilo_fme

Thanks for your response

attached the excel file for the data we want to convert to XML

and the output we are looking for is

<group>

 

<Section>#LayerName#</Section>

 

<Lay erID>#LayerID#</LayerID>

 

<Grid GridID="Grid2555550" Color="#Color#" FilterFeild="" FilterValue="*" BufferLayer=""

 

<Column dataField="#id#" dataType="" summaryType="#sum#"></Column>

 

</Grid>

 

</group>

 

we want to replace the layer name with the value of the attribute ( fme_feature_type_name)

and the id with the value in the attribute (name )

wml templater.xlsx

 

 


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • December 4, 2018

@takashi

Hello Takashi I did add more information to our case any suggestion

Thanks


david_r
Celebrity
  • December 4, 2018

Have a look at the attached workspace template, hopefully I've understood your requirements.

xmltemplater.fmwt

When there's only a single input source to the XMLTemplater, you can use the Sampler and DuplicateFilter to preprocess the input according to key attributes.


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • December 4, 2018
david_r wrote:

Have a look at the attached workspace template, hopefully I've understood your requirements.

xmltemplater.fmwt

When there's only a single input source to the XMLTemplater, you can use the Sampler and DuplicateFilter to preprocess the input according to key attributes.

@david_r

Thanks for your response

I am not able to download the WS the ulr is giving this error (

HTTP Status 403 -

 


david_r
Celebrity
  • December 4, 2018
boubcher wrote:

@david_r

Thanks for your response

I am not able to download the WS the ulr is giving this error (

HTTP Status 403 -

 

Looks like it's the forum that's bugging.

Try this link: https://www.dropbox.com/s/g3yr27d7wpbtknu/xmltemplater.fmwt?dl=1


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • December 4, 2018
david_r wrote:

Have a look at the attached workspace template, hopefully I've understood your requirements.

xmltemplater.fmwt

When there's only a single input source to the XMLTemplater, you can use the Sampler and DuplicateFilter to preprocess the input according to key attributes.

@david_r

Thanks so much for the answer this what I was looking for

the mistake I was doing is on this

{fme:process-features("COLUMNS", "fme_feature_type_name", fme:get-attribute("fme_feature_type_name"))}

 

{fme:process-features("COLUMNS", fme:get-attribute("fme_feature_type_name"))}

could you please explain why should we both "fme_feature_type_name", fme:get-attribute("fme_feature_type_name")

the logic is get the columns from features type name ,

 

 

 

 


takashi
Influencer
  • December 4, 2018
boubcher wrote:

@david_r

Thanks so much for the answer this what I was looking for 

the mistake I was doing is on this 

{fme:process-features("COLUMNS", "fme_feature_type_name", fme:get-attribute("fme_feature_type_name"))}

 

{fme:process-features("COLUMNS", fme:get-attribute("fme_feature_type_name"))}

could you please explain  why should we both "fme_feature_type_name", fme:get-attribute("fme_feature_type_name")

the logic is get the columns from features type name , 

 

 

 

 

The function call with this syntax executes the sub template expression for every feature (entered into the sub port) which has the specified value in the attribute. That is, it works like the Group By.

fme:process-features( <template names><attributes to filter><filter values> )

See also here to learn more: XQuery Functions


david_r
Celebrity
  • December 5, 2018
boubcher wrote:

@david_r

Thanks so much for the answer this what I was looking for

the mistake I was doing is on this

{fme:process-features("COLUMNS", "fme_feature_type_name", fme:get-attribute("fme_feature_type_name"))}

 

{fme:process-features("COLUMNS", fme:get-attribute("fme_feature_type_name"))}

could you please explain why should we both "fme_feature_type_name", fme:get-attribute("fme_feature_type_name")

the logic is get the columns from features type name ,

 

 

 

 

In addition to what Takashi says, have a good look at the examples in the XMLTemplater help, it's pretty well documented.


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • December 5, 2018
david_r wrote:

Have a look at the attached workspace template, hopefully I've understood your requirements.

xmltemplater.fmwt

When there's only a single input source to the XMLTemplater, you can use the Sampler and DuplicateFilter to preprocess the input according to key attributes.

Thanks, Guys

really Help


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