Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hey,

I've got some FileMaker xml output (FMPDSORESULT style). I have a list of people and their phone numbers...


...

      <CriticalGroupMembers.PersonName>

         <DATA>Bergman, Carrolyn</DATA>

         <DATA>Brill, Daniel</DATA>

         <DATA>Brill, Helen</DATA>

      </CriticalGroupMembers.PersonName>



      <CriticalGroupMembers.PersonHomePhone>

         <DATA>999-999-9999</DATA>

         <DATA>320-999-5644</DATA>

         <DATA>716-999-4844</DATA>

      </CriticalGroupMembers.PersonHomePhone>

...





I want to transform this with an xslt so that my result matches each person with their phone number.  Something like









<ap:Topic>

   <ap:SubTopics>

      <ap:Topic>

         <ap:SubTopics>

            <ap:Topic>

               <ap:Text PlainText="999-999-9999">

                  <ap:Font />

               </ap:Text>

            </ap:Topic>

         </ap:SubTopics>



         <ap:Text PlainText="Bergman, Carrolyn">

            <ap:Font />

         </ap:Text>

      </ap:Topic>



      <ap:Topic>

         <ap:SubTopics>

            <ap:Topic>

               <ap:Text PlainText="320-999-5644">

                  <ap:Font />

               </ap:Text>

            </ap:Topic>

         </ap:SubTopics>



         <ap:Text PlainText="Brill, Daniel">

            <ap:Font />

         </ap:Text>

      </ap:Topic>



      <ap:Topic>

         <ap:SubTopics>

            <ap:Topic>

               <ap:Text PlainText="716-999-4844">

                  <ap:Font />

               </ap:Text>

            </ap:Topic>

         </ap:SubTopics>



         <ap:Text PlainText="Brill, Helen">

            <ap:Font />

         </ap:Text>

      </ap:Topic>





The problem is that I can't get each person's phone number to match their record.  The way it is looping, the first phone number in the list gets applied to every person.



This is the xslt code I'm using...





<ap:Topic>

   <ap:SubTopics>

      <xsl:for-each select="fmp:CriticalGroupMembers.PersonName/fmp:DATA">

         <ap:Topic>

            <ap:SubTopics>

               <ap:Topic>

                  <ap:Text>

                     <xsl:attribute name="PlainText">

                        <xsl:value-of select="../../fmp:CriticalGroupMembers.PersonHomePhone/fmp:DATA" />

                     </xsl:attribute>



                     <ap:Font />

                  </ap:Text>

               </ap:Topic>

            </ap:SubTopics>



            <ap:Text>

               <xsl:attribute name="PlainText">

                  <xsl:value-of select="." />

               </xsl:attribute>



               <ap:Font />

            </ap:Text>

         </ap:Topic>

      </xsl:for-each>

   </ap:SubTopics>

</ap:Topic>



I know the problem is in the way the loop is set up. How do I set it up so that the first time through it matches the first person to the first phone number, the second time it matches the second person to the second phone number, and so on?

I've attached the full xml and xslt file so you can see them in all their glory.

Thanks for any insight,

Dan

CriticalGroupsWithPhone.zip

An example with 3 persons and there email :

the fmp->xml output


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

    <RESULTSET FOUND="1">

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

            <COL>

                <DATA>Nagy</DATA>

                <DATA>Durant</DATA>

                <DATA>Javaux</DATA>

            </COL>

            <COL>

                <DATA>[email protected]</DATA>

                <DATA>[email protected]</DATA>

                <DATA>[email protected]</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">

        <breves>

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

        </breves>

    </xsl:template>

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

            <auteurs>

                <xsl:apply-templates select="fmp:COL[1]/fmp:DATA"/>

            </auteurs>

    </xsl:template>

    <xsl:template match="fmp:COL[1]/fmp:DATA">

        <xsl:variable name="pos" select="position()"/>

        <auteur>

            <nom>

                <xsl:value-of select="."/>

            </nom>

            <mail>

                <xsl:value-of select="ancestor::fmp:ROW/fmp:COL[2]/fmp:DATA[position()=$pos]"/>

            </mail>

        </auteur>

    </xsl:template>

</xsl:stylesheet>





the result :





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

<breves>

   <auteurs>

      <auteur>

         <nom>Nagy</nom>

         <mail>[email protected]</mail>

      </auteur>

      <auteur>

         <nom>Durant</nom>

         <mail>[email protected]</mail>

      </auteur>

      <auteur>

         <nom>Javaux</nom>

         <mail>[email protected]</mail>

      </auteur>

   </auteurs>

</breves>

I hope this help you.

  • Author

Wonderful! This should do the trick. I need to study it a bit, but this will do the job.

Merci Beaucoup!

Avec plaisir !

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.