Subject: RE: Setting the value of the HREF attribute
From: David Schach <davidsch@xxxxxxxxxxxxx>
Date: Mon, 8 Feb 1999 08:59:44 -0800
|
This seems to be a common problem. You need to use the xsl:attribute
element. Try:
<xsl:template match="participants">
<xsl:for-each select="participant">
<!-- set the HREF attribute to the value of @link -->
<!-- this doesn't work: -->
<A >
<xsl:attribute name = "HREF"><xsl:value-of
select="@link"/></xsl:attriubte>click here</A> -->
<xsl:apply-templates/>
</xsl:for-each>
</xsl:template>
> -----Original Message-----
> From: Nigel Byrnes [SMTP:byrnes@xxxxxxxxxxxxxxxxxxxxxxxx]
> Sent: Monday, February 08, 1999 3:13 AM
> To: xsl-list@xxxxxxxxxxxxxxxx
> Subject: Setting the value of the HREF attribute
>
> Dear XSL-ers
>
> To become familiar with XML & XSL, I am in the process of representing a
> web site using these technologies. I have just reached a bit of a hurdle
> and wondered if you guys could offer some advice....
>
> Below is a fragment from a xml document which states Philips Research as
> a "participant". I want to use XSL to set produce a HTML page that
> includes a link to the Philips Research www site. My problem is that i
> don't know how to set the value of the HTML's HREF attribute to the
> specified URL.
>
> I have also included a fragment of the XSL style sheet which is to
> format the xml into html. If someone could offer a solution to my
> problem, that would be great.
>
> Thanks
>
> Nigel
>
> >>>>> Fragment of XML document
>
> <?xml version="1.0" encoding="UTF-8"?>
> <participants>
> <participant link="http://www.research.philips.com">Philips Research
> (UK)</participant>
> </participants>
>
> >>>>>>>>> Fragment of XSL Stylesheet
>
> <xsl:template match="participants">
> <xsl:for-each select="participant">
> <!-- set the HREF attribute to the value of @link -->
> <!-- this doesn't work: -->
> <!-- <A HREF="<xsl:value-of select="@link"/>">click here</A> -->
> <xsl:apply-templates/>
> </xsl:for-each>
> </xsl:template>
>
> --
> Nigel Byrnes
>
> "We continue..." Pete Tong
>
> Software Engineering and Applications Group,
> Philips Research Labs,
> Redhill. Tel: +44 (0)1293 815578
> RH1 5HA. Fax: +44 (0)1293 815024
> UK. GSM: +44 (0)7899 940391
> Email: byrnes@xxxxxxxxxxxxxxxxxxxxxxxx
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|