4 Replies Latest reply on Oct 23, 2016 8:57 PM by user19752

    Export HTML Table and Hyperlinks

    bigtom

      I have done a bit of searching and I see the same question asked but no real answers.

       

      I want to have working hyperlinks in an exported HTML table. FM keeps encoding the text so the HTML code is not actually working properly. Is there an answer to this problem?

        • 1. Re: Export HTML Table and Hyperlinks
          beverly

          Are you exporting as HTML or calculating the HTML and exporting with Tab-separated, for example?

           

          Also export as XML can be transformed to HTML with an XSLT stylesheet.

           

          The last two could preserve your embedded tags.

           

          Sent from miPhone

          • 2. Re: Export HTML Table and Hyperlinks
            bigtom

            Have been simply exporting records as HTML, but need a link added now.

             

            I am having trouble with managing fmpxmlresult grammar in a stylesheet. I would rather not have calculated HTML in this case.

             

            beverly I do appreciate the advice.

            • 3. Re: Export HTML Table and Hyperlinks
              beverly

              Calculated HTML (in a field, for the anchor/link example) would convert the "<",">" & other characters if you use the Export (as HTML), as you may have discovered. So exporting like that is not optimum.

               

              However, you can calculate the row start to have TR and the row end to have /TR. plus each field would have the TD../TD. It's not too complex to create one calculation to include all your fields to export. Include TABLE before the first record and /TABLE after the end and you basically have the same thing, but with your hyperlink (if you export the one field, many records, as tab-separated).

               

              There is an example by Skeleton Key:

              that shows using ExecuteSQL() to make an HTML table using the proper tags.

               

              beverly

              • 4. Re: Export HTML Table and Hyperlinks
                user19752

                If you have link as whole data of some field, it would be easy, example XSL below exports 3rd field as link (or any html tags are exported without escaped).

                 

                But if your link is a part of field data, you should escape other parts yourself before export.

                 

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

                <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fmp">

                    <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>

                    <xsl:template match="fmp:FMPXMLRESULT">

                        <html>

                            <head>

                                <title><xsl:value-of select="fmp:DATABASE/@NAME"/></title>

                                <style type="text/css">

                                    table{border: solid black 1px; border-collapse: collapse;}

                                    th {border: solid black 1px; padding: 2px;}

                                    td {border: solid black 1px; padding: 2px;}

                                </style>

                            </head>

                            <body>

                                <table>

                                    <thead>

                                        <tr>

                                            <xsl:for-each select="fmp:METADATA/fmp:FIELD">

                                                <th align="middle">

                                                    <xsl:value-of select="@NAME"/>

                                                </th>

                                            </xsl:for-each>

                                        </tr>

                                    </thead>

                                    <tbody>

                                        <xsl:for-each select="fmp:RESULTSET/fmp:ROW">

                                            <tr>

                                                <xsl:for-each select="fmp:COL">

                                                    <td>

                                                        <xsl:choose>

                                                            <xsl:when test="position()=3">

                                                                <xsl:value-of select="fmp:DATA" disable-output-escaping="yes"/>

                                                            </xsl:when>

                                                            <xsl:otherwise>

                                                                <xsl:value-of select="fmp:DATA"/>

                                                            </xsl:otherwise>

                                                        </xsl:choose>

                                                    </td>

                                                </xsl:for-each>

                                            </tr>

                                        </xsl:for-each>

                                    </tbody>

                                </table>

                            </body>

                        </html>

                    </xsl:template>

                </xsl:stylesheet>