Hyperlink Email
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Wed Oct 26, 2011 11:35 pm
Hyperlink Email
I am a definite noob when it comes to XSL and am trying to assist a co-worker in gaining functionality with her database. My code looks like this:
<td align="left">
<xsl:for-each select="fmrs:resultset/fmrs:record/fmrs:field[@name='Contacts::email']/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"> </xsl:text>
</xsl:if>
</xsl:for-each>
</td>
I'm trying to make it where the email address that appears in the browser becomes hyperlinked. The email addresses are dynamic and not static. Any help would be greatly appreciated. Thanks!
<td align="left">
<xsl:for-each select="fmrs:resultset/fmrs:record/fmrs:field[@name='Contacts::email']/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"> </xsl:text>
</xsl:if>
</xsl:for-each>
</td>
I'm trying to make it where the email address that appears in the browser becomes hyperlinked. The email addresses are dynamic and not static. Any help would be greatly appreciated. Thanks!
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Hyperlink Email
Hello,
Assign the current node(the email address) to a variable and add an anchor with the value from this variable(<a href="mailto:email" class="link">email</a>). Can be written in XSLT as:
If the current node is not the email address, simply modify the expression in the select from the variable with the appropriate one.
Regards,
Adrian
Assign the current node(the email address) to a variable and add an anchor with the value from this variable(<a href="mailto:email" class="link">email</a>). Can be written in XSLT as:
Code: Select all
<xsl:variable name="email" select="."/>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:text>mailto:</xsl:text>
<xsl:value-of select="$email"/>
</xsl:attribute>
<xsl:value-of select="$email"/>
</xsl:element>
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service