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

Hello,

 

I'd be very grateful for a pointer on this, I'm new to XML and have to import files as supplied:

 

<?xml version="1.0" encoding="UTF-8"  standalone="yes" ?>
<object_desc>
	<main_desc>
		<ident>63859</ident>
		<modificationdate>14/10/2011</modificationdate>
		...
		<remark>This is a test</remark>
		<title>Property tile</title>
	</main_desc>
	<iptc>
		<bylinetitle></bylinetitle>
		<captionwriter></captionwriter>
		...
		<modifieddate></modifieddate>
		<source></source>
	</iptc>
	<extended_desc>
		<date_amended></date_amended>
		<library_id>177</library_id>
		...
		<filed_under>Masters Box</filed_under>
		<id_objet>Object</id_objet>
	</extended_desc>
		<keywords>HighResRestricted | permission required | Cheshire</keywords>
</object_desc>

 

Each file contains a single record but the data has been split into 'main_desc', 'iptc', 'extended_desc' and oddly 'keywords' just in the root.

 

I have created an xsl file as:

 

<?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="ident" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="modificationdate" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="remark" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="title" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="bylinetitle" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="captionwriter" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="modifieddate" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="source" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="date_amended" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="library_id" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="filed_under" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="id_objet" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
				<FIELD NAME="keywords" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
			</METADATA>
			<RESULTSET FOUND="">
				<xsl:for-each select="/object_desc/main_desc">
					<ROW MODID="" RECORDID="">
						<COL><DATA><xsl:value-of select="ident"/></DATA></COL>
						<COL><DATA><xsl:value-of select="modificationdate"/></DATA></COL>
						<COL><DATA><xsl:value-of select="remark"/></DATA></COL>
						<COL><DATA><xsl:value-of select="title"/></DATA></COL>
						<COL><DATA><xsl:value-of select="bylinetitle"/></DATA></COL>
						<COL><DATA><xsl:value-of select="captionwriter"/></DATA></COL>
						<COL><DATA><xsl:value-of select="modifieddate"/></DATA></COL>
						<COL><DATA><xsl:value-of select="source"/></DATA></COL>
						<COL><DATA><xsl:value-of select="date_amended"/></DATA></COL>
						<COL><DATA><xsl:value-of select="library_id"/></DATA></COL>
						<COL><DATA><xsl:value-of select="filed_under"/></DATA></COL>
						<COL><DATA><xsl:value-of select="id_objet"/></DATA></COL>
						<COL><DATA><xsl:value-of select="keywords"/></DATA></COL>
					</ROW>
				</xsl:for-each>
			</RESULTSET>
		</FMPXMLRESULT>
	</xsl:template>
</xsl:stylesheet>

 

But can only find a way for getting one section of the data in with '<xsl:for-each select="/object_desc/main_desc">' - is there a way to solve this with the XSL file?

 

Many thanks for taking the time to read this.

 

R

from what I read just add a 

 

 

<xsl:for-each select="/object_desc/iptc"> 

 


with the rest after the first </xsl:for-each>

 

and the 

 

<xsl:for-each select="/object_desc/extended_desc">

after that.

 

HTH

  • Author

Thanks for responding, I tried that (and <xsl:for-each select="/object_desc/main_desc | /object_desc/iptc | /object_desc/extended_desc"> ) and get multiple rows for each file (object_desc), is there a way of stuffing 'main_desc', 'iptc', 'extended_desc' and 'keywords' all in to a single record? I've found similar requests by googling but have still not seen a solution except by going back to the XML file

 

Cheers

R

It's difficult to understand your request because the XML example is missing some parts - and it's not clear how representative this single example is. Try the following guess:

 

<?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="ident" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="modificationdate" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="remark" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="title" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="bylinetitle" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="captionwriter" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="modifieddate" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="source" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="date_amended" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="library_id" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="filed_under" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="id_objet" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
                <FIELD NAME="keywords" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
            </METADATA>
            <RESULTSET FOUND="">
                <xsl:for-each select="object_desc">
                    <ROW MODID="" RECORDID="">
                        <COL><DATA><xsl:value-of select="main_desc/ident"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="main_desc/modificationdate"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="main_desc/remark"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="main_desc/title"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="iptc/bylinetitle"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="iptc/captionwriter"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="iptc/modifieddate"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="iptc/source"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="extended_desc/date_amended"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="extended_desc/library_id"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="extended_desc/filed_under"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="extended_desc/id_objet"/></DATA></COL>
                        <COL><DATA><xsl:value-of select="keywords"/></DATA></COL>
                    </ROW>
                </xsl:for-each>
            </RESULTSET>
        </FMPXMLRESULT>
    </xsl:template>
</xsl:stylesheet>
  • Author

That worked a treat, thank you for your help, you've often provided answers on here that have helped me in the past too - just to let you that we appreciate what you do!

 

Cheers

R

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.