Subject: [xsl] <xsl:call-template> error From: Jen Jiang <zhenjiang14221@xxxxxxxxx> Date: Thu, 4 Nov 2004 20:21:48 -0800 (PST) |
I have an xml which is a RSS feed link: <?xml-stylesheet href="getRSS.xsl" type="text/xsl"?> <RSSChannels> <!-- RSS 0.91 feeds --> <RSSChannel src="http://www.tinnitus-research.org/atr.xml"/> <!-- RSS 1.0 feeds --> <!-- RSS 2.0 feeds --> <RSSChannel src="http://www.medicinenet.com/rss/specialty/Tinnitus.xml"/> </RSSChannels> I use an xslt file to transfer RSS to HTML: <?xml version="1.0"?> <!-- getRSS.xsl: retrieve RSS feed(s) and convert to HTML. --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" version="1.0"> <xsl:output method="html" encoding="iso-8859-1"/> <xsl:template match="RSSChannels"> <html> <head> <title>Today's Headlines</title> </head> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="RSSChannel"> <xsl:apply-templates select="document(@src)"/> </xsl:template> <!-- Named template outputs HTML a element with href link and RSS description as title to show up in mouseOver message. --> <xsl:template name="a-element"> <xsl:element name="a"> <xsl:attribute name="href"><xsl:apply-templates select="*[local-name()='link']"/></xsl:attribute> <xsl:attribute name="title"><xsl:apply-templates select="*[local-name()='description']"/></xsl:attribute> <xsl:value-of select="*[local-name()='title']"/> </xsl:element> </xsl:template> <!-- Output RSS channel name as HTML a link inside of h1 element. --> <xsl:template match="*[local-name()='channel']"> <xsl:call-template name="a-element"/> <!-- Following line for RSS .091 --> <xsl:apply-templates select="*[local-name()='item']"/> </xsl:template> <!-- Output RSS item as HTML a link inside of p element. --> <xsl:template match="*[local-name()='item']"> <xsl:call-template name="a-element"/> <xsl:text> </xsl:text> <xsl:if test="dc:date"> <!-- Show date if available --> <xsl:text>( </xsl:text> <xsl:value-of select="dc:date"/> <xsl:text>) </xsl:text> </xsl:if> </xsl:template> </xsl:stylesheet> But when I ran it in browser it gave me error: "The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. -------------------------------------------------------------------------------- Keyword xsl:stylesheet may not contain xsl:call-template." I don't know why this happened. I have used <xsl:call-template> in <xsl:stylesheet> so many times (not these files) without getting the error. Thank you very much for any input. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] read variable from anothe, Manpreet Singh | Thread | RE: [xsl] <xsl:call-template> error, Pieter Reint Siegers |
RE: [xsl] read variable from anothe, Manpreet Singh | Date | [xsl] Preserving space between elem, Steven Reddie |
Month |