RE: [xsl] Select first two elements

Subject: RE: [xsl] Select first two elements
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 14 Jan 2006 08:28:10 -0000
You've probably forgotten that the element names are in a namespace, but
since you haven't shown us your failing code, we can only guess what you've
done wrong.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: mac.rost@xxxxxxxxx [mailto:mac.rost@xxxxxxxxx] 
> Sent: 14 January 2006 06:05
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [Norton AntiSpam] [xsl] Select first two elements
> 
> It's been a while since I have done any XSL (maybe 2 1/2 
> years!) I have a 
> friend that wants his last 2 posts from an atom xml feed to 
> show. I'm *trying* 
> to get any for loop that I can find in xsl to work, but 
> nothing is at all.
> 
> Basic structure is like so:
> <feed>
>      <entry>
>            <title></title>
>            <content></content>
>      </entry>
>      ...
>      ...
> </feed>
> 
> I just need to be able to select the first two in the xml 
> doc. Once I can get 
> this, you won't hear a peep from me in another two years!
> 
> example:
> ==================================
> <feed xmlns="http://purl.org/atom/ns#"; version="0.3" xml:lang="en-US">
> 	<link href="https://www.blogger.com/atom/6526525"; 
> rel="service.post" 
> title="Quality Crash Tests" type="application/atom+xml"/>
> 	<link href="https://www.blogger.com/atom/6526525"; 
> rel="service.feed" 
> title="Quality Crash Tests" type="application/atom+xml"/>
> 	<title mode="escaped" type="text/html">Quality Crash 
> Tests</title>
> 	<tagline mode="escaped" type="text/html">You make me 
> dizzy, running 
> circles in my head. One of these days I'll chase you down. </tagline>
> 	<link href="http://www.qualitycrashtests.com/blog.html"; 
> rel="alternate" 
> title="Quality Crash Tests" type="text/html"/>
> 	<id>tag:blogger.com,1999:blog-6526525</id>
> 	<modified>2005-11-18T04:08:17Z</modified>
> 	<generator url="http://www.blogger.com/"; 
> version="5.15">Blogger</generator>
> 	<info mode="xml" type="text/html">
> 		<div xmlns="http://www.w3.org/1999/xhtml";>This 
> is an Atom 
> formatted XML site feed. It is intended to be viewed in a 
> Newsreader or 
> syndicated to another site. Please visit the <a 
> href="http://help.blogger.com/bin/answer.py?answer=697";>Blogge
> r Help</a> for 
> more info.</div>
> 	</info>
> 	<convertLineBreaks 
> xmlns="http://www.blogger.com/atom/ns#";>true</convertLineBreaks>
> 	<entry xmlns="http://purl.org/atom/ns#";>
> 		<link 
> href="https://www.blogger.com/atom/6526525/113228545952389772"; 
> rel="service.edit" title="Testing" type="application/atom+xml"/>
> 		<author>
> 			<name>B</name>
> 		</author>
> 		<issued>2005-11-17T21:43:00-06:00</issued>
> 		<modified>2005-11-18T03:44:19Z</modified>
> 		<created>2005-11-18T03:44:19Z</created>
> 		<link 
> href="http://www.qualitycrashtests.com/2005/11/testing.html"; 
> rel="alternate" 
> title="Testing" type="text/html"/>
> 		<id>tag:blogger.com,1999:blog-6526525.post-
> 113228545952389772</id>
> 		<title mode="escaped" type="text/html">Testing</title>
> 		<content type="application/xhtml+xml" 
> xml:base="http://www.qualitycrashtests.com/blog.html"; 
> xml:space="preserve">
> 			<div 
> xmlns="http://www.w3.org/1999/xhtml";>I'm testing 
> to see if the change I just made is working. Maybe. Maybe not.</div>
> 		</content>
> 		<draft 
> xmlns="http://purl.org/atom-blog/ns#";>false</draft>
> 	</entry>
> 	<entry xmlns="http://purl.org/atom/ns#";>
> 		<link 
> href="https://www.blogger.com/atom/6526525/113211592413384759"; 
> rel="service.edit" title="President Who?" 
> type="application/atom+xml"/>
> 		<author>
> 			<name>B</name>
> 		</author>
> 		<issued>2005-11-15T22:30:00-06:00</issued>
> 		<modified>2005-11-16T04:38:44Z</modified>
> 		<created>2005-11-16T04:38:44Z</created>
> 		<link 
> href="http://www.qualitycrashtests.com/2005/11/president-
> who.html" rel="alternate" title="President Who?" type="text/html"/>
> 		<id>tag:blogger.com,1999:blog-6526525.post-
> 113211592413384759</id>
> 		<title mode="escaped" 
> type="text/html">President Who?</title>
> 		<content type="application/xhtml+xml" 
> xml:base="http://www.qualitycrashtests.com/blog.html"; 
> xml:space="preserve">
> </content>
> </entry>
> </feed>

Current Thread