Declan Enright
Declan Enright

Reputation: 3

XSL stylesheet for a Filemaker pro XML export

I am creating a stylesheet for a filemaker pro XML export however the output does not render when I load it in a browser. I have tested the XSL code with other sample XML data and it renders fine in a browser however it will not work with the filemaker pro format. Any suggestions would be greatly appreciated.

My XML file looks like this:

<?xml version="1.0" encoding="UTF-8" ?><!-- This grammar has been deprecated - use FMPXMLRESULT instead -->
<?xml-stylesheet version="1.0" href="style.xsl" type="text/xsl"?>
<FMPDSORESULT>
    <ERRORCODE>0</ERRORCODE>
    <DATABASE>Database.fmp12</DATABASE>
    <LAYOUT>Manage Parts</LAYOUT>
    <ROW MODID="177" RECORDID="2104">
        <Code>T034-00596</Code>
        <Description>INFO GUIDE</Description>
        <Size>2</Size>
        <Units>/1</Units>
        <Price>5</Price>        
    </ROW>
    <ROW MODID="178" RECORDID="2105">
        <Code>T034-00597</Code>
        <Description>INFO GUIDE</Description>
        <Size>2</Size>
        <Units>/3</Units>
        <Price>4</Price>        
    </ROW>
    <ROW MODID="177" RECORDID="2104">
        <Code>T034-00598</Code>
        <Description>INFO GUIDE</Description>
        <Size>2</Size>
        <Units>/2</Units>
        <Price>6</Price>        
    </ROW>  
</FMPDSORESULT>

This is my XSL file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/FMPDSORESULT">

<html>
    <Head>
    … header omitted for brevity …
    </Head>
        <body>          
            <xsl:for-each select="ROW">
                <h1><xsl:value-of select="Code" /></h1>
            </xsl:for-each>     
        </body>
</html>

</xsl:template>
</xsl:stylesheet>

Upvotes: 0

Views: 563

Answers (1)

michael.hor257k
michael.hor257k

Reputation: 117093

That is not what a FileMaker export looks like. FileMaker places the exported nodes in its own namespace:

<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">

Your stylesheet must declare this namespace, assign it a prefix and use this prefix to address elements in the XML source:

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

<xsl:template match="/fmp:FMPDSORESULT">
    <html>
        <head>
        … header omitted for brevity …
        </head>
        <body>          
            <xsl:for-each select="fmp:ROW">
                <h1><xsl:value-of select="fmp:Code" /></h1>
            </xsl:for-each>     
        </body>
    </html>
</xsl:template>

</xsl:stylesheet>

Upvotes: 2

Related Questions