Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 5th, 2011, 08:10 AM
Registered User
 
Join Date: Jan 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Question How format an RSS source with XSLT

Hello everyone

Here is my problem:

I have been trying to retrieve xml from an external RSS source and apply the XSLT that I have coded. Although everything seems normal, nothing was shown on the screen. But on the other hand, when I download the RSS source, my code is working perfectly with the offline xml file.

The source that I try to use is http://www.ntvmsnbc.com/id/24928286/device/rss/rss.xml, and I use

<xsl:variable name="ntv" select = "document('http://www.ntvmsnbc.com/id/24928286/device/rss/rss.xml')" />

this for pointing the remote file... but all I get is an empty page if there is no errors.

any ideas how to solve the problem? or am I missing some points?
 
Old January 5th, 2011, 08:24 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Please provide more details like the XSLT processor you are using, how exactly you run the XSLT transformation. For instance if you are using client-side XSLT in the browser then loading arbitrary documents is usually not allowed due to the same origin policy the browsers implement. Check the error console of your browser, it should tell you.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old January 5th, 2011, 08:49 AM
Registered User
 
Join Date: Jan 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

its xsltproc and i run it with a wrapper xml... i mean by using an empty xml file i call my xslt file and then by using document() to point the rss...
 
Old January 5th, 2011, 08:52 AM
Registered User
 
Join Date: Jan 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

and error console says :
no element found @line1
 
Old January 5th, 2011, 09:06 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Consider to post minimal but complete samples that allow us the reproduce the problem or at least understand it. First you said "but all I get is an empty page", no you get an error "no element found @line1".
I am not really an xsltproc user but I have a version here on Windows XP, when I use
Code:
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  
  <xsl:template match="/">
    <xsl:copy-of select="document('http://www.ntvmsnbc.com/id/24928286/device/rss/rss.xml')"/>
  </xsl:template>

</xsl:stylesheet>
with xsltproc against any XML input xsltproc outputs nothing but a warning: 'warning: failed to load external entity "http://www.ntvmsnbc.com/id/24928286/dev
ice/rss/rss.xml'

Saxon 6.5.5 does fine with the same stylesheet, I am not sure how to configure xsltproc to load the document successfully, maybe we have others here that are more familiar with that processor and know how to use it to pull files over HTTP.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old January 5th, 2011, 09:21 AM
Registered User
 
Join Date: Jan 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well thats nearly the same code with me actually... I am new to xslt stuff and only used xsltproc till now... I was confused when the offline rss was working as a standalone and thought that i was making a mistake somewhere, but I guess its because of processor differences...
thank you for your help





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 10 - RSS - rss.php file, the end channel tag should be moved down kenj BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 0 October 14th, 2010 10:19 PM
XML/XSLT/RSS feeds goldnmunk XSLT 5 July 24th, 2007 05:21 AM
2 Questions on XSLT for RSS Feed Tachyon XSLT 4 June 14th, 2007 06:00 PM
Translator XML source into Latex format rlduarte XSLT 0 April 11th, 2006 10:15 AM
Need to format data in xslt emils XSLT 1 November 3rd, 2005 02:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.