Hi,
I’m looking for some help please, if anyone can respond...
I’m using FME 2016 to transform data into INSPIRE gml for
the administrativeBoundaries theme and I’m new to the world of xml.
I’ve looked at several examples on FME Knowledge for
XMLTemplater but cannot get the values to write back as I want.
My source data is a geodatabase with linestring data
containing references to their related polygons.
In FME I have concatenated these reference values for each
ID , into one attribute, admUnit. Values are comma separated. I then use AttributeSplitter and ListExploder to
expose the list, admUnit_list{}. The list length varies for different ID but never
be empty.
AdministrativeBoundary.localID1admUnitRef1,Ref5,Ref6,Ref7admUnit_list{0}Ref1admUnit_list{1}Ref5admUnit_list{2}Ref6admUnit_list{3}Ref7
I want my final output as INSPIRE gml
using the administrativeBoundary schema to resemble
<gml:featureMember>
<au:AdministrativeBoundary
gml:id="ID1">
<au:admUnit
xlink:href="Ref1"/>
<au:admUnit
xlink:href="Ref5"/>
<au:admUnit
xlink:href="Ref6"/>
<au:admUnit
xlink:href="Ref7"/>
</au:AdministrativeBoundary>
</gml:featureMember>
I cannot get this output and due to a
lack of experience with xml cannot work out what I am doing wrong...
I have tried two methods
unsuccessfully
Method 1:
In xmlTemplater in the Root Template I have
{
for $admUnit in
{fme:get-list-attribute("admUnit_list{}")}
return
<admUnit>{$admUnit}</admUnit>
}
I am writing the output from
xmlTemplater to the attribute admUnit_result.
This gives me a one line output
admUnit_result (encoded: utf-8):
<admUnit>Ref1</admUnit><admUnit>Ref5</admUnit><admUnit>Ref6</admUnit><admUnit>Ref7</admUnit>
I then use AttributeCopier to map admUnit_result
to admUnit{0}.xlink_href
This writes to the gml file as
<gml:featureMember>
<au:AdministrativeBoundary
gml:id="GB.NI.LPS.AU.L_1">
<au:admUnit
xlink:href="<admUnit>Ref1</admUnit><admUnit>Ref5</
admUnit><admUnit>Ref6</admUnit><admUnit>Ref7</admUnit>"/>
</au:AdministrativeBoundary>
</gml:featureMember>
Question
1. How can I get this to resemble the
gml output above where each value has a separate line?
2. How do I remove the < and
> to give < and > respectively?
Method2:
In xmlTemplater if I set the root to
<root>
{fme:process-features("SUB")}
</root>
And the sub template to
<admUnit>
{
for $admUnit in {fme:get-list-attribute("admUnit_list{}")}
return
<admUnit>{$admUnit}</admUnit>
}
</admUnit>
The returned attribute, admUnit_result, shows empty values when viewed
in Inspector.
AdministrativeBoundary.localID
1admUnitRef1,Ref5,Ref6,Ref7admUnit_list{0}Ref1admUnit_list{1}Ref5admUnit_list{2}Ref6admUnit_list{3}Ref7admUnit_resultadmUnit_result (encoded: utf-8):<root><admUnit></admUnit><admUnit></admUnit><admUnit></admUnit><admUnit></admUnit></root>
And in the gml file the admUnit
element is similar with no values
<gml:featureMember>
<au:admUnit
xlink:href="<root>
<admUnit>
</admUnit><admUnit>
</admUnit>
</root>"/>
</au:AdministrativeBoundary>
</gml:featureMember>
Question
How do I get the values to output?
Does anyone have a solution please?
Thanks.