Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl Value of w/ namespace question. 1

Status
Not open for further replies.

j4606

MIS
Nov 28, 2005
349
US
Hi guys, Im having a problem adding a stylesheet to an xml file. I receive the following format of xml.
Code:
<?xml version="1.0" encoding="us-ascii"?>
<?xml-stylesheet type="text/xsl" href="seminars.xslt"?>
<rss version="2.0" xmlns:seminar="[URL unfurl="true"]http://www.test.com/rss/seminars">[/URL]
	<channel>
		<title>title1</title>
		<link>page.html</link>
		<description>desc desc desc</description>
		<language>en-us</language>
		<copyright>Copyright 2009</copyright>
		<item>
			<title>07/25/2009</title>
			<link>link 1</link>
			<description>testetestestes tseestse etstse</description>
			<seminar:date>2009-07-25</seminar:date>
			<seminar:time>1000</seminar:time>
			<seminar:gmtoffset>-6</seminar:gmtoffset>
			<seminar:city>Chicago</seminar:city>
			<seminar:state>IL</seminar:state>
			<seminar:country>US</seminar:country>
			<guid>test guid</guid>
			<pubDate>test date</pubDate>
		</item>
		<item>
			<title>07/25/2009</title>
			<link>link 2</link>
			<description>testetestestes tseestse etstse2</description>
			<seminar:date>2009-07-25</seminar:date>
			<seminar:time>1002</seminar:time>
			<seminar:gmtoffset>-2</seminar:gmtoffset>
			<seminar:city>Chicago2</seminar:city>
			<seminar:state>2</seminar:state>
			<seminar:country>US 2</seminar:country>
			<guid>test guid 2</guid>
			<pubDate>test date 2</pubDate>
		</item>
	</channel>
</rss>

What I basically need is to iterate through the items and get all the data. Unfortunately some nodes have a namespace "seminar".
I been trying for a few hours and couldn'tt get anything working. heres the best I xslt that I need help with.
Code:
<?xml version="1.0"?>
	<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL] xmlns:seminar="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
	<xsl:output method="html" />
	<xsl:template match="/">
		<xsl:for-each select="rss/channel/item">
				<xsl:value-of select="seminar:date"/>
		</xsl:for-each>
	</xsl:template>
	</xsl:stylesheet>


I tried using apply template and some other methods but I can't seem to get this working. Again I need to iterate through the "item" nodes and get each seminar date, seminar time ect.
Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top