Custom Web Publishing with XML and XSLT

Table Of Contents
40 FileMaker Server Custom Web Publishing with XML and XSLT
If one of the above steps generates an error code, the request processing stops; any steps that follow are not
executed. However, any prior steps in the request are still executed.
For example, consider a request that deletes the current record, sorts the records, and then executes a script.
If the –sortfield parameter specifies a non-existent field, the request deletes the current record and returns
error code 102 (“Field is missing”), but does not execute the script.
Using server-side and client-side processing of stylesheets
The Web Publishing Engine supports server-side processing of an XSLT stylesheet, and also allows you to
use a query parameter that specifies client-side processing of a stylesheet.
It is important to understand the differences between the two ways to process stylesheets, and the security
implications of using client-side processing. Server-side processing is more secure than client-side processing
because server-side processing does not give web users access to the unfiltered XML data. With server-side
processing, the data is presented in a form that the data owner or the XSLT stylesheet author decides is appropriate
to present. Server-side processing hides the database names, field names, and other implementation details from
web users. Server-side processing can also be used to specify statically defined query parameters, which prevent
the use of unauthorized query commands and query parameters, such as database names. See
chapter 5,
“Introduction to Custom Web Publishing with XSLT” and chapter 6, “Developing FileMaker XSLT stylesheets.
If your solution requires client-side stylesheet processing, you can have the Web Publishing Engine generate
an XML stylesheet processing instruction with each grammar by including the –styletype and –stylehref
parameters in the FileMaker query string request. You can use cascading stylesheets (CSS) or XSLT
stylesheets for displaying your XML document.
1 The –styletype parameter is used for setting the value of the type attribute (type=text/css or type=text/xsl).
1 The –stylehref parameter is used for setting the value of the HREF attribute that specifies the location of the
stylesheet using an absolute path. For example: href=/mystylesheet.css or href=/stylesheets/mystylesheet.xsl.
The name of the stylesheet can be any name but it must contain an extension of either .css or .xsl.
Here is an example of a FileMaker query string that generates client-side stylesheet processing:
http://localhost/fmi/xml/fmresultset.xml?–db=products–lay=sales&–findall&–styletype=text/xsl&–stylehref=/mystylesheet.xsl
Note This “/” in “–stylehref=/document.xsl” in this example is used because the stylesheet is located in the
root folder of the web server software. Use a URL for the stylesheet that uses an absolute path to specify its
location on the web server. The stylesheet can also be located on another web server.
Based on this request, the Web Publishing Engine will include the following processing instruction in the
XML document:
<?xml–stylesheet type="text/xsl" href="/mystylesheet.xsl"?>
Copy or place the stylesheet for client-side processing on the web server in the location specified by the
absolute path in the URL for the HREF attribute.
Important Do not place stylesheets for client-side processing inside the xslt-template-files folder, which is
used for server-side processing of XSLT stylesheets. See
“Using FileMaker XSLT stylesheets in a website
or program” on page 48.
Note Some web browsers do not support client-side processing. For information, see the documentation for
your web browser.