xsl-list
[Top] [All Lists]

RE: Hyperlinks [newbie Q]

2005-01-26 05:02:57
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>

You want

<xsl:for-each select="welcome/link">
  <a href="{(_at_)url}"><xsl:value-of select="."/></a>
</xsl:for-each>

Cheers,

Jarno

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>