Jump to content

Import XML with XSL


CCBtx

This topic is 3588 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am getting an error importing my xml with my custom stylesheet.  Where am I going wrong?

 

I am importing the following xml:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<schools>
    <school>
        <name>Abraham Lincoln High School</name>
        <type>public</type>
        <enrollment>402</enrollment>
        <city>Denver</city>
        <state>CO</state>
        <districtId>55</districtId>
        <district>School District No. 1 In The County Of Denver And State Of C</district>
    </school>
    <school>
        <name>Academia Ana Marie Sandoval</name>
        <type>public</type>
        <enrollment>9</enrollment>
        <city>Denver</city>
        <state>CO</state>
        <districtId>55</districtId>
        <district>School District No. 1 In The County Of Denver And State Of C</district>
    </school>
</schools>

 

I am using this stylesheet:

 

<?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="no"/>
<xsl:template match="/">
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
    <ERRORCODE>0</ERRORCODE>
    <PRODUCT BUILD="" NAME="FileMaker" VERSION="ProAdvanced 12.0v2"/>
    <DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT=""/>
    <METADATA>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="name" TYPE="TEXT" />
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="type" TYPE="TEXT" />
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="enrollment" TYPE="TEXT" />
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="city" TYPE="TEXT" />
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="state TYPE="TEXT" />
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="districtId" TYPE="TEXT" />
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="district" TYPE="TEXT" />
    </METADATA>
    <RESULTSET FOUND="">
        <xsl:for-each select="./schools/school">
            <ROW RECORDID="" MODID="" >
                <COL><DATA><xsl:value-of select="name"/></DATA></COL>
                <COL><DATA><xsl:value-of select="type"/></DATA></COL>
                <COL><DATA><xsl:value-of select="enrollment/></DATA></COL>
                <COL><DATA><xsl:value-of select="city"/></DATA></COL>
                <COL><DATA><xsl:value-of select="state"/></DATA></COL>
                <COL><DATA><xsl:value-of select="districtId"/></DATA></COL>
                <COL><DATA><xsl:value-of select="district"/></DATA></COL>
            </ROW>
        </xsl:for-each>
    </RESULTSET>
</FMPXMLRESULT>
</xsl:template>
</xsl:stylesheet>
 

Link to comment
Share on other sites

I am getting an error importing my xml with my custom stylesheet.

 

1. Always post the exact error message you get. Also please use the "code" option when posting XML.

 

2. Mind your quotation marks: they need to be closed ( "state" on line 14, "enrollment" on line 23).

Link to comment
Share on other sites

This topic is 3588 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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