SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Hybrid View
-
May 30, 2002, 10:26 #1
- Join Date
- May 2002
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Making attribute values from XML data in XSL
Nevermind, I got it to work. IE 6 was refusing to download the new stylesheet, even when prompted to do so. That's a strange quirk ... anyone else have this problem? By the way, I simply forgot to close an empty tag.
I scoured the article here and several others, and I still get errors when I try to make attribute values from my XML data using XSL. I'm trying to make a link from a piece of data called "link" and I want the link text to be "title". Below is my XSL stylesheet.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:template match="/rss/channel">
<html>
<head>
<title>stevenhasty.com | rss</title>
<style type="text/css">@import url("/x.css");</style>
</head>
<body>
<div id="main">
<h4><strong><xsl:value-of select="title" /></strong> - <xsl:value-of select="description" /></h4>
<xsl:apply-templates select="item" />
</div>
</body>
</html>
</xsl:template>
<xsl:template match="item">
<hr />
<p>
<a>
<xsl:attribute name="href">
<xsl:value-of select="link" />
</xsl:attribute>
<xsl:value-of select="title" />
</a>
</p>
<p><xsl:value-of select="description" /></p>
</xsl:template>
</xsl:stylesheet>Last edited by stevenhasty; May 30, 2002 at 10:47.
-
May 31, 2002, 14:54 #2
- Join Date
- Apr 2002
- Posts
- 79
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
http://www.stevenhasty.com/rss/channel --> does not exist (404)
XML Spy says it's well-formed, but:
"Unable to locate a reference to a supported schema kind within this document reference".
So it doesn't validate.
Bookmarks