July 21, 20223 yr Hi, fmforums team, I have an xml with two components: Descriptor and Substance. One Descriptor can contain many substances, yet, when I import using the Substance.xsl, it imports only the first substance for each Descriptor. How do I tell the .xsl to import the substances recursively? I'm including the following files: .xsl .xml .dtd (empty) .fmp12 Thank you,Pharmacological action.zip Daniel
July 21, 20223 yr If you want the import to create a record for each substance, then you must tell the stylesheet to create a ROW for each Substance. Your stylesheet creates a ROW: <xsl:for-each select="PharmacologicalActionSet/PharmacologicalAction/PharmacologicalActionSubstanceList"> and then does: <xsl:value-of select="Substance/RecordUI"/> which gets the value from the first Substance child of the current PharmacologicalActionSubstanceList. I would suggest you try it this way: <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="/PharmacologicalActionSet"> <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"> <METADATA> <FIELD NAME="DescriptorUI"/> <FIELD NAME="RecordUI"/> <FIELD NAME="String"/> </METADATA> <RESULTSET> <xsl:for-each select="PharmacologicalAction"> <xsl:variable name="descriptorUI" select="DescriptorReferredTo/DescriptorUI"/> <xsl:for-each select="PharmacologicalActionSubstanceList/Substance"> <ROW> <COL> <DATA> <xsl:value-of select="$descriptorUI"/> </DATA> </COL> <COL> <DATA> <xsl:value-of select="RecordUI"/> </DATA> </COL> <COL> <DATA> <xsl:value-of select="RecordName/String"/> </DATA> </COL> </ROW> </xsl:for-each> </xsl:for-each> </RESULTSET> </FMPXMLRESULT> </xsl:template> </xsl:stylesheet> --- P.S. Next time please reduce your example to a reasonable size.
July 21, 20223 yr Author Wow, @comment! It worked beautifully! Sorry about the filesize. I actually picked the smallest .xml, as they are usually closer to a GB. All the very best, Daniel
Create an account or sign in to comment