[XML4Lib] XSLT Question
Enrico Silterra
es287 at cornell.edu
Wed Jul 5 08:52:03 EDT 2006
If what you have transcribed is accurate,
and from the error message it sounds like it is:
the error is in the way you have tried to embed the link into
the href.
xsl elements cannot be made part of an attribute value in this way.
Remember that the xsl document is also an xml document, and must be
parseable as
such.
try this:
<a>
<xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
<xsl:value-of
select="title"/>
</a>
or use attribute value substitution.
<a href="{link}"><xsl:value-of select="title"/></a>
http://www.w3.org/TR/xslt#attribute-value-templates
Rick
At 08:24 AM 7/5/2006, Stephen Graham wrote:
>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
******************************
Enrico Silterra
Meta Data Engineer
107-E Olin Library
Cornell University
Ithaca NY 14853
Voice: 607-255-6851
Fax: 607-255-6110
E-mail: es287 at cornell.edu
http://www.library.cornell.edu/cts/
"We must walk consciously only part way toward our goal, and then leap in
the dark to our success." - - Thoreau
******************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webjunction.org/wjlists/xml4lib/attachments/20060705/aff90a81/attachment.htm
More information about the XML4Lib
mailing list