Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

how do i use href with a value from a database


This topic is 7096 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

After making a selection on my index.xsl page, in my case an "Institution", I bring up the people found for that institution and display name, phone, email etc from my database.

At the top of my page I am wanting to display "Our friends from (and whatever institution was selected being in a href). I am wanting the institutionurl, which is a field in my database, in the actual value in my href. For example, say North Carolina was selected on my index.xsl page, I want the top of my page to show:

Our friends at North Carolina. And if selected it goes to www.unc.edu or whatever the link happens to be in the institutionurl field in my database.

Here is what I tried, which is the cdml conversion, but nothing shows up after "Our friends at ":


<h1 class="bluebold">Our friends at <a href="{$default-record/fmrs:field[@name = 'InstitutionURL']/fmrs:data[1]}" target="_blank"><xsl:attribute name="alt">Link to the <xsl:value-of select="$default-record/fmrs:field[@name = 'Institution']/fmrs:data[1]"/>. Please note that selecting this link will open a new browser window.</xsl:attribute><xsl:value-of select="$default-record/fmrs:field[@name = 'Institution']/fmrs:data[1]"/></a></h1>

Then I display each individuals info below that. I can display the info below fine in my "xsl:for-each select" section but I can't seem to figure out the needed code for showing the institutionurl field in the href beforehand.

============

Also, when I show each persons email address, which is inside of my xsl:for-each, I am wanting a person to be able to select it and it open up the email client and place this email address in the "To:" line. When I display my data on my web site I use:

Email: <xsl:value-of select="$record/fmrs:field[@name = 'email']/fmrs:data[1]"/>

Thanks for any assistance,

Doug

Posted

For the email href I also tried:

 

<xsl:variable name="thisrec" select="fmrs:resultset/fmrs:record[1]"></xsl:variable>

xEmail: <a href="fmxslt:send_email($thisrec/fmrs:field[@name = 'email']/fmrs:data[1])"></a>

 

But still no results.

Any help would be appreciated,

Doug

Posted

This will show the institution selected in index.xsl as a hyperlink. But it does not show the value of institutionurl, which holds the value of a link brought in from my database, when I get ready to select it.

 

            <xsl:for-each select="/fmrs:fmresultset/fmrs:resultset/fmrs:record">

              <table width="98%" border="0" cellspacing="4" cellpadding="0" align="center" bgcolor="#FFFFCC">

                <xsl:variable name="record" select="current()"/>

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

.

.

.

<h1 class="bluebold">ECHO Partners at <a href="$record/fmrs:field[@name='institution']/fmrs:data[1]" target="_blank">

<xsl:attribute name="alt">Link to the <xsl:value-of select="$record/fmrs:field[@name='institutionurl']/fmrs:data[1]"/>. Please note that selecting this link will open a new browser window.</xsl:attribute>

<xsl:value-of select="$record/fmrs:field[@name='institution']/fmrs:data[1]"/></a></h1>

 
 



 Instead when I place my mouse on the link it shows:

 
 

http://xxx.xxx.xxx.xx/fmi/xsl/$record/fmrs:field[@name="institutionurl"]/fmrs:data[1]" in a new window

 

The other problem is if I take my href out of my <xsl:for-each etc., I get nothing. And I am wanting it above the <xsl:for-each part of my code.

Thanks,

Doug

Posted

this is the code that i have been using:


<a>

     <xsl:attribute name="href"><xsl:value-of select="fmrs:field[@name='institution']/fmrs:data"/></xsl:attribute>link verbage here

</a>

note: if you are inside a for-each loop you do not need the "$record/" record in any of your value-of statements. that part of the code is already there in the for-each statement. you don't need the "record" variable which calls current() because the for-each loop is already putting you in the current record.

Posted

Thanks kuma and martin,

It seems I am getting nowhere with this. I do have the fields on my layout. I can't get the link to show before my for-each and I can't get my email link inside of the for-each to work either. Would either of you have an example to share.

Thanks for the note kuma.

I now have what was selected on my index.xsl page showing in an href above my for-each but when I go to select it I get the following instead of the value institutionurl, which is a variable in my database:

 

http://xxx.xxx.xxx.xx/fmi/xsl/$record/fmrs:field[@name="institutionurl"]/fmrs:data[1]" in a new window

 



Here is the code I am using to show the institutionurl:

 
 

<xsl:variable name="ins" select="/fmrs:fmresultset/fmrs:resultset/fmrs:record[1]"/>



<h1 class="bluebold">ECHO Partners at <a href="$ins/fmrs:field[@name='institutionurl']/fmrs:data[1]" target="_blank">

<xsl:attribute name="alt">Link to the <xsl:value-of select="$ins/fmrs:field[@name='institutionurl']/fmrs:data[1]"/>. Please note that selecting this link will open a new browser window.</xsl:attribute>

<xsl:value-of select="$ins/fmrs:field[@name='institution']/fmrs:data[1]"/></a></h1>

 

Doug

This topic is 7096 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.