1 Reply Latest reply on Dec 16, 2013 2:24 PM by PeterBue

    Export to XML

    PeterBue

      Title

      Export to XML

      Post

           Hello Everyone,

           I'm trying to export fields from my database into an XML document. This XML document is being formatted using and XSL stylesheet. The output I'm getting when using this XSL is just plain text with an XML header at the top, and not all XML (Tags are missing).  Below is the XSL code. If anyone could tell me way it the output isn't XML I would appreciate it.

            

           <?xml version="1.0" encoding="ISO-8859-1"?>
           <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="row">
                   <xsl:for-each select="ROW">
                   <card id="42" effects="true">
                       <cells>
                           <cell position="A">
                               <asset></asset>
                               <caption></caption>
                           </cell>
                           <cell position="B">
                               <asset></asset>
                               <caption></caption>
                           </cell>
                           <cell position="C">
                               <asset></asset>
                               <caption></caption>
                           </cell>
                           <cell position="D">
                               <asset></asset>
                               <caption></caption>
                           </cell>
                       </cells>

                       <questions>
                           <question type="pick_1">
                               <text><xsl:value-of select="Pick1Question"/></text>
                               <answers><xsl:value-of select="Pick1Answer"/></answers>
                           </question>
                           <question type="pick_2">
                               <text><xsl:value-of select="Pick2Question"/></text>
                               <answers><xsl:value-of select="Pick2Answer"/></answers>
                           </question>
                           <question type="pick_3">
                               <text><xsl:value-of select="Pick3Question"/></text>
                               <answers><xsl:value-of select="Pick3Answer"/></answers>
                           </question>
                           <question type="solo_pick_1">
                               <text><xsl:value-of select="SoloPickQuestion"/></text>
                               <answers><xsl:value-of select="SoloPickAnswer"/></answers>
                           </question>
                           <question type="vote">
                               <text><xsl:value-of select="VOTING_QUESTION"/></text>
                               <answers></answers>
                           </question>
                       </questions>
                   </card>
                   </xsl:for-each>
               </xsl:template>
           </xsl:stylesheet>

        • 1. Re: Export to XML
          PeterBue

               For anyone that stumbles upon this post seeking answers to a similar question. Remove the filemaker namespace from the XML document, and normal XSLT xpath expressions will work on the export. You won't be able to apply XSLT directly to the file during export, because the namespace exists at the time of export. So export it in the format you want first, then delete the Filemaker Pro namespace from the XML header and from the root FMP tag in the document. After that you can do transforms using the web browser and linking the XSL stylesheet to the head of the XML document. Then just save the newly transform XML from the browser.