Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl links

Status
Not open for further replies.

aharris88

Programmer
Dec 12, 2007
12
I am trying to take information from an xml document and display it in an xsl document. Everything works fine with these commands:
<xsl:for-each select="sermons/sermon">
<xsl:value-of select="date"/>

But how do a display a link in xsl if the url is stored in the xml document? I don't want to just display the url. I can do that. I want to display some text that links to that url.
 
<a>
<xsl:attribute name="href">[COLOR=blue white]place your URL link here[/color]</xsl:attribute>
[COLOR=red white]This is the text that is displayed[/color]</a>

Tom Morrison
 
Thanks, that works, but what if I want a more complicated link like:
<a href="../Sermons/07/10-7-07.mp3" target="_blank" onClick="javascript:playerOpen('Sermons Online', this.href); return false">
 
Code:
<a target="_blank" onClick="javascript:PlayerOpen('Sermons Online', this.href); return false">
<xsl:attribute name="href">
<xsl:value-of select="concat('../Sermons/', substring(date, string-length(date)-1,2), '/',date,'.mp3')"/>
</xsl:attribute>
[COLOR=red white]This is the text that is displayed[/color]</a>
[small]Typed, not tested[/small]

I made a presumption about where the /07/ came from, and also assumed that the date was already in the format 10-7-07 (e.g.).

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top