xsl-list
[Top] [All Lists]

repeating/portal fields in filemaker FMPXMLRESULT?

2005-12-09 00:10:05
Hi, I'm looking for a general solution to a problem I anticipate facing many
times over. I've checked the archives with no success, but maybe I don't
know the magic keywords for this problem.

The problem is this - consider this XML fragment:

<resultset>
    <row>
        <col><data>fred</data></col>
        <col> <!-- zero or more children -->
            <data>2005-06</data>
            <data>2005-07</data>
            <data>2005-08</data>
        <col>
        <col> <!-- same number of children as col[2] -->
            <data>open</data>
            <data>draft</data>
            <data>closed</data>
        <col>
    </row>
    <row>
        <col><data>wilma</data></col>
        <col>
            <data>2005-06</data>
            <data>2006-01</data>
        <col>
        <col>
            <data>open</data>
            <data>closed</data>
        <col>
    </row>
</resultset>

The first <col/> always only has one <data/> child. The second and third
<col/> may have zero to many <data/> children, but will always have the same
count (ie. if col#2 has 3 children, col#3 will have 3 children).

The problem I'm facing is that I want to transform this to look more like
this:

<whatever>
    <record>
        <name>fred</name>
        <!-- zero or more entry children -->
        <entry><!-- with exactly the same child elems -->
            <month>2005-06</month>
            <status>open</status>
        </entry>
        <entry>
            <month>2005-07</month>
            <status>draft</status>
        </entry>
        <entry>
            <month>2005-08</month>
            <status>closed</status>
        </entry>
    </record>
    <record>
        <name>wilma</name>
        <entry>
            <month>2005-06</month>
            <status>open</status>
        </entry>
        <entry>
            <month>2006-01</month>
            <status>closed</status>
        </entry>
    </record>
<whatever>


The approach I've considered has been to use <xsl:for-each select="row"> to
cycle over each row, and then <xsl:for-each select="col[2]/data"> to cycle
over each <data/> in the second column ... but how do I then reference the
corresponding nth child of col[3]? Should I not use nested xsl:for-each to
tackle this problem, but instead some other method?

e.

ps. keywords for the archive, if I ever need to come searching again
    FMPXMLRESULT, Filemaker, repeating fields, portal fields, </data><data>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>