Custom Web Publishing with XML and XSLT

Table Of Contents
62 FileMaker Server Custom Web Publishing with XML and XSLT
To load a password-protected XML document that requires a different user name and password than what
was specified in the parent request, then use the following syntax to specify the user name and password as
part of the URI that is passed to the document() function:
http://username:password@hostname/path?querystring
To load an XML document that is not based on a FileMaker database, use the document() function without
FileMaker query commands or query parameters. For example:
<xsl:variable name="other-data" select="document('http://server.company.com/data.xml')" />
If you use the document() function with a relative URL, the Web Publishing Engine attempts to load the XML
document from the local file system in the location relative to where the stylesheet is stored. For example,
suppose a stylesheet that is located inside the mystylesheets folder inside the xslt-template-files folder
contains the following document() function with a relative URL:
<xsl:variable name="mydoc" select="document('mystylesheets/mydoc.xml')" />
The Web Publishing Engine will attempt to load mydoc.xml from the mystylesheets folder inside the
xslt-template-files folder in the local file system.
Note When you use the Web Publishing Engine’s base URI to load a document, the Web Publishing Engine
supports HTTP only. When you load a document from an external server, the Web Publishing Engine
supports both HTTP and HTTPS.
Using the layout information for a database in a stylesheet
You can incorporate the layout information for a FileMaker database in a stylesheet by using the
FMPXMLLAYOUT grammar to request the information and then loading it into a variable via the XSLT
document() function:
<xsl:variable name="layout" select="document(concat($xml-base-uri,'/fmi/xml/FMPXMLLAYOUT.xml?–view'))" />
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:
<xsl:variable name="layout" select="document(concat($xml-base-uri,'/fmi/xml/FMPXMLLAYOUT.xml?–db=products
&–lay=sales&–view'))" />
<select size="1">
<xsl:attribute name="name">Color</xsl:attribute>
<option value="">Select One...</option>
<xsl:for-each select="$layout/fml:FMPXMLLAYOUT/fml:VALUELISTS/fml:VALUELIST[@NAME = 'shirts']/
fml:VALUE">
<option>
<xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute>
<xsl:value-of select="."/>
</option>
</xsl:for-each>
</select>