[XML4Lib] XSLT Question
Tod Olson
tod at uchicago.edu
Wed Jul 5 09:27:08 EDT 2006
On Jul 5, 2006, at 7:24 AM, 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.
[snip]
> <td><a href="<xsl:value-of select="link"/>"><xsl:value-of
> select="title"/></a></td>
[snip]
> 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></..."
You should also be aware of the long-hand way to make elements and
attributes (from memory, verify details with your favorite reference):
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="link"/></
xsl:attribute>
</xsl:element name="a">
And, in case you are actually generating XHTML, xsl:element and
xsl:name have a namespace attribute. Oh, you can also attempt:
<a>
<xsl:attribute name="href"><xsl:value-of select="link"/></
xsl:attribute>
</a>
The <a> node is created in the output document, and the attribute is
added to the node. I can't remember if you have to be generating XML
for this to work.
Tod Olson <tod at uchicago.edu>
Programmer/Analyst
University of Chicago Library
More information about the XML4Lib
mailing list