8 Replies Latest reply on Mar 2, 2011 11:52 PM by magafk

    Creating live links from field content FMSA11 XSLT

    ErichWetzel

      Title

      Creating live links from field content FMSA11 XSLT

      Your post

      Using FMSA11.

      Can anyone suggest a tutorial, general information or syntax if it is easy to create live URL links from the content of a field.

      Example : Field A = www.filemaker.com

      I want the produced page to create a link using the text of the field content as the destination and the text as the button to go to the URL.

      Additionally, I have text in paragraph form in a field that is published that contains link addresses in the general text.  Is there a way to easily have the generated page show the links as live links to press.

      Thanks - Erich

        • 1. Re: Creating live links from field content FMSA11 XSLT
          philmodjunk

          WIth the first example, if you format Field A as a button, the button can use Open URL [ no dialog ; Table::FieldA ] to open the URL.

          I'm not totally sure on the second part. I have done something similar by setting up a calculation field that includes HTML tags, including those for a Hyperlink, for pasting here into the HTML editor used for this Forum. Not sure of all the steps for publishing that as part of the web page however...

          • 2. Re: Creating live links from field content FMSA11 XSLT
            ErichWetzel

            PhilModJunk,

            Thanks for looking.  I was not clear enough, sorry.  I'm not in the database proper with this.  I'm trying to get an XSLT stylesheet to publish a page via WPE to the user in a web browser showing the contents of the field as a URL link like an inline link in an email that the email browser sets as a live link.

            If there is not something specifically designed to call for data and set this up using XSLT, I like your idea of integrating the HTML in the database field and having the stylesheet simply add the content of the field in line as it generates the page.  I'm not sure of the full procedure either.  But, with time...

            • 3. Re: Creating live links from field content FMSA11 XSLT
              magafk

              Hi,

              I hope I understand what you are after. 

              <a>

                  <xsl:attribute name="href" value="fmrs:fmresultset/fmrs:resultset/fmrs:record/fmrs:field[@name='Field A']/fmrs:data"/>

                  <xsl:value-of select="fmrs:fmresultset/fmrs:resultset/fmrs:record/fmrs:field[@name='Field A']/fmrs:data"

              </a>

              • 4. Re: Creating live links from field content FMSA11 XSLT
                ErichWetzel

                magnusk,

                That is exactly what I was looking for.  I don't have a lot of xslt experience and I have wanted to create some links in our web pages this way.  I will post back to let you know how I do with it or for syntax clarification.  Thank you.

                • 5. Re: Creating live links from field content FMSA11 XSLT
                  ErichWetzel

                  magnusk,

                  I must be missing something.  Each time I try to add what you have suggested, adjusted for our stylesheet setup, I get a page error.

                  Using a duplicate of an already functioning page, which was written by the FileMaker XSLT template maker back a few years ago, I am able to have the content I want show in the output as seen by the browser, I just cannot get it to be a link.  

                  In the "Web test" field for the appropriate record I have entered http://www.FileMaker.com as text.  On the browser page I get http://www.FileMaker.com as text from the following code.  How might I make this a link?  I assume that the If/Then is escaping for an empty field.  I simply do not have the language knowledge for this.

                  <xsl:for-each select="fmrs:resultset/fmrs:record/fmrs:field[@name='Web test']/fmrs:data">

                    <xsl:if test="position() != 1"><br/></xsl:if>

                  <xsl:value-of disable-output-escaping="yes" select="fmxslt:break_encode(.)"/>

                  <xsl:if test=". = ''">

                  <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>

                  </xsl:if>

                  </xsl:for-each>

                  Thanks again for looking.

                  • 6. Re: Creating live links from field content FMSA11 XSLT
                    ErichWetzel

                    magnusk,

                    With further testing I was able to get this to apply the link from the field "Web test" to the text "View" but trying to use the content of the field for the text of the link produced the error again.

                    <xsl:attribute name="href">

                    <xsl:value-of select="fmrs:resultset/fmrs:record/fmrs:field[@name='Web test']/fmrs:data"/>

                    </xsl:attribute>

                    <xsl:attribute name="target">blank</xsl:attribute>

                    View</a>

                    • 7. Re: Creating live links from field content FMSA11 XSLT
                      ErichWetzel

                      Got it.  I have not been able to simplify the code down to the minimum required but this is what worked for me : 

                      <a>                                    

                      <xsl:attribute name="href"> <xsl:value-of select="fmrs:resultset/fmrs:record/fmrs:field[@name='Web test']/fmrs:data"/></xsl:attribute>

                      <xsl:attribute name="target">blank</xsl:attribute>

                      <xsl:for-each select="fmrs:resultset/fmrs:record/fmrs:field[@name='Web test']/fmrs:data">

                      <xsl:if test="position() != 1"><br/></xsl:if>

                      <xsl:value-of disable-output-escaping="yes" select="fmxslt:break_encode(.)"/>

                      <xsl:if test=". = ''">

                      <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>

                      </xsl:if>

                      </xsl:for-each>

                      </a>

                      • 8. Re: Creating live links from field content FMSA11 XSLT
                        magafk

                        I guess you have <xsl:template match="/fmrs:fmresultset"> </xsl:template> surrounding the code. Then you can omit that part.

                        The longer code that you used is needed if you have many repetitions in the field

                        <a target="blank">

                            <xsl:attribute name="href" value="fmrs:resultset/fmrs:record/fmrs:field[@name='Field A']/fmrs:data"/>

                            <xsl:value-of select="fmrs:record/fmrs:field[@name='Field A']/fmrs:data"

                        </a>