PDA

View Full Version : Trouble with my RSS parser XSLT


me'
12-23-2003, 09:57 PM
Some simple XSLT:<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>RSS Feed Parser</title>
</head>
<body>
<h1>RSS Feed Parser</h1>
<xsl:for-each match="rss/channel/item">
<h2><xsl:value-of select="title" /></h2>
<p><xsl:value-of select="description" /></p>
</xsl:for-each>
</body>
</html>
</xsl:template>

</xsl:stylesheet>Gives a cryptic 'Error loading stylesheet: Parsing an XSLT stylesheet failed.' message in Mozilla. No line reference, reason for the error, etc. Just that. It's probably something stupid, but I think my XSLT is all well-formed, and I don't see what's wrong.

Insight?

Oh, and another question, putting a doctype in the XSLT won't get past the parser, and comes up with a badly formed error. Is there a fix for this?

me'
12-24-2003, 08:52 PM
Fixed it. It's select="" with <xsl:for-each>.

Thankyou to those 23 people that viewed my post though :D

sololb45
08-28-2006, 04:52 PM
I am getting the same error message. Could you look at this sheet and tell me what you changed to fix it. I am a noob to XSL. VERY TIME SENSITIVE, I have to have this fixed TODAY. Thanks, Jamie Coomes in Chicago, IL.

Jamie

Is the error in the begining of my sheet?

<BR/><xsl:apply-templates/>
<BR/><BR/><P ALIGN="CENTER" STYLE="font-size:8pt;font-family:arial;">© 2006 International Truck and Engine Corporation</P><BR/>
</BODY>

</xsl:element>
</xsl:template>

<!-- This is the top-level rule for ISIS-II XML. -->
<!-- I think that this standard wrapper tag should begin and end all of your XML files -->
<!-- so that general styles can be applied to all the documents. -->
<!-- This template also adds a footer with the copyright statement. -->

<xsl:template match="text()">
<xsl:value-of/>
</xsl:template>
<!-- Emit the actual text between the tags. -->

<!-- Jan 24, 2005 -->

<xsl:template match="para">

<xsl:choose>

<xsl:when test="@id[.>' ']">
<xsl:element name="DIV">
<xsl:attribute name="ID"><xsl:value-of select="@id"/></xsl:attribute>
</xsl:element>
</xsl:when>

</xsl:choose>

<!-- end Jan 24, 2005 -->

<P>
<xsl:apply-templates/>
</P>
</xsl:template>
<!-- Std. paragraph template. -->

<xsl:template match="hotlnk">

<!-- new January 23, 2001
-->
<xsl:choose>
<xsl:when test="con_toc">
</xsl:when>
<xsl:otherwise>

<xsl:element name="A">
<!-- new January 23, 2001
-->

<!-- only use the # if the xrefid is valued January 5, 2001 -->

<xsl:choose>
<xsl:when test="@xrefid[.>' ']">
<xsl:attribute name="HREF"><xsl:value-of select="@document"/>#<xsl:value-of select="@xrefid"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="HREF"><xsl:value-of select="@document"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>

<!-- Phil added the following one line -->
<xsl:attribute name="target"><xsl:value-of select="@target"/></xsl:attribute>
<xsl:apply-templates/>
</xsl:element>

<!-- new January 23, 2001
-->
</xsl:otherwise>
</xsl:choose>
<!-- new January 23, 2001
-->

</xsl:template>
<!-- Assume that xrefid attr value will contain # character and/or URL if needed. -->
<!-- Phil added the following code for exhotlnk -->

<xsl:template match="exhotlnk">

<xsl:element name="A">


....there is more but can not post everything, too big.

Thanks,

Jamie