[XML4Lib] XSLT Question

Araby Y Greene araby at unr.edu
Wed Jul 5 08:42:18 EDT 2006


This works for me:
 
     <a href="{link}"><xsl:value-of select="title" /></a>

 
 
Araby
__________________________________
Araby Greene
Web Development Librarian
Getchell Library/322
University of Nevada, Reno
http://www.library.unr.edu 

________________________________

From: xml4lib-bounces at webjunction.org on behalf of Stephen Graham
Sent: Wed 7/5/2006 5:24 AM
To: xml4lib at webjunction.org
Subject: [XML4Lib] XSLT Question



I am trying to write some XSLT which transforms a RSS feed into XHTML. I
am very nearly there, but I am having problems with one specific aspect.
Te RSS feed is made up of various items like:

<item>
<title>Access to finance: women's enterprise and the role of the
accountant</title>
<link>http://gallifrey.london.edu/cgi-bin/unicrnsrch.pl?type=isbn&va
lue=1859084222</link>
<description>Marlow, Susan; Carter, Sara (2005)</description>
<category>Accounting</category>
<pubDate>Wed, 07 Jun 2006 23:00:00 GMT</pubDate>
</item>

I am using the XSLT element "<xsl:for-each>", which is looping thought
each item in the feed. I want the value of the link XML/RSS element to
be an actual HREF link for the title element. E.g.

<a href="LINK">TITLE</a>

This is what I currently have:

<xsl:for-each select="item">
        <tr>
        <td><a href="<xsl:value-of select="link"/>"><xsl:value-of
select="title"/></a></td>
        <td><xsl:value-of select="description"/></td>
        </tr>
</xsl:for-each>

This does not work for me, and when I view the RSS feed in the browser
(referencing the XSL syle sheet) I get an error like:

"The character '<' cannot be used in an attribute value. Error
processing resource 'http://unicorn.london.edu/cgi-bin/rss/bo...
<td><a href="<xsl:value-of select="link"/>"><xsl:value-of
select="title"/></a></..."

How do I go about making the title into a HREF using the link element as
the URL? I've tried assigning the value of the link element to a
xsl:param and a xsl:varaible, and then reference that, but I haven't
been successful. Any ideas/help would be appreciated.

Stephen

---------------------------
Stephen Graham
Electronic Library Team
Information Systems Division
London Business School
Regents Park, London NW1 4SA
Tel: +44 (0)20 7000 7000 ext. 4237
Fax: +44 (0)20 7706 1897

_______________________________________________
XML4Lib mailing list
XML4Lib at webjunction.org
http://lists.webjunction.org/mailman/listinfo/xml4lib




More information about the XML4Lib mailing list