Topic: creating mailto: link from xsl (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=22227" title="Pages that link to Topic: creating mailto: link from xsl (Page 1 of 1)" rel="nofollow" >Topic: creating mailto: link from xsl <span class="small">(Page 1 of 1)</span>\

 
gmisener
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Jun 2004

posted posted 06-17-2004 19:27

First of, Im a newbie at xml/xsl. I was required to learn it for work, and Im the only one here that is doing it, so i have no one around here to turn to. Ive been trying to get a mailto: link to display properly, but once the document is processed, the best i could get was <a mailto:""></a>
Thus, I have turned to you the wise for a little guidance.

I have an xml document that looks like this:

code:
<facultylisting>
<faculty>Faculty Name</faculty>
<facultymember>
<membername>Name</membername>
<cred>Credentials</cred>
<title>Title</title>
<officelocation>Room 11</officelocation>
<location>Heritage Floor, Richardson Center</location>
<telephone>123-555-1234</telephone>
<fax>123-555-5678</fax>
<email>cutschallc@xxxxxxx.ca</email>
</facultymember>




Im trying to get the email address to appear as <a href="mailto:cutschallc@xxxxx.ca">cutschallc@xxxxx.ca</a>

Xsl looks like this:

code:
<xsl:for-each select="//facultymember">
<tr>
<td colspan="3" class="featureheading"><xsl:value-of select="membername"/></td>
</tr>
<tr>
<td width="125" rowspan="7"><xsl:text>&#xA0;</xsl:text><!-- STAFF IMAGE WILL GO HERE --></td>
<td colspan="2" width="235" class="contents"><strong><xsl:value-of select="cred"/></strong></td>
</tr>
<tr>
<td colspan="2" class="featureheading"><xsl:value-of select="title"/></td>
</tr>
<tr>
<td colspan="2" class="contents"><xsl:value-of select="officelocation"/></td>
</tr>
<tr>
<td colspan="2" class="contents"><xsl:value-of select="location"/></td>
</tr>
<tr>
<td colspan="2" class="contents"><strong>Phone: </strong><xsl:value-of select="telephone"/></td>
</tr>
<tr>
<td colspan="2" class="contents"><strong>Fax: </strong><xsl:value-of select="fax"/></td>
</tr>
**This is where i need the email link to go **
<tr>
<td colspan="2" class="contents"><strong>Email: </strong></td>
</tr>
<tr>
<td colspan="3" class="contents"><xsl:text>&#xA0;</xsl:text></td>
</tr>
</xsl:for-each>
</table>


Any ideas? Ive tried a couple things unsuccessfully.

Any suggestions?

Any help is SO GREATLY APPRECIATED!!!

-greg

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 06-17-2004 19:41

gmisener: Welcome.
You need to create your A tag and use the xsl:attribute tag to "feed" it the value of you email XML tag.

gmisener
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Jun 2004

posted posted 06-17-2004 20:45

I have put the following code in:

<strong>Email: </strong><a><xsl:attribute name="href">mailto:</xsl:attribute><xsl:value-of select="email" /></a>

Which almost works correctly. I get the following from the output:

<strong>Email: </strong><a href="mailto:">cutschallc@xxxxxxxx.ca</a>



Im not entirely sure how to put the address inside the <a href="mailto">



-greg

(Edited by gmisener on 06-17-2004 20:46)

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 06-17-2004 20:50

that's almost it. The xsl:attribute can be used that way :

code:
<tag><xsl:attribute name="name_of_the_attribute">whatever you want</xsl:attribute> something else</tag>

Whigh outputs :

code:
<tag name_of_the_attribute="whatever you want" > something else</tag>

Now, it should be easy to get your mailto link.



(Edited by poi on 06-17-2004 20:56)

gmisener
Obsessive-Compulsive (I) Inmate

From:
Insane since: Jun 2004

posted posted 06-17-2004 22:22

Right on!! Thanks for your help, it is GREATLY APPRECIATED. The way things have been going, im probably pretty sure ill have some other questions in the future, but Thanks for the help with this topic.

My correct code looks like this:

<strong>Email: </strong><a><xsl:attribute name="href">mailto:<xsl:value-of select="email" /></xsl:attribute><xsl:value-of select="email" /></a>


Once again, Thanks

-greg



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu