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.

Filemaker XML via XSLT: Display same data (repeat) more than once using for-each?

Featured Replies

Hi Folks,

 

I am trying to export some data in xml format from filemaker using XSLT. I want to display the same data in three places on the xml. I was displaying the data once by using for-each tag.

 

<xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">

 

          <xsl:for-each select="fmp:COL[3]/fmp:DATA">

                    <marker>

                    <name>

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

                    </name>

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

                              <comment>

                              <xsl:value-of select="../../fmp:COL[6]/fmp:DATA[$pos]"/>

                              </comment>

                              <in>

                              <xsl:value-of select="../../fmp:COL[4]/fmp:DATA[$pos]"/>

                              </in>

                              <out>

                              <xsl:value-of select="../../fmp:COL[5]/fmp:DATA[$pos]"/>

                              </out>

                    </marker>

          </xsl:for-each>

</xsl:for-each>

 

But when I want to export the above data in three different places in the same XML, It fails. I'm not an XML person so my apologise in the begining if I'm not clear. Thanks very much in advance for your help.

 

 

 

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

<xsl:stylesheet version="1.0"

xmlns:fmp="http://www.filemaker.com/fmpxmlresult"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="fmp">

 

 

<xsl:output method="xml" indent="yes" />

 

 

<xsl:template match="/">

 

 

<xmeml version="1">

<sequence id="test_clip">

          <name>test_clip</name>

          <duration>7704</duration>

          <rate>

                    <ntsc>FALSE</ntsc>

                    <timebase>25</timebase>

          </rate>

          <timecode>

                    <rate>

                              <ntsc>FALSE</ntsc>

                              <timebase>25</timebase>

                    </rate>

                    <string>01:00:00:00</string>

                    <frame>90000</frame>

                    <source>source</source>

                    <displayformat>NDF</displayformat>

          </timecode>

          <in>-1</in>

          <out>-1</out>

          <media>

                    <video>

                    <format>

                                        <samplecharacteristics>

                                                  <width>1024</width>

                                                  <height>576</height>

                                                  <anamorphic>FALSE</anamorphic>

                                                  <pixelaspectratio>Square</pixelaspectratio>

                                                  <fielddominance>none</fielddominance>

                                                  <rate>

                                                            <ntsc>FALSE</ntsc>

                                                            <timebase>25</timebase>

                                                  </rate>

                                                  <colordepth>24</colordepth>

                                                  <codec>

                                                            <name>H.264</name>

                                                            <appspecificdata>

                                                                      <appname>Final Cut Pro</appname>

                                                                      <appmanufacturer>Apple Inc.</appmanufacturer>

                                                                      <appversion>7.0</appversion>

                                                                      <data>

                                                                                <qtcodec>

                                                                                          <codecname>H.264</codecname>

                                                                                          <codectypename>H.264</codectypename>

                                                                                          <codectypecode>avc1</codectypecode>

                                                                                          <codecvendorcode>appl</codecvendorcode>

                                                                                          <spatialquality>1023</spatialquality>

                                                                                          <temporalquality>0</temporalquality>

                                                                                          <keyframerate>0</keyframerate>

                                                                                          <datarate>0</datarate>

                                                                                </qtcodec>

                                                                      </data>

                                                            </appspecificdata>

                                                  </codec>

                                        </samplecharacteristics>

                                        <appspecificdata>

                                                  <appname>Final Cut Pro</appname>

                                                  <appmanufacturer>Apple Inc.</appmanufacturer>

                                                  <appversion>7.0</appversion>

                                                  <data>

                                                            <fcpimageprocessing>

                                                                      <useyuv>TRUE</useyuv>

                                                                      <usesuperwhite>FALSE</usesuperwhite>

                                                                      <rendermode>YUV8BPP</rendermode>

                                                            </fcpimageprocessing>

                                                  </data>

                                        </appspecificdata>

                              </format>

                              <track>

                                        <clipitem id="testclip3 ">

                                                  <name>testclip3</name>

                                                  <duration>7501</duration>

                                                  <rate>

                                                            <ntsc>FALSE</ntsc>

                                                            <timebase>25</timebase>

                                                  </rate>

                                                  <in>0</in>

                                                  <out>7501</out>

                                                  <start>203</start>

                                                  <end>7704</end>

                                                  <pixelaspectratio>Square</pixelaspectratio>

                                                  <enabled>TRUE</enabled>

                                                  <anamorphic>FALSE</anamorphic>

                                                  <alphatype>none</alphatype>

                                                  <masterclipid>testclip3 1</masterclipid>

                                                  <logginginfo>

                                                            <good>FALSE</good>

                                                  </logginginfo>

                                                  <file id="testclip3 2">

                                                            <name>testclip3.mov</name>

                                                            <pathurl>file://localhost/Users/itsupport/Desktop/testclip3.mov</pathurl>

                                                            <rate>

                                                                      <timebase>25</timebase>

                                                            </rate>

                                                            <duration>7501</duration>

                                                            <media>

                                                                      <video>

                                                                                <duration>7501</duration>

                                                                                <samplecharacteristics>

                                                                                          <width>1024</width>

                                                                                          <height>576</height>

                                                                                </samplecharacteristics>

                                                                      </video>

                                                                      <audio>

                                                                                <rate>

                                                                                          <timebase>48000</timebase>

                                                                                </rate>

                                                                                <trackcount>2</trackcount>

                                                                                <samplecharacteristics>

                                                                                          <depth>16</depth>

                                                                                </samplecharacteristics>

                                                                      </audio>

                                                            </media>

                                                  </file>

                                                  <xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">

 

          <xsl:for-each select="fmp:COL[3]/fmp:DATA">

                    <marker>

                    <name>

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

                    </name>

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

 

                              <comment>

                              <xsl:value-of select="../../fmp:COL[6]/fmp:DATA[$pos]"/>

                              </comment>

 

                              <in>

                              <xsl:value-of select="../../fmp:COL[4]/fmp:DATA[$pos]"/>

                              </in>

 

                              <out>

                              <xsl:value-of select="../../fmp:COL[5]/fmp:DATA[$pos]"/>

                              </out>

 

                    </marker>

          </xsl:for-each>

 

 

</xsl:for-each>

                                                  <sourcetrack>

                                                            <mediatype>video</mediatype>

                                                  </sourcetrack>

                                                  <link>

                                                            <linkclipref>testclip3 </linkclipref>

                                                            <mediatype>video</mediatype>

                                                            <trackindex>1</trackindex>

                                                            <clipindex>1</clipindex>

                                                  </link>

                                                  <link>

                                                            <linkclipref>testclip3 3</linkclipref>

                                                            <mediatype>audio</mediatype>

                                                            <trackindex>1</trackindex>

                                                            <clipindex>1</clipindex>

                                                            <groupindex>1</groupindex>

                                                  </link>

                                                  <link>

                                                            <linkclipref>testclip3 4</linkclipref>

                                                            <mediatype>audio</mediatype>

                                                            <trackindex>2</trackindex>

                                                            <clipindex>1</clipindex>

                                                            <groupindex>1</groupindex>

                                                  </link>

                                                  <fielddominance>none</fielddominance>

                                        </clipitem>

                                        <enabled>TRUE</enabled>

                                        <locked>FALSE</locked>

                              </track>

 

                              </video>

                    <audio></audio>

                    </media>

                              <ismasterclip>FALSE</ismasterclip>

          <xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">

 

          <xsl:for-each select="fmp:COL[3]/fmp:DATA">

                    <marker>

                    <name>

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

                    </name>

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

 

                              <comment>

                              <xsl:value-of select="../../fmp:COL[6]/fmp:DATA[$pos]"/>

                              </comment>

 

                              <in>

                              <xsl:value-of select="../../fmp:COL[4]/fmp:DATA[$pos]"/>

                              </in>

 

                              <out>

                              <xsl:value-of select="../../fmp:COL[5]/fmp:DATA[$pos]"/>

                              </out>

 

                    </marker>

          </xsl:for-each>

 

 

</xsl:for-each>

<filter>

                    <effect>

                    <name>Distort</name>

                    <effectid>deformation</effectid>

                    <effectcategory>motion</effectcategory>

                    <effecttype>motion</effecttype>

                    <mediatype>video</mediatype>

                              <parameter>

                                        <parameterid>aspect</parameterid>

                                        <name>Aspect</name>

                                        <valuemin>-10000</valuemin>

                                        <valuemax>10000</valuemax>

                                        <value>33.3333</value>

                              </parameter>

                    </effect>

          </filter>

</sequence>

</xmeml>

 

 

</xsl:template>

</xsl:stylesheet>

I'm EXTREMELY weak in XML ... but what about using a variable?

 

i.e. Set the variable with the field and then use the variable everywhere you want it ??

 

I way be way off base but it's an idea anyway .......... until someone knowledgeable posts.

  • Author

I'm EXTREMELY weak in XML ... but what about using a variable?

 

i.e. Set the variable with the field and then use the variable everywhere you want it ??

 

I way be way off base but it's an idea anyway .......... until someone knowledgeable posts.

Thanks Cabinetman for the nice idea 

but please can you show me how to set a variable on xsl : )

 

Thanks

Like I said ... EXTREMELY weak here.  A google search will explain much better than I can ...........

 

 

But something like  :

<xsl:value-of select="$myvariable"/>

.. In place of where the field you want to reuse is. Say like :

<xsl:for-each select="fmp:COL[3]/fmp:DATA">

and then add this near the end of your xsl template :

<xsl:variable name="myvariable">
<xsl:for-each select="fmp:COL[3]/fmp:DATA">
</xsl:variable>

 I THINK ... smethng like this may work .......

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.