Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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.

 

 

  • 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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.