[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Hyperlinks [newbie Q]


Subject: Re: [xsl] Hyperlinks [newbie Q]
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Wed, 26 Jan 2005 12:10:04 -0000

Try this
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="welcome">
   <html>
      <xsl:value-of select = "text"/>
      <br/>
      <a href="{link/@url}">
       <xsl:value-of select = "link"/>
      </a>

   </html>


</xsl:template>
</xsl:stylesheet>
HTH
Vasu

----- Original Message ----- 
From: "Aaron Johnson" <Aaron2.Johnson@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, January 26, 2005 11:58 AM
Subject: [xsl] Hyperlinks [newbie Q]


Hi...

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>


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

Aaron


This email has been independently scanned for viruses and any virus software
has been removed using McAfee anti-virus software


Current Thread
Keywords