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 February 10th, 2009, 02:23 AM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSL Code Help - Passing RSS URL

Hi,

I am new to XSL. I need help in passing the below RSS Feed URL to through this XSL Code so that it fetches the Title and description from the Feed:
The URL that i need to pass is :http://infotech.indiatimes.com/rssfeeds/2663900.cms

Where exactly do i need to include this URL, someone please help, this is an urgent requirement :(

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/>
<xsl:template match="rss">
<!-- Do not show channel image -->
<xsl:for-each select="channel/item">
<xsl:if test="position() &lt;= 7">
<br>
<strong><a href="{link}" target="_new"><xsl:value-of select="title"/></a></strong><br></br>
<!-- only display markup for description if it's present -->
<xsl:value-of select="description" disable-output-escaping="yes"/>
</br>
<br></br>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="description">
<br>
<xsl:value-of select="."/>
</br>
</xsl:template>
</xsl:stylesheet>
 
Old February 24th, 2009, 05:33 AM
Authorized User
 
Join Date: Feb 2009
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts
Default Me Too

I'd just like to chime in that I would also like to know how to do this. I just bought the XSLT 2.0 & XPath 2.0 Programmer's Reference and I didn't find this anywhere.

I'm working with XMLSpy now but I'd like my XSLT file to work without it as well. I need to call a specific URL for the RSS Feed and then follow the contained link to get more data. Can this be done in XSLT?

Rob
 
Old February 24th, 2009, 05:56 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If the document is the principal input to the stylesheet, then the way in which you supply it as input depends on the API to your chosen XSLT processor, which varies depending what product you are using.

If the document is a secondary input, then you can read it by calling the document() function.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old February 24th, 2009, 06:10 AM
Authorized User
 
Join Date: Feb 2009
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Well In my case it is secondary... Could you give an example of using the document() function to access a given URL? For example I want to access https://www.test.com/rss?variable where the variable would be different each time it's accessed and then extract text from the resulting data. Thanks in advance for the help.


Rob
 
Old February 24th, 2009, 06:15 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It's just like any other function call, for example

<xsl:apply-templates select="document(concat('https:///www.test.com/rss?', $var))" mode="rss"/>
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old February 24th, 2009, 06:32 AM
Authorized User
 
Join Date: Feb 2009
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Thank you! I appreciate it.



Rob





Similar Threads
Thread Thread Starter Forum Replies Last Post
RSS Code for python 2.5 (pyxml Vs 4Suite) dsampson BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2 1 February 12th, 2008 10:49 AM
URL variables in XSL Pinguin89 XSLT 1 March 16th, 2006 10:57 AM
code for rss work hsascubaboy RSS and Atom 2 May 29th, 2005 06:51 PM
From RSS to XML with XSL wene XSLT 0 December 17th, 2004 10:11 AM
Passing URL data Brian_S Dreamweaver (all versions) 2 December 1st, 2003 08:22 AM





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