AnsweredAssumed Answered

XML - How to pick up the entire 'advert' text and dump into the relevant Filemaker record

Question asked by goodhope on Dec 1, 2009
Latest reply on Dec 3, 2009 by comment_1

Title

XML - How to pick up the entire 'advert' text and dump into the relevant Filemaker record

Post

Hello,

Sorry to flood the board with XML related questions, but I do have another issue.

As people will know I've been busy reading an XML file into Filemaker -
THANKS ALL FOR YOUR HELP!. The XML file is a collection of adverts which make up a newspaper. I've been collecting named elements and passing their textual content through into separate fields in Filemaker - working well!

I now find out that a requirement is also to pick up the entire advert content (an advert starts with and ends with tags - <NOTICE> and </Notice>) and dump that into another field on each record - one advert equals one record. I know how to pick up separate elements and use its related data, but don't know how at the same point to gather all the advert text together and then dump into a named field in filemaker.

Each record will have data separated into its correct fields, as is currently the case (for instance 'Publish date' text goes into the 'PublishDate' field), then another field will hold the complete advert text. Please see my XSLT and sample XML file below. If anyone could help with the syntax and location of commands within my XSLT to achieve this that would be great.

Cheers Nick 

 

XSLT:

 <?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>

<xsl:template match="/">

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">

<ERRORCODE>0</ERRORCODE>

<PRODUCT BUILD="" NAME="" VERSION=""/>

<DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT=""/>

<METADATA>

<FIELD NAME="Type" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="Reference" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="PublishDate" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="CourtName" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="CourtDistrict" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="Number" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="Year" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="CompanyName" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="TradingAs" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="CompanyNumber" TYPE="NUMBER" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="Text" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="NatureOfBusiness" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="TypeOfLiquidation" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="CompanyRegisteredOffice" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="DateOfAppointment" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="Administrator" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="PersonName" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="OfficeHolderNumber" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="FirmName" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="AddressLineGroup" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="Date" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="Time" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="Legislation" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="LegislationSection" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="DateSigned" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

</METADATA>

<RESULTSET FOUND="">

<xsl:for-each select="Gazette/Body/Category/Section/Notice">

<ROW MODID="" RECORDID="">

<COL><DATA><xsl:value-of select="@Type"/></DATA></COL>

<COL><DATA><xsl:value-of select="@Reference"/></DATA></COL>

<COL><DATA><xsl:value-of select="Metadata/PublishDate"/></DATA></COL>

<COL><DATA><xsl:value-of select="Court/CourtName"/></DATA></COL>

<COL><DATA><xsl:value-of select="Court/CourtDistrict"/></DATA></COL>

<COL><DATA><xsl:value-of select="Court/CourtNumber/@Number"/></DATA></COL>

<COL><DATA><xsl:value-of select="Court/CourtNumber/@Year"/></DATA></COL>

<COL><DATA><xsl:value-of select="Company/CompanyName"/></DATA></COL>

<COL><DATA><xsl:value-of select="Company/CompanyOtherNames/TradingAs"/></DATA></COL>

<COL><DATA><xsl:value-of select="Company/CompanyNumber"/></DATA></COL>

<COL><DATA><xsl:for-each select="P/Text"><xsl:value-of select="." /><xsl:text>&#10;&#13;</xsl:text></xsl:for-each></DATA></COL>

<COL><DATA><xsl:for-each select="Company/NatureOfBusiness"><xsl:value-of select="." /><xsl:text>&#10;&#13;</xsl:text></xsl:for-each></DATA></COL>

<COL><DATA><xsl:value-of select="Company/TypeOfLiquidation"/></DATA></COL>

<COL><DATA><xsl:value-of select="Company/CompanyRegisteredOffice"/></DATA></COL>

<COL><DATA><xsl:value-of select="Administration/DateOfAppointment"/></DATA></COL>

<COL><DATA><xsl:value-of select="Administration/Administrator"/></DATA></COL>

<COL><DATA><xsl:for-each select="Administration/Administrator/PersonName | P/Text/PersonName"><xsl:value-of select="." /><xsl:text>&#10;&#13;</xsl:text></xsl:for-each></DATA></COL>

<COL><DATA><xsl:for-each select="Administration/Administrator/OfficeHolderNumber | Administration/OfficeHolderNumbers/OfficeHolderNumber"><xsl:value-of select="." /><xsl:text>&#10;&#13;</xsl:text></xsl:for-each></DATA></COL>

<COL><DATA><xsl:value-of select="Administration/Administrator/FirmName | P/Text/FirmName"/></DATA></COL>

<COL><DATA><xsl:value-of select="Administration/Administrator/AddressLineGroup"/></DATA></COL>

<COL><DATA><xsl:value-of select="Administration/Administrator/Date | P/Text/Date"/></DATA></COL>

<COL><DATA><xsl:value-of select="Administration/Administrator/Time | P/Text/Time"/></DATA></COL>

<COL><DATA><xsl:value-of select="Administration/Administrator/Legislation | P/Text/Legislation"/></DATA></COL>

<COL><DATA><xsl:value-of select="Administration/Administrator/LegislationSection | P/Text/LegislationSection"/></DATA></COL>

<COL><DATA><xsl:value-of select="Administration/DateSigned"/></DATA></COL>

</ROW>

</xsl:for-each>

</RESULTSET>

</FMPXMLRESULT>

</xsl:template>

</xsl:stylesheet>

 

 

XML FILE:

 

<?xml version="1.0" encoding="UTF-8"?>

<Gazette><Body><Category Type="24"><Section Type="Administration"><Notice Type="2410" Reference="900771">

<Metadata>

<PublishDate>2009-08-23</PublishDate>

<SupplierNoticeID>1588-070293</SupplierNoticeID>

</Metadata>

<Court>

<CourtName>High Court</CourtName>

<CourtNumber Number="170266" Year="2008"/>

</Court>

<Company>

<CompanyName Class="Company">AA CONSULTANCY</CompanyName>

<CompanyNumber>55555666</CompanyNumber>

<NatureOfBusiness>Supply</NatureOfBusiness>

<NatureOfBusiness>TexMex Restaurant</NatureOfBusiness>

<CompanyRegisteredOffice>135 London</CompanyRegisteredOffice>

</Company>

<Administration>

<DateOfAppointment Date="2008-08-10">10 August 2008</DateOfAppointment>

<Administrator>

<PersonName Class="Administrator"><Forename>Jim</Forename> <Surname>Jones</Surname></PersonName>  (IP Nos <OfficeHolderNumber>7720</OfficeHolderNumber>), of <FirmName Class="Administrator">S Limited</FirmName>, <AddressLineGroup Class="Administrator">34 London Road, London</AddressLineGroup>.

</Administrator>

</Administration></Notice>

<Notice Type="2410" Reference="771">

<Metadata>

<PublishDate>2009-08-23</PublishDate>

<SupplierNoticeID>588-070293</SupplierNoticeID>

</Metadata>

<Court>

<CourtName>High Court</CourtName>

<CourtNumber Number="7499" Year="2008"/>

</Court>

<Company>

<CompanyName Class="Company">BB LIMITED</CompanyName>

<CompanyNumber>99995666</CompanyNumber>

<NatureOfBusiness>Plastics</NatureOfBusiness>

<CompanyRegisteredOffice>132 London Way, London</CompanyRegisteredOffice>

</Company>

<Administration>

<DateOfAppointment Date="2009-08-22">22 June 2009</DateOfAppointment>

<Administrator>

<PersonName Class="Administrator"><Forename>Mark</Forename> <Surname>Phillips</Surname></PersonName> (IP Nos <OfficeHolderNumber>8820</OfficeHolderNumber>), of <FirmName Class="Administrator">APS Limited</FirmName>, <AddressLineGroup Class="Administrator">31 Ambrose Lane, Oxford</AddressLineGroup>.

</Administrator></Administration></Notice></Section></Category></Body></Gazette>

 

 




Outcomes