Jump to content

XSLT and multiple rows per record


This topic is 7311 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Currently I have a stylesheet that will take exported FMPro data and convert it into an html file with a simple table: one row per record with three columns to match the date. For example:

___________________________________________________

|image source info 1 | image name 1 | description 1|

___________________________________________________

|image source info 2 | image name 2 | description 2|

___________________________________________________

What I would like is for each record to span two rows, like this:

___________________________________________________

|image source -> | image name 1----------> |

|info 1 here ---> |_____________________________|

|[space here] --> | image description 1------> |

___________________________________________________

I don't know enough to make this happen and am wondering if someone can point me in the right direction?

Thanks in advance,

Yvonne

Link to comment
Share on other sites

This is just an example:

the xml export :


<?xml version="1.0" encoding="UTF-8" ?>

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">

    <ERRORCODE>0</ERRORCODE>

    <PRODUCT BUILD="24/03/2003" NAME="FileMaker Pro" VERSION="6.0Fv4"/>

    <DATABASE DATEFORMAT="d/M/yyyy" LAYOUT="" NAME="images.fp5" RECORDS="2" TIMEFORMAT="k:mm:ss "/>

    <METADATA>

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="image source info" TYPE="TEXT"/>

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="image name" TYPE="TEXT"/>

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="description" TYPE="TEXT"/>

    </METADATA>

    <RESULTSET FOUND="2">

        <ROW MODID="0" RECORDID="1">

            <COL>

                <DATA>/folder/image1.jpg</DATA>

            </COL>

            <COL>

                <DATA>name of image 1</DATA>

            </COL>

            <COL>

                <DATA> description of image 1</DATA>

            </COL>

        </ROW>

        <ROW MODID="1" RECORDID="2">

            <COL>

                <DATA>/folder/image2.jpg</DATA>

            </COL>

            <COL>

                <DATA>name of image 2</DATA>

            </COL>

            <COL>

                <DATA> description of image 2</DATA>

            </COL>

        </ROW>

    </RESULTSET>

</FMPXMLRESULT>

the xsl file :


<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet exclude-result-prefixes="fmp" version="1.1"

xmlns:fmp="http://www.filemaker.com/fmpxmlresult" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output doctype-public="xml" encoding="UTF-8" indent="yes" method="xml" version="1.0"/>

<xsl:template match="fmp:FMPXMLRESULT">

<html>

<head/>

<body>

<table>

<xsl:apply-templates select="fmp:RESULTSET/fmp:ROW"/>

</table>

</body>

</html>

</xsl:template>

<xsl:template match="fmp:RESULTSET/fmp:ROW">

<tr>

<td>

<xsl:value-of select="fmp:COL[1]/fmp:DATA"/>

</td>

<td>

<xsl:value-of select="fmp:COL[2]/fmp:DATA"/>

</td>

</tr>

<tr>

<td>

<xsl:text>

Link to comment
Share on other sites

This topic is 7311 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.