xsl for an rdf file, src attribute won't create correct link to image file

J

j erickson

with the following xsl and xml file, the display of the gif file with
the <image/url> tag works. However, the gif file in the <description>
tag using the name attribute "src" won't make the correct link to the
gif file. why?


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:lc="http://my.netscape.com/rdf/simple/0.9/">

<xsl:eek:utput method="html" />

<xsl:template match="lc:RDF">

<HTML>
<HEAD>
<TITLE>Resource Display Page</TITLE>
</HEAD>
<BODY>
<xsl:apply-templates select="lc:item"/>
</BODY>
</HTML>
</xsl:template>

<xsl:template match="lc:item">
<P> </P>

<a><xsl:attribute name="href"><xsl:value-of select="lc:link"
/></xsl:attribute>link
</a>

<P>image</P>
<TR>
<TD>
<xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of
select="lc:description/@src" /></xsl:attribute>
<xsl:attribute name="border"><xsl:value-of
select="lc:description/@Border" /></xsl:attribute>
</xsl:element>
</TD>
</TR>
</xsl:template>


<xsl:template match="lc:image">

<img><xsl:attribute name="src"><xsl:value-of select="lc:url"
/></xsl:attribute>
<xsl:attribute name="width"><xsl:value-of select="lc:width"
/></xsl:attribute>
<xsl:attribute name="height"><xsl:value-of select="lc:height"
/></xsl:attribute>
</img>

<P>image</P>
<TR>
<TD>
<xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of
select="lc:description/@src" /></xsl:attribute>
<xsl:attribute name="border"><xsl:value-of
select="lc:description/@Border" /></xsl:attribute>
</xsl:element>
</TD>
</TR>
</xsl:template>


</xsl:stylesheet>





<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://my.netscape.com/rdf/simple/0.9/">
<channel>
<title>Dilbert</title>
<link>http://dwlt.net/tapestry/</link>
<description>Tapestry :: RSS Delivery of Web Comics</description>
</channel>
<image>
<title>Dilbert</title>
<url>http://dwlt.net/tapestry/img/tapestry.gif</url>
<link>http://dwlt.net/tapestry/</link>
<width>88</width>
<height>31</height>
</image>
<item>
<title>Dilbert for 09 Jun 2004</title>
<link>http://www.dilbert.com/comics/dilbert/archive/dilbert-20040609.html</link>
<guid isPermaLink="false">http://www.dilbert.com/comics/dilbert/archive/dilbert-20040609.html</guid>
<description>
&lt;img src="http://www.dilbert.com/comics/dilbert/archive/images/dilbert2004067240609.gif"
border="0" /&gt;
</description>
</item>
<item>
<title>Dilbert for 08 Jun 2004</title>
<link>http://www.dilbert.com/comics/dilbert/archive/dilbert-20040608.html</link>
<guid isPermaLink="false">http://www.dilbert.com/comics/dilbert/archive/dilbert-20040608.html</guid>
<description>
&lt;img src="http://www.dilbert.com/comics/dilbert/archive/images/dilbert2061008040608.gif"
border="0" /&gt;
</description>
</item>
<item>
<title>Dilbert for 07 Jun 2004</title>
<link>http://www.dilbert.com/comics/dilbert/archive/dilbert-20040607.html</link>
<guid isPermaLink="false">http://www.dilbert.com/comics/dilbert/archive/dilbert-20040607.html</guid>
<description>
&lt;img src="http://www.dilbert.com/comics/dilbert/archive/images/dilbert21220170040607.gif"
border="0" /&gt;
</description>
</item>
</rdf:RDF>
 
J

Johannes Koch

j said:
with the following xsl and xml file, the display of the gif file with
the <image/url> tag works. However, the gif file in the <description>
tag using the name attribute "src" won't make the correct link to the
gif file. why?
<xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of
select="lc:description/@src" /></xsl:attribute>
<xsl:attribute name="border"><xsl:value-of
select="lc:description/@border" /></xsl:attribute>
</xsl:element>

1. the description element from the namespace prefixed with lc has no
src attribute
2. there is no img element in the description element, just text
(&lt;img ... /&gt; is _not_ <img ... />).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top