AnsweredAssumed Answered

XML - change standard ROWs with XSL for InDesign import

Question asked by MarcoMüller on Sep 8, 2010

Title

XML - change standard ROWs with XSL for InDesign import

Post

hello

I'm a designer and a beginner in the field. I hope a xsl expert can help me in this case. I have following problem with my fmp and xsl: I want to export my fmp-file to a xml. therefore I use xsl to fit InDesign needs. I would like to change the header of the standard xml-export and the row command with a xsl.

standard XML I get:

- - -

<?xml version="1.0" encoding="UTF-8" ?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult"><ERRORCODE>0</ERRORCODE>
<DATABASE>filename.fp7</DATABASE>
<LAYOUT></LAYOUT>

<ROW MODID="0" RECORDID="1">
<field1>data1</field1>

<field2>data2</field2>

<field3>data3</field3>

</ROW>

</FMPDSORESULT>

end-XML I like to have:

- - -

<root>

<institutionen>
<field1>data1</field1>

<field2>data2</field2>

<field3>data3</field3>

</institutionen>

</root>

my current xsl-file looks like this:

- - -

<?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="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="fmp:FMPXMLRESULT">
    <root>
    <xsl:for-each select="fmp:RESULTSET/fmp:ROW">
        <institutionen>
            <xsl:for-each select="fmp:COL">
                <xsl:element name="fmp:DATA">
                    <xsl:if test="fmp:DATA!=''">
                        <xsl:apply-templates select="fmp:DATA"/>
                    </xsl:if>
                </xsl:element>
            </xsl:for-each>
        </institutionen>
    </xsl:for-each>
    </root>
</xsl:template>
</xsl:stylesheet>

Does anybody know how to solve this? Thanks a lot!

Outcomes