4 Replies Latest reply on Mar 21, 2013 7:19 AM by lutfishah

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

    lutfishah

      Hi,

       

      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

       

      <?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>

        • 1. Re: Filemaker XML via XSLT: Display same data (repeat) more than once using for-each?
          beverly

          export the field ONCE and call with xsl:value-of as many times as needed. Just specify the correct column (COL[n]/DATA), with appropriate namespace prefix if required.

           

          Beverly

          • 2. Re: Filemaker XML via XSLT: Display same data (repeat) more than once using for-each?
            lutfishah

            Thanks very much for your reply.

            I have tried that and all the text appear to come in one line. I'm sure that I'm doing somthing stupid here may be cuz I'm new to xsls.

             

            Would it be possible to give me the magic code from the above complete xsl pleeeeeese.

            I will really appriciate.

             

            Thanks

            • 3. Re: Filemaker XML via XSLT: Display same data (repeat) more than once using for-each?
              beverly

              Did you include your complete code to correct? Your XSLT is needed to revise.

              Thank you

              Beverly

              • 4. Re: Filemaker XML via XSLT: Display same data (repeat) more than once using for-each?
                lutfishah

                Sure..

                 

                This is the xslt

                 

                <?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><xsl:value-of select="fmp:COL[1]/fmp:DATA"/></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>

                 

                 

                <marker>

                                              <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>

                <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>