Jump to content

sgabrown

Newbies
  • Posts

    1
  • Joined

  • Last visited

sgabrown's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. I am trying to import PubMed XML data that is obtained by a http request for example: http://eutils.ncbi.n...088&retmode=xml ... and have had some success for simple data with an XSL file copied at the end of this post. This is used on a solution posted some years back on this forum by Fenton Jones (http://fmforums.com/...-filemaker-pro/) My problem arrises with repeating fields, specifically the author list. I need to convert ********************* <AuthorList> <Author> <LastName>Brown</LastName> <ForeName>Simon G A</ForeName> <Initials>SG</Initials> </Author> <Author> <LastName>Wiese</LastName> <ForeName>Michael D</ForeName> <Initials>MD</Initials> </Author> <Author> <LastName>van Eeden</LastName> <ForeName>Pauline</ForeName> <Initials>P</Initials> </Author> ********************* Into a single column as: Brown SG, Wiese SG, van Eeden P. For any given reference there may be any number of authors from 1 to 25, but this just needs to go into one field as a single line. I am completely new to XML and must admit to nit understanding the structure very well. I can design fairly simple/functional databases using Filemaker for our research use, but I am not a programmer! Any help would be greatly appreciated, and if I manage to solve the problem with help I will post the final XSL solution on the forum. Thanks, Simon *******XLS CODE THAT WORKS WITH SIMPLE DATA***** <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <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="M/d/yyyy" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT="h:mm:ss a"/> <METADATA> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="PMID" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="DateCreated" TYPE="DATE"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Journal" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Title" TYPE="TEXT"/> </METADATA> <RESULTSET FOUND="{count(PubmedArticleSet/PubmedArticle)}"> <xsl:for-each select="PubmedArticleSet/PubmedArticle"> <ROW> <xsl:attribute name="MODID">0</xsl:attribute> <xsl:attribute name="RECORDID"><xsl:value-of select="position()"/></xsl:attribute> <COL> <DATA> <xsl:value-of select="MedlineCitation/PMID"/> </DATA> </COL> <xsl:variable name="m" select="MedlineCitation/DateCreated/Month" /> <xsl:variable name="d" select="MedlineCitation/DateCreated/Day" /> <xsl:variable name="y" select="MedlineCitation/DateCreated/Year" /> <xsl:variable name="FM_date" select="concat($m,'/',$d, '/',$y)"/> <COL> <DATA> <xsl:value-of select="$FM_date"/> </DATA> </COL> <COL> <DATA> <xsl:value-of select="MedlineCitation/Article/Journal/Title"/> </DATA> </COL> <COL> <DATA> <xsl:value-of select="MedlineCitation/Article/ArticleTitle"/> </DATA> </COL> </ROW> </xsl:for-each> </RESULTSET> </FMPXMLRESULT> </xsl:template> </xsl:stylesheet>
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.