AnsweredAssumed Answered

XSLT stylesheet for XML from Parsed email?

Question asked by garyjones on Dec 9, 2018
Latest reply on Dec 10, 2018 by garyjones

Hi,

 

I am attempting to ingest into a database, via RSS, content created by both Google Alerts and Google Scholar. These are my priorities but eventually this will expand to other feeds and by which time I hope to have a far better understanding of XML and XSLT stylesheets - but at the moment, and despite best efforts, I have a mental block, am stuggling and hoping someone would be kind enough to help.

 

Google provides an option to deliver the basic Google Alerts via RSS whereas Google Scholar doesn't.

In this post, https://community.filemaker.com/thread/192755, Michael Horak was kind enough to point out the errors I had made and provide a working XSLT stylesheet in relation to the Google Alerts need - which helped me understand the XML structure/relationship better.

 

With regard to Google Scholar I stumbled across Mailparser (https://app.mailparser.io/) which is an excellent service for parsing email content - really simple to use and very powerful. When combined with Zapier it's possible to get parsed emails delivered in any number of ways.

 

It easily creates an Excel/CSV file that is structured in such a way as to make importing into FMP really simple - however I want to automate my ingestion process and to do this with Excel involves a number of additional external service dependencies that represent points of breakage - XML delivery represents the simplest method.

However, Google Alerts RSS groups date fields of individual records together, i.e.

 

<Record 1>
    <Title>
    <Author>
</Record 1>

<Record 2>
etc etc

 

The RSS output of Mailparser.io groups fields so is very different, i.e.

<Title>
<Record 1>
<Record 2>
</Title>

<Author>
<Record 1>
<Record 2>
etc etc

 

The XML output is also available as two options - nested key/value object or all data including labels.

I am struggling with trying to undertsand the XML structure so as to write an XSLT stylesheet that pulls the data fields together to ensure I can create recors properly when importing.

 

I have tried using Oxygen to help but to no avail and my awful attempt at an XSLT style sheet follows -

 

<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="/mailparser"> 
    <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"> 
        <METADATA> 
            <FIELD NAME="TitleURL"/> 
            <FIELD NAME="SummaryTitle"/> 
            <FIELD NAME="Authors" />
   <FIELD NAME="Media Outlet" />
   <FIELD NAME="Publication Year" />
   <FIELD NAME="Text Abstract Merge" />       
        </METADATA> 
        <RESULTSET> 
            <xsl:for-each select="mailparser"> 
                <ROW> 
                    <COL><DATA><xsl:value-of select="mailparser"/></DATA></COL> 
                </ROW> 
            </xsl:for-each> 
        </RESULTSET> 
    </FMPXMLRESULT> 
</xsl:template> 
 
</xsl:stylesheet>

 

I have attached the two different Mailparser XML options.

 

I'm not sure whether what I am trying to achieve via an XSLT stylesheet is possible and/or whether it requires a plug-in, let alone which one if it does etc.

 

All and any help very gratefully received as always.

 

Thanks.

 

Best Wishes

 

Gary

Outcomes