May 21, 2010; 13:49
Rev. Steve Willis
XML/XSLT Exporting Problem
Hi, all!
I'm trying to write an XSLT stylesheet that will take the convoluted XML export format generated by FMP and turn it into something usable by the rest of the world's standards. Unfortunately, all the tutorials I can find on w3schools.com and lynda.com focus on turning XML into HTML, whereas I'nm trying to transform one XML file into another one.
I'm using the supposedly deprecated FMDSORESULT XML grammar for the process because it is less convoluted and easier to use.
No matter what I do, my <xsl:for-each> tag doesn't work and I've beaten my head bloody against the wall trying figure out how I could screw up such a simple tag. Sheesh! :-(
Since the XSLT file is so short, I went ahead and included both it and a sanitized raw XML export snippet as well as the result I'm getting below:
<RAW FMP EXPORT XML SNIPPET>
<?xml version="1.0" encoding="UTF-8" ?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
<ERRORCODE>0</ERRORCODE>
<DATABASE>FMPDBNAME</DATABASE>
<LAYOUT></LAYOUT>
<ROW MODID="106" RECORDID="244">
<id>USA-ST-CITY-DG</id>
<name>Campus Name</name>
<status>Active</status>
</ROW>
<ROW MODID="29" RECORDID="245">
<id>USA-ST-CITY-CT</id>
<name>Campus Name</name>
<status>Pending</status>
</ROW>
</FMPDSORESULT>
</XML SNIPPET>
<MY XSLT CODE STARTS HERE>
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet
version ="1.0"
xmlns ="http://www.w3.org/1999/xml"
xmlns:xsl ="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template name="campuses" match="/">
<xsl:element name="campuses" namespace="http://www.lcus.edu/xmlnamespace">
<xsl:for-each select="/ROW">
<xsl:element name="campus">
<xsl:attribute name="campusid"><xsl:value-of select="id" /> </xsl:attribute>
<xsl:element name="name"> <xsl:value-of select="name" /> </xsl:element>
<xsl:element name="status"> <xsl:value-of select="status" /></xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
</MY XSLT CODE>
<RESULT>
<?xml version="1.0" encoding="UTF-8"?>
<campuses xmlns="http://www.lcus.edu/xmlnamespace"/>
</RESULT>
--
Rev. Steve Willis
Director of Software Development
Life Christian University
P.O. Box 272360
Tampa, Fl 33688
(520) 891-3721
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/FileMaker/Browse/
Manage your subscription: http://www.ListSearch.com/FileMaker/
May 20, 2011; 13:26
michiindc
Re: XML/XSLT Exporting Problem
May 22, 2011; 13:36
Mikhail Edoshin
Re: XML/XSLT Exporting Problem