FileMaker Server 7 Advanced Custom Web Publishing Guide
© 2004 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker is a trademark of FileMaker, Inc., registered in the U.S. and other countries, and ScriptMaker and the file folder logo are trademarks of FileMaker, Inc. FileMaker documentation is copyrighted. You are not authorized to make additional copies or distribute this documentation without written permission from FileMaker.
Contents Chapter 1 Introducing Custom Web Publishing About this guide Creating dynamic web sites with the Web Publishing Engine About Custom Web Publishing with XML About Custom Web Publishing with XSLT About the tools for developing XSLT stylesheets Web publishing requirements What is required to publish a database using Custom Web Publishing What web users need to access a Custom Web Publishing solution Connecting to the Internet or an intranet New features in Custom Web Publishing with XML and XSLT File
Custom Web Publishing Guide Accessing XML data via the Web Publishing Engine About namespaces for FileMaker XML About FileMaker database error codes Retrieving the document type definitions for the FileMaker grammars Using the fmresultset grammar Description of elements in the fmresultset grammar Example of XML data in the fmresultset grammar Using other FileMaker XML grammars Description of elements in the FMPXMLRESULT grammar Example of XML data in the FMPXMLRESULT grammar Description of elements in t
Contents 5 Using FileMaker XSLT stylesheets in a web site or program Troubleshooting XSLT stylesheets 45 46 Chapter 5 Developing FileMaker XSLT stylesheets Using XSLT stylesheets with the Web Publishing Engine About the FileMaker XSLT Extension Function Reference About the URL syntax for FileMaker XSLT stylesheets About the URL syntax for FileMaker container objects in XSLT solutions Using query strings in FileMaker XSLT stylesheets Specifying an XML grammar for a FileMaker XSLT stylesheet About namespa
Custom Web Publishing Guide Chapter 6 Testing and monitoring a site Testing a Custom Web Publishing site Examples of stylesheets for testing XML output Monitoring your site Using the web server access and error logs Using the Web Publishing Engine application log Using the Web Server Module error log Using Web Publishing Core internal access logs 71 71 72 72 73 73 73 Appendix A Valid names used in query strings About the query commands and parameters Obsolete request names and parameters Guidelines
Contents 7 –max (Maximum records) query parameter –modid (Modification ID) query parameter –recid (Record ID) query parameter –script (Script) query parameter –script.prefind (Script before Find) query parameter –script.presort (Script before Sort) query parameter –skip (Skip records) query parameter –sortfield (Sort field) query parameter –sortorder (Sort order) query parameter –styletype (Style type) query parameter –stylehref (Style href) query parameter –token.
Custom Web Publishing Guide
Chapter 1 Introducing Custom Web Publishing With FileMaker® Server 7 Advanced, you can publish FileMaker databases on the Internet or an intranet in these ways: 1 Custom Web Publishing using Extensible Markup Language (XML) 1 Custom Web Publishing using Extensible Stylesheet Language Transformations (XSLT) stylesheets 1 Instant Web Publishing. See the FileMaker Instant Web Publishing Guide.
Custom Web Publishing Guide About this guide This guide assumes you are experienced with XML and XSLT, developing web sites, and using FileMaker Pro to create databases.
Introducing Custom Web Publishing 11 1 Control and filtering of published data: By using XSLT stylesheets, you can control and filter the data and the type of database information you want to publish, which prevents unauthorized use of the database. You can also hide metadata, such as database and field names. 1 Based on open standards: You have more access to tools, resources and skilled personnel for Custom Web Publishing solutions.
Custom Web Publishing Guide Web publishing requirements What is required to publish a database using Custom Web Publishing To publish databases using Custom Web Publishing with XML or XSLT, the following are required: 1 1 1 1 1 1 a Windows- or Mac OS X-based computer running FileMaker Server, enabled for Custom Web Publishing one or more FileMaker Pro databases hosted by FileMaker Server the FileMaker Server Web Publishing Engine, installed and configured a web server, either Microsoft IIS on Windows
Introducing Custom Web Publishing 13 1 Like FileMaker Pro, access to data, layouts, and fields is based on the users’s account settings defined in the database’s access privileges. The Web Publishing Engine also supports several other security enhancements. See “Protecting your published databases” on page 18. 1 Web users can perform complex, multi-step scripts. About 70 script steps are now supported on the web. See the next section, “FileMaker scripts and Custom Web Publishing.
Custom Web Publishing Guide 1 If your scripts contain steps that are unsupported, for example, steps that are not web-compatible, use the Allow User Abort script step to determine how subsequent steps are handled. 1 If the Allow User Abort script step option is enabled (on), unsupported script steps will stop the script from continuing. 1 If Allow User Abort is off, unsupported script steps are skipped over and the script continues to execute.
Introducing Custom Web Publishing 15 Script step Behavior in Custom Web Publishing solutions Go to Field You cannot use Go to Field to make a particular field active in the web browser, but you can use this script step in conjunction with other script steps to perform tasks. For example, you can go to a field, copy the contents, go to another field and paste the value. To see the effect in the browser, be sure to save the record with the Commit Record script step.
Custom Web Publishing Guide Where to go from here Here are some suggestions for what to do and where to find information in the documentation to get started developing Custom Web Publishing solutions: 1 If you haven’t already done so, use FileMaker Server Administration and the Web Publishing Engine Administration Console to enable Custom Web Publishing. See FileMaker Server Administration Help and the FileMaker Server Advanced Web Publishing Installation Guide.
Chapter 2 Preparing databases for Custom Web Publishing Before you can use Custom Web Publishing with a database, there are some steps you must take to prepare the database and protect it from unauthorized access. Enabling Custom Web Publishing in a database You must enable Custom Web Publishing in each database you want to publish. You can individually enable either Custom Web Publishing with XML or Custom Web Publishing with XSLT, or you can enable both technologies in each database.
Custom Web Publishing Guide 1 If the Guest account is enabled and has a privilege set enabled that includes a Custom Web Publishing extended privilege, all web users automatically open the database with the access privileges assigned to the Guest account. If the Custom Web Publishing extended privilege is assigned to the Guest account: 1 Web users are not prompted for an account name and password when opening a file.
Preparing databases for Custom Web Publishing 19 About publishing the contents of container fields on the web The contents of a container field, such as an image file, can either be stored inside a FileMaker database, or stored as a file reference using a relative path. Note The Web Publishing Engine does not support movie file streaming. Web users must download an entire movie file before being able to view the movie.
Custom Web Publishing Guide
Chapter 3 Accessing XML data with the Web Publishing Engine You can obtain and update FileMaker data in Extensible Markup Language (XML) format by using the Web Publishing Engine. In the same way that HTML has become the standard display language for communication on the World Wide Web, XML has become the standard language for structured data interchange. Many individuals, organizations, and businesses use XML to transfer product information, transactions, inventory data, and other business data.
Custom Web Publishing Guide 1 The Web Publishing Engine can access data in a container field, but FileMaker Pro cannot. 1 The Web Publishing Engine provides real-time access to FileMaker data via HTTP or HTTPS, but FileMaker Pro cannot. Note For information on using FileMaker Pro to import and export data in XML format, see FileMaker Pro Help.
Accessing XML data with the Web Publishing Engine 23 To access XML data in a portal, set the view for the database layout to View as Form or View as List. If a user or script changes the view of the database layout to View as Table, only the first related record (first row of the portal) is accessible as XML data. 3.
Custom Web Publishing Guide 1 is optional and specifies the port that the web server is using. If no port is specified, then the default port for the protocol is used (port 80 for HTTP, or port 443 for HTTPS). 1 is the name of the FileMaker XML grammar. Possible values are fmresultset.xml, FMPXMLRESULT.xml, FMPXMLLAYOUT.xml, or FMPDSORESULT.xml. See “Using the fmresultset grammar” on page 27 and “Using other FileMaker XML grammars” on page 29.
Accessing XML data with the Web Publishing Engine 25 1 If a container field stores a file reference instead of an actual object, then the container field’s element contains a relative path that refers to the object. For example: /images/logo.jpg Note The referenced container object must be stored in the FileMaker Pro Web folder when the record is created or edited, and then copied or moved to a folder with the same relative location in the root folder of the web server software.
Custom Web Publishing Guide Depending on the grammar you specify in the URL request, the Web Publishing Engine will generate an XML document using one of the grammars. Each XML document contains a default XML namespace declaration for the grammar. See the next section, “About namespaces for FileMaker XML.” Use one of these grammars in your document or web page to display and work with FileMaker data in XML format.
Accessing XML data with the Web Publishing Engine 27 Using the fmresultset grammar The XML element names in this grammar use FileMaker terminology, and the storage of fields is separated from the type of fields. The grammar also includes the ability to identify summary, calculation, and global fields. To use the fmresultset grammar, specify the following name of the fmresultset grammar in the URL requesting the XML document from the Web Publishing Engine: fmresultset.xml For example: http://192.168.123.
Custom Web Publishing Guide The element represents a portal. Each related field in a portal is represented by the element contained within the element. If there are multiple related fields in a portal, the field definitions for the related fields are grouped within a single element.
Accessing XML data with the Web Publishing Engine 29 /fmi/xml/cnt/data.
Custom Web Publishing Guide To use the FMPXMLLAYOUT grammar, specify the following grammar name with the –view query command in the URL requesting the XML document from the Web Publishing Engine: FMPXMLLAYOUT.xml For example: http://192.168.123.101/fmi/xml/FMPXMLLAYOUT.xml?-db=employees&-lay=family&-view Note When specifying the FMPXMLRESULT and FMPXMLLAYOUT grammars, be sure to enter the grammar name in uppercase.
Accessing XML data with the Web Publishing Engine 31 Village Market Camille Pissarro /fmi/xml/cnt/data.
Custom Web Publishing Guide Example of XML data in the FMPXMLLAYOUT grammar The following is an example of XML data generated with the FMPXMLLAYOUT grammar. 0 PAGE 33Accessing XML data with the Web Publishing Engine 33 About UTF-8 encoded data All XML data generated by the Web Publishing Engine is encoded in UTF-8 (Unicode Transformation 8 Bit) format. This format compresses data from the standard Unicode format of 16 bits to 8 bits for ASCII characters. XML parsers are required to support Unicode and UTF-8 encoding.
Custom Web Publishing Guide Use this query command name To execute this command –findany Find a random record –layoutnames Retrieve names of all available layouts for a hosted and web-shared database –new New record –scriptnames Retrieve names of all available scripts for a hosted and web-shared database –view Retrieves layout information from a database if the FMPXMLLAYOUT grammar is specified.
Accessing XML data with the Web Publishing Engine 35 Switching layouts for an XML response The –lay query parameter specifies the layout you want to use when requesting XML data. Often, the same layout is appropriate for processing the data that results from the request. In some cases, you might want to search for data using a layout which contains fields that, for security reasons, don’t exist in another layout you want to use for displaying the results.
Custom Web Publishing Guide query parameters, which prevent the use of unauthorized query commands and query parameters, such as database names. See chapter 4, “Introduction to Custom Web Publishing with XSLT” and chapter 5, “Developing FileMaker XSLT stylesheets.
Chapter 4 Introduction to Custom Web Publishing with XSLT You can use FileMaker XSLT stylesheets to transform, filter, or format XML data for use in a web browser or in other programs and applications. This chapter introduces FileMaker XSLT stylesheets and two tools to help you get started creating XSLT stylesheets—the Site Assistant and the CDML Converter. For more detailed information about how FileMaker XSLT stylesheets are constructed, see chapter 5, “Developing FileMaker XSLT stylesheets.
Custom Web Publishing Guide Getting started using Custom Web Publishing with XSLT If you know standard XML and XSLT, then you can immediately start using the Web Publishing Engine after learning a few unique details about FileMaker XML and XSLT, such as how to use the FileMaker-specific XSLT extension functions and query commands and parameters. The Site Assistant and the CDML Converter are tools to help you get started creating stylesheets and learn how they are constructed.
Introduction to Custom Web Publishing with XSLT 39 General steps for using Custom Web Publishing with XSLT Here is a summary of the steps for using Custom Web Publishing with XSLT: 1. In the Web Publishing Engine Administration Console, make sure XSLT Publishing is enabled. See the FileMaker Server Advanced Web Publishing Installation Guide. 2.
Custom Web Publishing Guide Using the FileMaker Site Assistant to generate FileMaker XSLT stylesheets The FileMaker Site Assistant is an application you can use to create basic XSLT stylesheets as a starting point for use with Custom Web Publishing with XSLT. The Site Assistant is a good way to learn how FileMaker XSLT stylesheets are constructed. You can then use your own XSLT stylesheet authoring or text editing tools to modify the stylesheets as necessary.
Introduction to Custom Web Publishing with XSLT 41 Starting the Site Assistant To start the Site Assistant, do one of the following: 1 Double-click the FileMaker Site Assistant application icon. 1 Windows: Click the Start button, and choose FileMaker Site Assistant from the Programs menu. FileMaker Site Assistant Using the Site Assistant For detailed information and step-by-step procedures for using the Site Assistant, see the Site Assistant Help.
Custom Web Publishing Guide 1 The element is used to access query information in a request or HTML form data. For example, this element can be used in the Site Assistant stylesheets to access the current request query information to determine the current location in a found set of records and to create links to the previous and next record. See “Accessing the query information in a request” on page 55.
Introduction to Custom Web Publishing with XSLT 43 Starting and using the CDML Converter Important It is recommended that you first copy all of the files from the cdml_format_files folder (if you chose to use it) and all of the files from your FileMaker Pro Web folder to a temporary working folder, and do the conversion processing on the copied files. Note When converting a source file to an XSLT stylesheet, the CDML Converter keeps the same filename but changes the filename extension to .xsl.
Custom Web Publishing Guide 6. Locate and select the folder where you want to save the XSLT stylesheets on your hard disk, then click Select. 7. Click Start. The CDML Converter converts the CDML format files and saves a conversion log with the converted XSLT stylesheets in the destination folder you specified. The conversion log is also shown in the CDML Converter window. 8. Click Done.
Introduction to Custom Web Publishing with XSLT 45 1 If the converted XSLT stylesheets include a FileMaker date or time extension function, such as fmxslt:get_date(), then the function uses the configured locale for FileMaker Server. See “Using the date, time, and day extension functions” on page 66. After conversion, you must manually change and localize date and time formatting strings that are passed to these functions, such as changing Month/Day/Year to Day/Month/Year.
Custom Web Publishing Guide Note For web sites, it’s a good practice to include an XSLT stylesheet as a home page that doesn’t require users to enter a query string to access it. The Site Assistant can create a home.xsl that doesn’t require a query string because it uses the processing instruction. For example, if you copied your stylesheets (including a home.
Chapter 5 Developing FileMaker XSLT stylesheets This chapter contains information about how FileMaker XSLT stylesheets are constructed and how to use the FileMaker XSLT extension functions. Using XSLT stylesheets with the Web Publishing Engine When developing and using XSLT stylesheets to request FileMaker XML data via the Web Publishing Engine, be aware of the following points: 1 To use an XSLT stylesheet with the Web Publishing Engine, you must specify the name of the XSLT stylesheet in a URL.
Custom Web Publishing Guide About the FileMaker XSLT Extension Function Reference The FileMaker Server Advanced CD includes a FileMaker database called XSLT Reference.fp7 that contains brief descriptions and examples of each of the FileMaker XSLT extension functions. You can open the FileMaker XSLT Extension Function Reference in the Custom Web Publishing Reference folder on the FileMaker Server Advanced CD.
Developing FileMaker XSLT stylesheets 49 For example: /fmi/xsl/cnt/data.jpg?-db=products&-lay=sales&-field=product_image(1)&-recid=2 Note In the generated XML for a container field, the value for the -field query parameter is a fully qualified field name. The number in the parentheses indicates the repetition number for the container field, and is generated for both repeating and non-repeating fields. See “About the syntax for a fully qualified field name” on page 77.
Custom Web Publishing Guide Specifying an XML grammar for a FileMaker XSLT stylesheet The recommended XML grammar to use with Custom Web Publishing with XSLT is the fmresultset grammar, which has been designed for ease of use with XSLT. See “Using the fmresultset grammar” on page 27. You can also use the older FMPXMLRESULT or FMPXMLLAYOUT grammars. To access value lists and field display information in layouts, you must use the FMPXMLLAYOUT grammar. See “Using other FileMaker XML grammars” on page 29.
Developing FileMaker XSLT stylesheets 51 Using statically defined query commands and query parameters You can prevent the unauthorized use of query commands and query parameters with your FileMaker XSLT stylesheet by statically defining the query commands and parameters that you want to use when XML data is requested.
Custom Web Publishing Guide Setting text encoding for requests The Web Publishing Engine performs the following steps in the order shown until it determines the encoding of an XSLT request: 1. Checks if the charset attribute is set in the Content-Type request header. 2. Checks if you specified an encoding with the –encoding query parameter. You can specify this parameter in a URL or as a statically defined query parameter in the processing instruction.
Developing FileMaker XSLT stylesheets 53 Specifying an output method and encoding You can specify an output method and encoding of output pages by using the method and encoding attributes of the element. Both of these attributes are optional. The method attribute specifies the type of output, which can be “html”, “text”, or “xml”. No other method types are supported. If you don’t specify a method, the Web Publishing Engine uses the “html” method.
Custom Web Publishing Guide Using tokens to pass information between stylesheets You can use the –token query parameter in a URL or as a statically defined query command to pass any user-defined information between stylesheets without using sessions or cookies. The –token query parameter is optional with all query commands. The user-defined parameter value can be any character string that is URL encoded. For example: http://192.168.123.101/fmi/xsl/template/my_stylesheet.
Developing FileMaker XSLT stylesheets 55 Accessing the query information in a request You can use a FileMaker XSLT parameter to access query information in a request in a URL or HTML form data. For example, you can access the current request query information to determine the current location in a found set of records, and create links to the previous and next record.
Custom Web Publishing Guide Obtaining client information You can use the following FileMaker XSLT parameters to obtain information from the Web Publishing Engine about a web client’s IP address, user name, and password: Include these parameter statements in your XSLT stylesheet before the top element.
Developing FileMaker XSLT stylesheets 57 Loading additional documents To load an additional XML document during the processing of an XSLT stylesheet, use the standard XSLT document() function with a URI to the XML document. The document() function returns the requested XML as a node-set that can be stored in an element. To load an XML document that contains data from a FileMaker database, use the document() function with FileMaker query command and parameters.
Custom Web Publishing Guide For example, suppose you wanted to create a pull down menu for a field named Color that is populated with the values from a value list named shirts that are defined in a layout in a FileMaker database. Here’s how you can use the document() function to load the layout information into a XSLT variable: PAGE 59Developing FileMaker XSLT stylesheets 59 By default, the Web Publishing Engine will use a cookie to store the session ID. To accommodate clients that do not allow cookies, you can use the fmxslt:session_encode_url() function to add the Session ID to the URL. To guarantee compatibility in all situations, it is recommended that you encode all URLs written out to the page with the fmxslt:session_encode_url() function.
Custom Web Publishing Guide Session extension function fmxslt:set_session_object(String session-name, String name, Object value) Data type returned Description XSLT object (number, string, boolean, or node-set) Stores an XSLT object (a number, string, boolean, or node-set) under a session, which can be later retrieved using the fmxslt:get_session_object () function. This function also returns the previously stored object under the specified session object name.
Developing FileMaker XSLT stylesheets 61 Sending email messages from the Web Publishing Engine You can use the Web Publishing Engine to generate email messages, which is useful for custom web solutions. To have the Web Publishing Engine send an email message, use one of the following three fmxslt:send_email () extension functions in an XSLT stylesheet. You can use these functions to send one or more separate messages.
Custom Web Publishing Guide 1 The individual values for the smtpFields parameter, such as the subject, must be a URL-encoded string. For example, the “&” character must be specified as “&” and blank spaces must be specified as “%20”. The entire string for the smtpFields parameter must be XML-encoded. (See the example at the end of this section.) 1 For each of these functions, a value of true() is returned if the email message is successfully sent; otherwise false() is returned.
Developing FileMaker XSLT stylesheets 63 Notes 1 The name used in the fmxslt:get_header() and fmxslt:set_header() functions, and the value in the fmxslt:set_header() function can be a string of any length. 1 The fmxslt:set_header() function and the fmxslt:set_status_code() function require the processing instruction. See “Using content buffering” on page 58. The following example demonstrates how to set the value of the header. Suppose you are using a stylesheet to output a vCard.
Custom Web Publishing Guide Using the string manipulation extension functions You can use the string manipulation functions to change the encoding of strings of any length. String manipulation extension function Data type returned fmxslt:break_encode(String value) string Description Returns an HTML break-encoded string. Characters such as “&” (ampersand) are replaced with “&”. New line characters such as line feeds and carriage returns are replaced with
.
Developing FileMaker XSLT stylesheets 65 String manipulation extension function Data type returned fmxslt:url_decode(String value, String encoding) string Description Returns a URL-decoded string using the character encoding you specify for the encoding parameter, which can be: US-ASCII, ISO-8859-1, ISO-8859-15, ISO2022-JP, Shift_JIS or UTF-8. Use this function in situations where you must specify the character encoding used in a URL encoded string in order to decode the string properly.
Custom Web Publishing Guide [ ] Large If a user selected Red only, then the field would contain the string “Red.” To determine whether the field contains “Blue”, you could use the following function call: fmxslt:contains_checkbox_value(,'Blue') where is the XPath to the element for the checkbox field. The function would return “false” in this example.
Developing FileMaker XSLT stylesheets 67 1 Long day format is: EEEE (in all locales) For example: “Sunday” Date, time, day extension function Data type returned Description fmxslt:get_date() string Returns the current date in the short format. fmxslt:get_date(String format) string Returns the current date in the format you specify. Enter the string “short” or “long” for the format parameter. fmxslt:get_time() string Returns the current time in the short format.
Custom Web Publishing Guide The functions in the following table use custom date formatting strings that specify a date and time format. See the next section, “About the date and time format strings.” Date, time, day extension function Data type returned Description fmxslt:get_datetime(String dateFormat) string Returns the current date and time using the date and time format strings.
Developing FileMaker XSLT stylesheets 69 Letter Date or Time Component Presentation Examples z Time zone General time zone Pacific Standard Time; PST; GMT-08:00 Z Time zone RFC 822 time zone -0800 Pattern letters are usually repeated, as their number determines the exact presentation: 1 Text: For formatting, if the number of pattern letters is four or more, the full form is used; otherwise a short or abbreviated form is used if available.
Custom Web Publishing Guide The following examples show how date and time patterns are interpreted in the U.S. locale. The given date and time are 2001-07-04 12:08:56 local time in the U.S. Pacific Time time zone. Date and Time Pattern Result "yyyy.MM.dd G 'at' HH:mm:ss z" 2001.07.04 AD at 12:08:56 PDT "EEE, MMM d, ' 'yy" Wed, Jul 4, '01 "h:mm a" 12:08 PM "hh 'o' 'clock' a, zzzz" 12 o'clock PM, Pacific Daylight Time "K:mm a, z" 0:08 PM, PDT "yyyyy.MMMMM.dd GGG hh:mm aaa" 02001.July.
Chapter 6 Testing and monitoring a site Test your Custom Web Publishing site before deploying it. You can use log files to monitor the site during testing or after deployment. Testing a Custom Web Publishing site Before notifying users that your Custom Web Publishing site is available, it is important to verify that it looks and functions as you expect. 1 Test features like finding, adding, deleting, and sorting records with different accounts and privilege sets.
Custom Web Publishing Guide 1 When debugging a stylesheet, you can use the following example of an HTML
Custom Web Publishing Guide The internal access logs are generated if the Access Logging option is enabled in the Web Publishing Engine. The default setting is enabled. For information on setting the Access Logging option via the Administration Console, see the FileMaker Server Advanced Web Publishing Installation Guide.
Appendix A Valid names used in query strings This appendix describes the valid names of query commands and parameters you can use in a query string when accessing FileMaker data using the Web Publishing Engine. About the query commands and parameters The following is a complete list of the query command names and query parameter names: Query command names Query parameter names –dbnames (See page 79.) –db (See page 82.) –delete (See page 79.) –encoding (XSLT only) (See page 82.) –dup (See page 79.
Custom Web Publishing Guide Obsolete request names and parameters The following request name and parameters are no longer supported: Obsolete request names Comment –dbopen Opened a database that was in the Web folder with Remote Administration enabled. –dbclose Closed a database that’s in the Web folder with Remote Administration enabled. –img Retrieved the specified image. Use a container URL instead.
Valid names used in query strings 77 1 Database names, layout names, and field names used in query strings are case insensitive, such as –lay=mylayout to specify MyLayout. Note Field and database names that are used in XSLT statements outside of query strings are case sensitive and must exactly match the actual names used in the database.
Custom Web Publishing Guide For example, the following URL adds a new parent Employee record for John Doe, and a new related record for Jane in the portal at the same time. The name of the related table is Dependents, and the name of the related field in the portal is Names. The match field, ID, stores an employee ID number. http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=family&FirstName=John&LastName=Doe&ID=9756 &Dependents::Names.
Valid names used in query strings 79 For example: http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=departments&Country.global=USA&-edit Note When you use the –edit command to set the value of a global field, you don’t need to use the –recid parameter if you are only setting the global field value with that request.
Custom Web Publishing Guide –edit (Edit record) query command Updates the record specified by the –recid parameter, populating the fields with the contents of any field name/ value pairs. The –recid parameter indicates which record should be edited. Required query parameters: –db, –lay, –recid, one or more field name(s) Optional query parameter: –modid, –script Note For information on editing records in a portal, see “Editing records in a portal” on page 78. Example: To edit a record: http://192.168.
Valid names used in query strings 81 –new (New record) query command Creates a new record and populates that record with the contents of any field name/value pairs Required query parameters: –db, –lay Optional query parameter: one or more field name(s), –script Note For information on including new data for a portal, see “Adding records to a portal” on page 77. Example: To add a new record: http://192.168.123.101/fmi/xml/fmresultset.
Custom Web Publishing Guide Using the query parameters This section contains information about the query parameters available for XML and XSLT requests. For information on parameters that are only available for XSLT requests, see “Using query strings in FileMaker XSLT stylesheets” on page 49.
Valid names used in query strings 83 Required with: –edit query command Optional with: –new and –find query commands Example: http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=departments&-op=eq&FirstName=Sam&-max=1 &-find fieldname.op (Comparison operator) query parameter Specifies the comparison operator to apply to the field name that precedes the operator. Comparison operators are used with the –find query command. Value is: The operator you want to use.
Custom Web Publishing Guide –grammar (Grammar for XSLT stylesheets) query parameter Specifies the grammar to use for an XSLT stylesheet. This query command can only be used with Custom Web Publishing with XSLT requests. Value is: fmresultset, FMPXMLRESULT or FMPXMLLAYOUT Required with: All XSLT requests Example: http://192.168.123.101/fmi/xsl/my_template/my_stylesheet.
Valid names used in query strings 85 –max (Maximum records) query parameter Specifies the maximum number of records you want returned Value is: A number, or use the value all to return all records. The value all must be specified in lowercase. If –max is not specified, all records are returned. Optional with: –find or –findall query commands Examples: http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=departments&-max=10&-findall http://192.168.123.101/fmi/xml/fmresultset.
Custom Web Publishing Guide –script.prefind (Script before Find) query parameter Specifies the FileMaker script to run before finding and sorting of records (if specified) during processing of the –find query command Value is: Script name Optional with: all query commands, except –dbnames, –layoutnames, –process, and –scriptnames Example: http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=departments&-script.prefind=myscript&-findall –script.
Valid names used in query strings 87 –sortorder (Sort order) query parameter Indicates the direction of a sort Value is: The sort order.
Custom Web Publishing Guide –stylehref (Style href) query parameter Generates an XML-stylesheet processing instruction within the output document—setting the value of the href attribute (href=/mystylesheet.css or href=/stylesheets/mystylesheet.xsl)—so you can use client-side, cascading stylesheets (CSS) or XSLT stylesheets with your XML document. The value of the -stylehref parameter must use an absolute path. The name of the stylesheet can be any name but it must contain an extension of either .
Appendix B Error codes for Custom Web Publishing The Web Publishing Engine supports three types of error codes that can occur for Custom Web Publishing: 1 Database and query string errors: The Web Publishing Engine generates an error code for a published database whenever an XML data request occurs. For information, see the next section, “Error code numbers for FileMaker databases.
Custom Web Publishing Guide Error Number Description 6 File is read-only 7 Running out of memory 8 Empty result 9 Insufficient privileges 10 Requested data is missing 11 Name is not valid 12 Name already exists 13 File or object is in use 14 Out of range 15 Can’t divide by zero 16 Operation failed, request retry (for example, a user query) 17 Attempt to convert foreign character set to UTF-16 failed 18 Client must provide account information to proceed 19 String contains ch
Error codes for Custom Web Publishing 91 Error Number Description 204 No access to field(s) in sort order 205 User does not have access privileges to create new records; import will overwrite existing data 206 User does not have password change privileges, or file is not modifiable 207 User does not have sufficient privileges to change database schema, or file is not modifiable 208 Password does not contain enough characters 209 New password must be different from existing one 210 User accou
Custom Web Publishing Guide Error Number Description 501 Time value does not meet validation entry options 502 Number value does not meet validation entry options 503 Value in field is not within the range specified in validation entry options 504 Value in field is not unique as required in validation entry options 505 Value in field is not an existing value in the database file as required in validation entry options 506 Value in field is not listed on the value list specified in validati
Error codes for Custom Web Publishing 93 Error Number Description 727 There are more records in the target table than in the import file. Not all records were updated 729 Errors occurred during import. Records could not be imported 730 Unsupported Excel version. (Convert file to Excel 7.
Custom Web Publishing Guide Error Number Description 904 Command can only be used in a file hosted under FileMaker Server 905 No active field selected; command can only be used if there is an active field 920 Can’t initialize the spelling engine 921 User dictionary cannot be loaded for editing 922 User dictionary cannot be found 923 User dictionary is read-only 951 An unexpected error occurred 954 Unsupported XML grammar 955 No database name 956 Maximum number of database sessions
Error codes for Custom Web Publishing 95 Error Number Description 1223 The function referred to does not exist 1400 ODBC driver initialization failed; make sure the ODBC drivers are properly installed.
Custom Web Publishing Guide Here is a partial list of the Web Publishing Engine error code values: Error code value Description QUERY-ER0001 No XML grammar was specified in the –grammar query parameter QUERY-ER0002 “xxx” is not a valid XML grammar for FileMaker XSLT FILE-ER0001 The requested stylesheet file could not be found FILE-ER0002 The requested file could not be found UNKNOWN An unexpected error has occurred MCS-000 to MCS-600 An unexpected error has occurred MCS-601 The resource
Error codes for Custom Web Publishing 97 Error code numbers for the FileMaker XSLT extension functions The fmxslt:check_error_status() extension function (see “Checking the error status of extension functions” on page 70), returns one of the errors in the following table: Error code value Description -1 Unknown error 0 No error General Errors 10000 Invalid header name 10001 Invalid HTTP status code Session Errors 10100 Unknown session error 10101 Requested session name is already used 10102
Custom Web Publishing Guide Error code value Description Formatting Errors 10300 Unknown formatting error 10301 Invalid date time format 10302 Invalid date format 10303 Invalid time format 10304 Invalid day format 10305 Improperly formatted date time string 10306 Improperly formatted date string 10307 Improperly formatted time string 10308 Improperly formatted day string 10309 Unsupported text encoding 10310 Invalid URL encoding 10311 Regular expression pattern error
Appendix C Converting CDML solutions to FileMaker XSLT This appendix explains the results of using the FileMaker CDML Converter to convert CDML format files to FileMaker XSLT stylesheets. For information on using the FileMaker CDML Converter, see “Using the FileMaker CDML Converter” on page 42. Note In this appendix and in the generated comments in converted XSLT stylesheets, the term “XSLT-CWP” refers to FileMaker Custom Web Publishing with XSLT.
Custom Web Publishing Guide 1 inserts the following declarations for the namespaces, XSLT parameters, and variables that are used in a stylesheet. The declarations are inserted before and after the converted XSLT-CWP statements: PAGE 101Converting CDML solutions to FileMaker XSLT 101 Conversion of CDML action tags, variable tags, and URLs To convert CDML action tags, variable tags, and URLs, the CDML Converter does the following: 1 The CDML Converter does not change unidentified tag names that are preceded by a dash (–). Unidentified tag names in a URL are moved to the end of the query string.
Custom Web Publishing Guide 1 If a CDML request does not specify a –max query parameter for a –find or –findall query command, the CDML Converter adds –max=25 to the converted XSLT request. The CDML Converter uses the value 25 to create the same behavior as the original CDML request in which 25 records are returned if the –max query parameter is not specified.
Converting CDML solutions to FileMaker XSLT 103 The converted format.xsl stylesheet contains the following statements: PAGE 104Custom Web Publishing Guide Conversion of supported CDML action tags Here’s how the CDML Converter handles the conversion of the following supported CDML action tags: This CDML action tag Is converted to this XSLT-CWP query parameter with no change in syntax -delete -delete -dup -dup -edit -edit -find -find -findall -findall -findany -findany -new -new -view -view -dbnames -dbnames -layoutnames -layoutnames -scriptnames -scriptnames Conversion of obsolete CDML variable tags Her
Converting CDML solutions to FileMaker XSLT 105 This obsolete CDML variable tag Is replaced with this comment after the original variable tag location -mailto -password Conversion of supported CDML variable tags Here’s how the CDML Converter handles the conversion of the following supported CDML variable tags: This CDML variable tag
Custom Web Publishing Guide This CDML variable tag Is converted to this XSLT-CWP query parameter Description -token -token no change to syntax -token.NUMBER -token.NUMBER no change to syntax no change to syntax Conversion of CDML boolean parameters to XPath boolean parameters CDML boolean expressions, which are used within [FMP-If] and [FMP-ElseIf] intratag parameters, are composed of parameters and operators that the CDML Converter converts to XPath expressions.
Converting CDML solutions to FileMaker XSLT 107 Conversion of CDML boolean operators to XPath This CDML boolean operator Is converted to this XPath boolean operator x .and. y x and y x .or. y x or y x .xor. y (x or y) and not (x and y) x .eq. y x=y x .neq. y x != y x .gt. y x > y x .gte. y x >= y x .lt. y x < y x .lte. y x <= y x .cn. y contains(x, y) x .ncn.
Custom Web Publishing Guide Manually fixing CDML conversion errors There are some situations where the CDML Converter cannot automatically determine the correct conversion from CDML to XSLT. For these types of situations, you must use a text editor or XSLT stylesheet editor to manually fix the problems in the converted XSLT stylesheets: 1 In FileMaker Pro, script names are limited to 100 characters. During database conversion, any script names over this limit are truncated in the database.
Converting CDML solutions to FileMaker XSLT 109 1 In CDML, you could compare fields without including the field attribute. For example, you could use either [FMP-If: myfield.eq.10] or [FMP-If: field:myfield.eq.10]. In this example, because the field attribute is not included in the comparison, the CDML Converter converts myfield as a string literal instead of a field name. For example, after conversion, this CDML statement: [FMP-If: myfield.eq.
Custom Web Publishing Guide To avoid conversion problems resulting from the preceding example, change the CDML source code as follows: [FMP-If: currentdatabase.eq.Customers.fp5] [FMP-Else] [/FMP-If]
Converting CDML solutions to FileMaker XSLT 111 After conversion of this example, there are fewer elements in the checkoutform because the –format tag has been removed. To fix this example, you must manually change the JavaScript to check document.checkoutform.elements[2] rather than document.checkoutform.elements[3]. 1 The expression evaluation logic in CDML is different from the logic in XSLT.
Custom Web Publishing Guide CDML tag name: Client Address Tag is replaced with the current web client’s IP address CDML syntax: [FMP-ClientAddress] XSLT-CWP conversion: 1 when inside SGML element attribute value: {$client-ip} 1 otherwise: Conversion example Original CDML: Your address is: [FMP-ClientAddress] Converted XSLT-CWP: Your address is: Converted Result: Your address is: 192.168.123.
Converting CDML solutions to FileMaker XSLT 113 CDML tag name: Client Type Tag is replaced with the current browser client type CDML syntax: [FMP-ClientType] XSLT-CWP conversion: 1 when inside SGML element attribute value: {fmxslt:get_header('User-Agent')} 1 otherwise: Conversion example Original CDML: Your browser type is: [FMP-ClientType] Converted XSLT-CWP: Your browser type is: Conve
Custom Web Publishing Guide CDML tag name: Cookie Tag is replaced with the current value of the specified cookie CDML syntax: [FMP-Cookie: CookieName, Encoding], where Encoding is 'Raw' (default), or 'URL' XSLT-CWP conversion: 1 when inside SGML element attribute value: {fmxslt:get_cookie('CookieName')} 1 otherwise: Conversion example Original CDML: Thanks for coming back! The latest products in [FMP-Cookie: ColorChoice] are listed below Con
Converting CDML solutions to FileMaker XSLT 115 CDML tag name: Current Database Tag is replaced with the name of the database being processed CDML syntax: [FMP-CurrentDatabase: Encoding], where Encoding is 'Raw', 'URL', or 'HTML' (default).
Custom Web Publishing Guide CDML tag name: Current Day Tag is replaced with the name of the current day of the week CDML syntax: [FMP-CurrentDay: Format], where Format is 'Short' (default), or 'Long' XSLT-CWP conversion: 1 1 1 1 when inside SGML element attribute value, 'Short': {fmxslt:get_day('short')} or, 'Long': {fmxslt:get_day('long')} otherwise, 'Short': or, 'Long': Conversion example Original C
Converting CDML solutions to FileMaker XSLT 117 XSLT-CWP conversion: 1 ... 1 if inside an SGML tag/attribute, 1 if used in document, $current-find variable is created at top-level using named template from the cdml2xsl_utilities.
Custom Web Publishing Guide CDML tag name: Current Found Count Tag is replaced with the total number of records in the current found set CDML syntax: [FMP-CurrentFoundCount] XSLT-CWP conversion: 1 when inside SGML element attribute value: {fmrs:fmresultset/fmrs:resultset/@count} 1 otherwise: Conversion example Original CDML: Record(s) in found set: [FMP-CurrentFoundCount] Converted XSLT-CWP: Record(s) in found set:
Converting CDML solutions to FileMaker XSLT 119 CDML tag name: Current Max Tag is replaced with the maximum number of records that was specified CDML syntax: [FMP-CurrentMax] XSLT-CWP conversion: 1 when inside SGML element attribute value: {$current-max} 1 otherwise: 1 if used in document, $current-max variable is created at top-level using named template from the cdml2xsl_utilities.xsl stylesheet.
Custom Web Publishing Guide Conversion example Converted XSLT-CWP:
Custom Web Publishing Guide Conversion example Converted Result:
Converting CDML solutions to FileMaker XSLT 125 CDML tag name: Else Tag is replaced with the specified data if the preceding [FMP-If] BooleanExpression is false CDML syntax: [FMP-If: BooleanExpression1]...[FMP-Else]...[/FMP-If] XSLT-CWP conversion: 1 ......
Custom Web Publishing Guide Conversion example Converted XSLTCWP: United States of America Italy Converted Result: Italy CDML tag name: Field Tag is replaced with the contents of the specified field CDML syntax: [FMP-Field: FieldName, Encoding], where Encoding
Converting CDML solutions to FileMaker XSLT 127 CDML tag name: Field Name Tag is replaced with the name of the current field. This is always found within a [FMP-LayoutFields] loop.
Custom Web Publishing Guide CDML tag name: Find Field Item Tag is replaced with the field name that was part of the find request that created this page. This is always found within a [FMP-CurrentFind] loop.
Converting CDML solutions to FileMaker XSLT 129 CDML tag name: Find Operator Item Tag is replaced with the search operator that was part of the find request that created this page. This is always found within a [FMP-CurrentFind] loop.
Custom Web Publishing Guide CDML tag name: Find Value Item Tag is replaced with the value that was part of the find request that created this page. This is always found within a [FMP-CurrentFind] loop.
Converting CDML solutions to FileMaker XSLT 131 CDML tag name: Header The HTTP header of the page sent to the browser is replaced with the text between the [FMP-Header] and [/ FMP-Header] tags. None of the text between the tags will appear in the HTML portion of the page. CDML syntax: [FMP-Header]...
Custom Web Publishing Guide CDML tag name: Image Tag is replaced with a container URL reference to the image in the specified field CDML syntax: [FMP-Image: FieldName] XSLT-CWP conversion: 1 when current context is a record: 1 otherwise:
Converting CDML solutions to FileMaker XSLT 133 CDML tag name: Include Field Tag is replaced with the contents of a field, usually a text field that contains an HTML format file CDML syntax: [FMP-IncludeField: FieldName] XSLT-CWP conversion: 1 Conversion example Original CDML: [FMP-IncludeField: errorPage] Converted XSLT-CWP: Converted Result: PAGE 147Converting CDML solutions to FileMaker XSLT 147 Conversion example Converted Result: Production Sales Support CDML tag name: Value List Item Tag is replaced with the next element of a value list. This is always found within a [FMP-ValueList] loop.
Custom Web Publishing Guide CDML tag name: Value Name Item Tag is replaced by the name of a value list. This is always found within a [FMP-ValueNames] loop.
Converting CDML solutions to FileMaker XSLT 149 CDML tag name: Value Names Repeats the HTML between [FMP-ValueNames] and [/FMP-ValueNames] for all the value lists that are in the database. CDML syntax: [FMP-ValueNames]...[/FMP-ValueNames] Note To be converted properly, the "[FMP-ValueNames]" CDML tag requires field(s) on the layout that reference the specified value list(s). XSLT-CWP conversion: 1 ...
Custom Web Publishing Guide
Index A access log files for web server, described 72 access privileges 18 accounts and privileges enabling for Custom Web Publishing 17 Guest account 18 scripts 13 Administration Console for Web Publishing Engine 16, 18, 22, 39 application log 70, 73 ASCII characters, in XML documents 33 authenticated base URI parameter 56 authentication of web users 17, 56, 57 B base URI parameter 56 Basic Authentication for web users 17, 56 break_encode() extension function 64 buffering, using in stylesheet 58 C CDML c
Custom Web Publishing Guide elements database error code 26 in FMPXMLLAYOUT grammar 31 in FMPXMLRESULT grammar 30 in fmresultset grammar 27 email messages extension functions for 61 initial default encoding setting 52 embedded forms 109 enabling Custom Web Publishing in database 17 encoding -encoding query parameter 52, 82 output via element 53 requests 52 URLs 25, 59 using string manipulation extension functions 64 XML data 26, 33 XSLT stylesheets 53 -encoding query parameter 82
Index get_header() extension function 62 get_long_date_format() extension function 67 get_long_day_format() extension function 67 get_long_time_format() extension function 67 get_session_object() extension function 60 get_short_date_format() extension function 67 get_short_day_format() extension function 67 get_short_time_format() extension function 67 get_time() extension function 67 GIF files, publishing on web 19 global fields database sessions, enabling 60, 79 syntax of 78 using with sessions 60, 79 -g
Custom Web Publishing Guide passwords access to XML documents 57 Basic Authentication for web users 17, 56 Change Password script 18 defining for Custom Web Publishing 17 no login password 18 pe_application_log.txt log file 73 pe_internal_access_log.txt log file 73 pe_server_error.
Index stylesheets about 37 checkboxes, checking for values in 65 client-side 36 comparing strings via Perl regular expressions 65 content buffering, using 58 cookie extension functions 63 date and time format strings 68 date, time, and day extension functions 66 developing 47 email messages, sending 61 encoding of 53 error status of extension functions, checking 70 examples of usage 37 -grammar parameter for 50 guidelines for developing 47 header functions, using 62 query strings for 49 server-side 37, 47
Custom Web Publishing Guide web server log files 72 MIME type support 18 role in XML requests 22 role in XSLT-CWP requests 38 web sites creating with Web Publishing Engine 10 FileMaker support pages 10 monitoring 72 testing 71 web users accessing protected databases 17, 56, 57 requirements for accessing Custom Web Publishing solutions 12 using container field data 19 web_server_module_log.txt log file 73 wpc_access_log.