[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Hyperlinks [newbie Q]

Subject: Re: Hyperlinks [newbie Q]
From: Nic Ferrier <nferrier@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 26 Jan 2005 12:13:44 +0000
xsl hyperlinks
Aaron Johnson <Aaron2.Johnson@xxxxxxxxx> writes:

> I would like the text 'XML Hyperlink' to be a link on the rendered html
> page.
>
> I want it so that if you need to change the url, you change it in the
> xml rather than in the xsl.
>
> How do I get the xsl to make this a hyper link? 
>
> XML:
>
> <welcome>
> 	<text>This is some welcome text</text>
> 	<link url="http://www.somthing.co.uk">XML Hyperlink</link>
> </welcome>
>
> XSL so far:
>
> <?xml version='1.0' encoding='utf-8'?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="html" indent="no" encoding="UTF-8"/>
>
> <xsl:template match="/">
> 	<html>
>
> 	<xsl:for-each select="welcome/text">
> 	<p><xsl:value-of select="."/></p>
> 	</xsl:for-each>
>
> 	<xsl:for-each select="welcome/link">
> 	<p<xsl:value-of select="."/></p>
> 	</xsl:for-each>
>
> 	</html>
> </xsl:template>
> </xsl:stylesheet>

Something like:

  <xsl:for-each select="welcome/text">
     <p>  
       <a>
        <xsl:attribute name="href">
            <xsl:value-of select=../link/@url"/>
        </xsl:attribute>
        <xsl:value-of select="."/>
       </a>
     </p>
  </xsl:for-each>


> Does any one have any pointers to tutorials? Any help would be
> appreciated thank you.

There are lots of good books. The archives of this list are a good
place to start looking for pointers:

> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
Nic Ferrier
http://www.tapsellferrier.co.uk

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.