AnsweredAssumed Answered

How to create new records on XML import

Question asked by goodhope on Nov 26, 2009
Latest reply on Dec 9, 2009 by didier98004

Title

How to create new records on XML import

Post

Hello,

 

I've previously posted here about importing XML. This is the first time I've had to look into this, so I cut down my XML file to make life easier. What I have really is an XML file containing many Adverts, each beginning with the [Notice] tag. I'd really like to know how on import into Filemaker to create a new record when a [Notice] tag is encountered (one Advert to equal one record). Please see below an example of how my XML file and XSLT looks:

 

I guess I need to make an amendment to the XSLT, but I'm not sure what command syntax to use or where to place it.

 

Help will be greatefully received.

 

Regards Nick

 

 

 XML FILE:

[?xml version="1.0" encoding="UTF-8"?]
[Paper]
[Body][Category Type="2"][Section Type="Administration"][Notice Type="10" Reference="345678"]
[Metadata]
[PublishDate]2009-08-08[/PublishDate]
[SupplierNoticeID]8B51588-070293[/SupplierNoticeID]
[NoticeClass]Standard[/NoticeClass[
[/Metadata]
[Court]
[CourtName]High Court of Justice[/CourtName]
[CourtNumber Number="172345 and 17433" Year="2008"/]
[/Court]
[Company]
[CompanyName Class="Company"]AZ CONSULTANCY[/CompanyName]
[CompanyNumber]12345678[/CompanyNumber]
[NatureOfBusiness]Software Supply[/NatureOfBusiness]
[CompanyRegisteredOffice]Address Line Material[/CompanyRegisteredOffice]
[/Company]
[Administration]
[DateOfAppointment Date="2009-08-11"]10 August 2009[/DateOfAppointment]

[/Administration][/Notice][/Section][/Category][/Body][/Paper] 

 

 

XSLT FILE:

<!--  StartFragment  -->

[?xml version="1.0"encoding="UTF-8"?]

[xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"]

[xsl:outputmethod="xml" version="1.0" encoding="utf-8"indent="yes"/]

[xsl:templatematch="/"]

[FMPXMLRESULTxmlns="http://www.filemaker.com/fmpxmlresult"]

[ERRORCODE]0[/ERRORCODE]

[PRODUCT BUILD=""NAME="" VERSION=""/]

[DATABASEDATEFORMAT="" LAYOUT="" NAME=""RECORDS="" TIMEFORMAT=""/]

 

[METADATA]

[FIELDNAME="CourtName" TYPE="TEXT" EMPTYOK="YES"MAXREPEAT=""/]

[FIELDNAME="Number" TYPE="TEXT" EMPTYOK="YES"MAXREPEAT=""/]

[FIELD NAME="Year"TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/]

[FIELDNAME="CompanyName" TYPE="TEXT" EMPTYOK="YES"MAXREPEAT=""/]

[FIELDNAME="CompanyNumber" TYPE="NUMBER" EMPTYOK="YES"MAXREPEAT=""/]

[FIELD NAME="NatureOfBusiness"TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/]

[FIELDNAME="CompanyRegisteredOffice" TYPE="TEXT"EMPTYOK="YES" MAXREPEAT=""/]

[FIELDNAME="DateOfAppointment" TYPE="TEXT"EMPTYOK="YES" MAXREPEAT=""/]

[FIELDNAME="Administrator" TYPE="TEXT" EMPTYOK="YES"MAXREPEAT=""/]

[/METADATA]

 

[RESULTSET FOUND=""]

[ROW MODID=""RECORDID=""]

[COL][DATA][xsl:value-ofselect="Gazette/Body/Category/Section/Notice/Court/CourtName"/][/DATA][/COL]

[COL][DATA][xsl:value-of select="Gazette/Body/Category/Section/Notice/Court/CourtNumber/@Number"/][/DATA][/COL]

[COL][DATA][xsl:value-ofselect="Gazette/Body/Category/Section/Notice/Court/CourtNumber/@Year"/][/DATA][/COL]

[COL][DATA][xsl:value-ofselect="Gazette/Body/Category/Section/Notice/Company/CompanyName"/][/DATA][/COL]

[COL][DATA][xsl:value-ofselect="Gazette/Body/Category/Section/Notice/Company/CompanyNumber"/][/DATA][/COL]

[COL][DATA][xsl:value-ofselect="Gazette/Body/Category/Section/Notice/Company/NatureOfBusiness"/][/DATA][/COL]

[COL][DATA][xsl:value-ofselect="Gazette/Body/Category/Section/Notice/Company/CompanyRegisteredOffice"/][/DATA][/COL]

[COL][DATA][xsl:value-ofselect="Gazette/Body/Category/Section/Notice/Administration/DateOfAppointment"/][/DATA][/COL]

[COL][DATA][xsl:value-ofselect="Gazette/Body/Category/Section/Notice/Administration/Administrator"/][/DATA][/COL]

[/ROW]

 

[/RESULTSET]

[/FMPXMLRESULT]

[/xsl:template]

[/xsl:stylesheet]

<!--  EndFragment  -->

 










Outcomes