9 Replies Latest reply on Dec 1, 2013 4:35 AM by disabled_IowaFMGuy

    XSL help

      I need help creating an XSL style sheet so FileMaker can import it.

       

      Here is a snippet of the XML file...

       

      <?xml version='1.0' encoding='UTF-8'?><blocks>

      <block>

      <status>4.0.0</status>

      <created>2013-11-23 00:00:15</created>

      <reason>421 4.7.1 : (DYN:T1) http://postmaster.info.aol.com/errors/421dynt1.html (throttled)</reason>

      <email>person1@aol.com</email>

      </block>

      <block>

      <status>4.0.0</status>

      <created>2013-11-23 00:00:15</created>

      <reason>421 4.7.1 : (DYN:T1) http://postmaster.info.aol.com/errors/421dynt1.html (throttled)</reason>

      <email>anotherperson@aol.com</email>

      </block>

      <block>

      <status>4.0.0</status>

      <created>2013-11-23 00:00:26</created>

      <reason>421 4.7.1 : (DYN:T1) http://postmaster.info.aol.com/errors/421dynt1.html (throttled)</reason>

      <email>athird@aol.com</email>

      </block>

      </blocks>

       

      I have tried (many times) and keep getting XML/XSL information is not enough to proceed with import/export.

       

      Any help greatly appreciated!!

       

      Gary

        • 1. Re: XSL help
          mikebeargie

          Can you post a snippet of the XSLT you already wrote?

           

          Take a look in your Filemaker > English Extras > Examples > XML Examples > Imports folder, there's already a few XML/XSLT import sample files in there.

          1 of 1 people found this helpful
          • 2. Re: XSL help

            Thanks Mike,

             

            That helped find the problem. The example XSL file works with one exception. The "<?xml version='1.0' encoding='UTF-8'?>" at the start of the XML file is the problem. When I remove that it works fine.

             

            Since I am using a URL to retrieve the XML and want to automate this, I need to find a way around that.

            • 3. Re: XSL help
              beverly

              The beginning may not be the 'problem'. If you remove the line you may also be removing the invisible BOM (byte-order-mark) - research it.

               

              See if you can look at the file with a text editor that can reveal any invisible characters.

               

              -- sent from my iPhone4 --

              Beverly Voth

              --

              1 of 1 people found this helpful
              • 4. Re: XSL help

                Thanks Beverly,

                 

                It appears not to have the BOM...

                 

                HTML5  -  text/htmlInformation

                 

                Character encoding
                Code
                HTTP Content-TypeNo encoding information foundContent-Type: text/html
                Byte order mark (BOM)No
                XML declarationUTF-8<?xml version='1.0' encoding='UTF-8'?>
                Meta tagNone found
                Language
                Code
                HTML tagNone<html>
                HTTP Content-LanguageNone found
                Text direction
                Code
                Default directionLTR (by default)
                Class & id names
                Code
                Non-ascii class or id namesNone
                Non-NFC class or id namesNone
                Request headers
                Code
                Accept-Languageen-usAccept-Language: en-us
                Accept-CharsetNone found

                 

                • 5. Re: XSL help
                  beverly

                  Hey, Iowa! what did you use to get this information?

                   

                  Beverly

                  • 6. Re: XSL help

                    Actually two things, I used a text editor (TextMate) and looked at the invisables and just to be sure I ran it through http://validator.w3.org/i18n-checker/.

                    • 7. Re: XSL help
                      beverly

                      Thanks, you also said:

                      Since I am using a URL to retrieve the XML and want to automate this, I need to find a way around that.

                       

                       

                       

                      Can you expand that statement. How exact are you using an URL? Please be specific on script step(s) used and any other details that may be important. At what point are you applying the XSLT to the source XML, is it in the Import script step?

                       

                      Beverly

                      • 8. Re: XSL help

                        At this point I am still doing a manual process. Simply going to File>Import>XML Data Source... Then entering the URL of the download and attaching the XSL. When I download the file first, as when IU discovered that deletling

                        "<?xml version='1.0' encoding='UTF-8'?>" I get the exact same results.

                         

                        And yes it is in the import process. Here is the XSL that works after the first part is stripped.

                         

                        <?xml version="1.0" encoding="UTF-8"?>

                        <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

                        <!--

                        File: msdso_elem.xslt

                         

                         

                        Transforms data in an ELEMENT based MSDSO grammar

                        into the FMPXMLRESULT grammar, suitable for import.

                             

                        ===============================================================

                         

                         

                        Copyright © 2002 FileMaker, Inc.

                        All rights reserved.

                         

                         

                        Redistribution and use in source and binary forms, with or

                        without modification, are permitted provided that the following

                        conditions are met:

                         

                         

                        * Redistributions of source code must retain the above copyright

                          notice, this list of conditions and the following disclaimer.

                         

                         

                        * Redistributions in binary form must reproduce the above copyright

                          notice, this list of conditions and the following disclaimer in

                          the documentation and/or other materials provided with the

                          distribution.

                         

                         

                        * Neither the name of the FileMaker, Inc. nor the names of its

                          contributors may be used to endorse or promote products derived

                          from this software without specific prior written

                          permission.

                         

                         

                        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND

                        CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,

                        INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

                        MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.

                        IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR

                        ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

                        CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

                        SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR

                        BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,

                        WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING

                        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS

                        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

                           

                        ===============================================================

                        -->

                              

                                  <xsl:template match="/*">

                                            <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">

                                                      <ERRORCODE>0</ERRORCODE>

                                                      <PRODUCT BUILD="" NAME="" VERSION=""/>

                                                      <DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="{count(/*/*)}" TIMEFORMAT="h:mm:ss a"/>

                                                      <METADATA>

                                                                <xsl:for-each select="/*/*[position()=1]/*">

                                                                          <FIELD>

                                                                                    <xsl:attribute name="EMPTYOK">YES</xsl:attribute>

                                                                                    <xsl:attribute name="MAXREPEAT">1</xsl:attribute>

                                                                                    <xsl:attribute name="NAME"><xsl:value-of select="name()"/></xsl:attribute>

                                                                                    <xsl:attribute name="TYPE">TEXT</xsl:attribute>

                                                                          </FIELD>

                                                                </xsl:for-each>

                                                      </METADATA>

                                                      <RESULTSET>

                                                                <xsl:attribute name="FOUND"><xsl:value-of select="count(child::*)"/></xsl:attribute>

                                                                <xsl:for-each select="child::*">

                                                                          <ROW>

                                                                                    <xsl:attribute name="MODID">0</xsl:attribute>

                                                                                    <xsl:attribute name="RECORDID">0</xsl:attribute>

                                                                                    <xsl:for-each select="child::*">

                                                                                              <COL>

                                                                                                        <DATA>

                                                                                                                  <xsl:value-of select="."/>

                                                                                                        </DATA>

                                                                                              </COL>

                                                                                    </xsl:for-each>

                                                                          </ROW>

                                                                </xsl:for-each>

                                                      </RESULTSET>

                                            </FMPXMLRESULT>

                                  </xsl:template>

                        </xsl:stylesheet>


                        • 9. Re: XSL help

                          So here is how I solved this problem, kudos to Beverly Voth for her assistance, thank you!

                           

                          First I inserted the xml into a global.

                           

                          Then did a substitute for the offending "<?xml version='1.0' encoding='UTF-8'?>" with "".

                           

                          Then I exported the field contents to a file.

                           

                          Then I imported the file using the style sheet that Beverly pointed me to.

                           

                          It now works great.