8 Replies Latest reply on Dec 18, 2011 2:37 AM by beverly

    XSLT Is Find/Replace Text Possible?


      I'm learning to leverage the power of XSLT. I like it a lot.


      This morning I exported to a HTML table. The header rows display the field names. Whenever the field is from a related table the table name is included. I would like to strip the table name and the double colons. For example I want to modify "Address::Street" to "Street". Is this something that XSLT can do?

        • 1. Re: XSLT Is Find/Replace Text Possible?

          Absolutely! XPath & XSLT functions are somewhat similar to FileMaker functions:



          xsl:when test="contains(':',">      xsl:value-of select="substring-after(':',)" />



               xsl:value-of select="" /> /xsl:otherwise> xsl:choose> this is like a case statement. Make the test for ":" and then get the value after the ":" or just get the field name. [NOTE: I removed the opening "<" on each tag above, to prevent the code from being munged by JIVE. and is however you are currently getting the value.]



          • 2. Re: XSLT Is Find/Replace Text Possible?

            Do remember that FileMaker has warned that it is possible that XSLT may not be supported in the future.

            • 3. Re: XSLT Is Find/Replace Text Possible?

              There is a lot of confusion about the deprecation of support for XSLT.


              Filemaker are planning to drop XSLT publishing. This is an option that is available in Filemaker Server Advanced and allows you to publish web pages dynamically from Filemaker Server Advanced using XSLT.


              Filemaker also provides XML as an export option. When selecting XML export you can optionally apply an XSLT transformation to the output. Filemaker have never said that they will drop support for XML export with XSLT.

              • 4. Re: XSLT Is Find/Replace Text Possible?

                Just to be clear, it should look like this? (I had to cut and past in the HTML mode to achieve this)



                <xsl:when test="contains(':')">

                <xsl:value-of select="substring-after(':')" />



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




                How does the selection work when selecting the substring after the colon? Does it use the first colon it encounters or the last?


                In the otherwise node, what is the function of select=""? Are you saying that using select="" will cause it to use the current field name?

                • 5. Re: XSLT Is Find/Replace Text Possible?

                  Export AND Import as XML (applying XSLT, as needed) have not changed.


                  XSLT used for Web publishing will not be available in future versions of Server (either one).


                  Use of XML in web publishing (PHP uses it) has NOT been deprecated.


                  Export as FMPDSORESULT will also be deprecated.


                  -- sent from my iPhone4 --

                  Beverly Voth





                  Message was edited by: beverly to add a link to the article

                  • 6. Re: XSLT Is Find/Replace Text Possible?

                    How are you getting the field name now? (xsl:value-of select="???") you have to specify something to read, You didn't include any of your XSLT in your original post. This may depend upon what XML type you used for the Export. For FMPXMLRESULT, this could be "fm:ROW[1]/fm:COL/fm:DATA[3]" (third column/field in export order of the first row/record).


                    Yes. substring-after is the "first" one and they can be nested. To parse time (01:30:00), for example:

                    $hour = substring-before(':', timefield)

                       01 : (without the ":") => 01

                    $minute = substring-before(':', substring-after(':', timefield))

                      :  30:00 (inner substring without the first ":") => 30:00

                      30 : (without the final ":") => 30

                    $second = substring-after(':', substring-after(':', timefield))

                       : 30:00 (inner substring without the first ":") => 30:00

                      : 00 (without the final ":") => 00




                    1 of 1 people found this helpful
                    • 7. Re: XSLT Is Find/Replace Text Possible?

                      Here's the code that I'm using to get the field names:

                      <xsl:template name="header">

                      <xsl:for-each select="fmp:METADATA/fmp:FIELD">

                      <xsl:value-of select="@NAME"/>

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


                      And now that I've written that, of course, I can see that it is the code that I should put into the "otherwise" block.



                      • 8. Re: XSLT Is Find/Replace Text Possible?

                        No, Malcom if you are using it to get the NAMES of the fields, then you uses the xsl:choose block within your "header" template:


                        (I assume the $delimiter was set up with xsl:variable and is ":").

                        xsl:template name="header">

                             xsl:for-each select="fmp:METADATA/fmp:FIELD">


                                       xsl:when test="contains($delimiter,./@NAME)">

                                            xsl:value-of select="substring-after($delimiter,./@NAME)">



                                            xsl:value-of select="./@NAME">






                        I also see that this forum munged my original reply, I had "fieldname" in the curly braces. So, I see that it might have been difficult to understand how the cods is. Again, I've removed the opening "<" (left angle bracket) in the above code, in hopes that it's not munged!


                        Beverly Voth