Newbies Mark Hawes Posted May 3, 2005 Newbies Posted May 3, 2005 I'm up against a time crunch and I need to show the client the basic concept. I've decided to modify the complex_table.xsl that comes with FMP. I've already made some changes but need help with the following: One of the fields need to be displayed as a huperlink, ie: a href="http://server/clientb/georgesresume">Got to Resume< I need to know what the code is and where does it go. I have found the following but don't where it goes. xsl:for-each select="urls/url" br/ xsl:element name="a" xsl:attribute name="href" xsl:value-of select="@address" /xsl:attribute> xsl:value-of select="@desc" /xsl:element /xsl:for-each TIA, Mark
Martin Brändle Posted May 3, 2005 Posted May 3, 2005 Hmm. Not quite clear what you want to do. Let's assume your result of the query is just one record. Then you could do the following: <xsl:variable name="record" select="/fmrs:fmresultset/fmrs:resultset/fmrs:record[1]"/> (e.g. store the XML result set fragment in a variable called record) Then, where you need the URL: <a href="{$record/fmrs:field[@name = 'thefieldnamewheretheurlisstored']/fmrs:data[1]}">Go to resume</a> The curly brackets are an abbreviation for what can be programmed also like this: <a> <xsl:attribute name="href"> <xsl:value-of select="$record/fmrs:field[@name = 'thefieldnamewheretheurlisstored']/fmrs:data[1]"/> </xsl:attribute> <:xsl:text>Go to resume</xsl:text> </a>
Newbies Mark Hawes Posted May 3, 2005 Author Newbies Posted May 3, 2005 Thanks, Martin. Let me clarify a bit. First it'll several records of a found set. Also In the xsl stylesheet I'm modifying the current code in question is: xsl:for-each select="fmp:METADATA/fmp:FIELD" td align="middle" xsl:attribute name="bgColor"> font size="+1" xsl:attribute name="color"> xsl:value-of select="@NAME"/ /font /td /xsl:for-each How do I modify the above to allow for the fields that needs to be a hyperlink.
Martin Brändle Posted May 3, 2005 Posted May 3, 2005 Sorry for my misleading reply before - i thought you were in FMS7A CWP (that's why I used the fmrs namespace), but now I see that you want to do an export of the HTML with the example given in the Examples directory of FM7. The problem is that you can't do the loop over the METADATA part - which defines your field names etc. - in your xml tree and at the same time pick elements of the RESULTSET part - that holds the data - for the hyperlinks. These are different branches, and you have to run through them separately (also because of the different number of elements in the METADATA and in the RESULTSET parts). So the best is to clarify your problem by: - posting some records exported as XML file in the FMPXMLRESULT grammar. - posting the XSLT file you have modified so far. - posting a scetch of how the resulting HTML should look like, e.g. explaining which fields should come where. Then we can help further.
beverly Posted May 12, 2005 Posted May 12, 2005 If you are using the "complex_table.xsl", then you probably are using FMPXMLRESULT to export. You need to select the corresponding "fmp:COL/fmp:DATA" to use. For example, if you have three columns (record number, hyperlink, name), they would be COL[1], COL[2], COL[3] in the export. Then simply use them in your XSLT, something like this: '<a href="{fmp:COL[2]/fmp:DATA}"><xsl:value-of select="fmp:COL[3]/fmp:DATA" /></a> The "{...}" is the AVT (attribute value template) method for processing inline.
Recommended Posts
This topic is 7136 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now