Iyou have ended upp with per...

Re: [xsl] increment variable with xsl:for-each
Thanks David.
M. David Peterson wrote:
Using a recursive call-template does the trick..
Basically you call a
template from within one template with a parameter that is set to the
beginning of the increment.
From within that template you test to see
if the value of the param meets whatever your criteria is and if it does
you output whatever it is you want and then call the same template, this
time incrementing the value of the included parameter by whatever you
want by adding the necessary arithmetic within the select statement e.g.
&$value + 1&
So this XSLT:
&?xml version=&1.0&?&
&xsl:stylesheet xmlns:xsl=&http://www.w3.org/1999/XSL/Transform&
version=&1.0&&
&xsl:output method=&html&/&
&xsl:template match=&/&&
&xsl:call-template name=&incrementValue&&
&xsl:with-param name=&value&&1&/xsl:with-param&
&/xsl:call-template&
&/xsl:template&
&xsl:template name=&incrementValue&&
&xsl:param name=&value&/&
&xsl:if test=&$value &= 10&&
&xsl:value-of select=&$value&/&
&xsl:call-template name=&incrementValue&&
&xsl:with-param name=&value& select=&$value + 1&/&
&/xsl:call-template&
&/xsl:template&
&/xsl:stylesheet&
Will output:
Best of luck!
-----Original Message-----
From: Tuan Luu [mailto:tuanluu@xxxxxx]
Sent: Friday, March 26,
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] increment variable with xsl:for-each
I'm looking for a code to increment a variable in xsl:for-each loop
I ended up here:
&xsl:variable name=&a&&1&/xsl:variable&
&xsl:for-each select=&name&&
&xsl:value of select=&{$a+1}&/&
&xsl:value of select=&{$a}&/&
&/xsl:for-each&
thanks for any answer
Current Thread
- Fri, 26 Mar :12 +0100 (MET)
- Fri, 26 Mar :17 +0100
- Fri, 26 Mar :03 -0700
Tuan Luu - Fri, 26 Mar :49 +0100&&=
- Fri, 26 Mar :36 +0100
- Fri, 26 Mar :39 -0000
&Possible follow-ups&
- Fri, 26 Mar :26 -0800
<- PreviousIndexNext ->
, M. David Peterson
, Andreas L. Delmelle
, Dan Vint
, Joseph SilvermanHow I ended up with so much Hacker News karma | John Graham-Cumming
On the Hacker News
I'm currently in position #12 with&32,360 points. I was curious to find out how I ended up in that position, so I used the &to pull down my complete submission and comment history.
Some headline numbers: I've been on Hacker News for well over 5 years (I joined on July 2, 2007) and have made 2,985 comments or submissions. That's 1.5 comments or submissions every day for over 5 years (I've actually commented far more than I've submitted: 670 2,315 comments). And for all those items I've received on average 10.8 points.
So, the first conclusion is: consistency over a long period.
Looking at comments and submissions separately, I've received 15,985 points for 2,315 comments and 18,119 points for 670 submissions. That means my average comment received 6.9 points, but my average submission received 27 points.
Second conclusion: good submissions earn way more points than comments (which was probably obvious).
Looking at the trend in points per submission it looks like things haven't changed much in 5 years. If you look at submissions that received below 200 points things look fairly consistent.
But it looks like I've got better at writing comments people vote up. Or perhaps the community has just grown and the number of upvotes has gone up for a well received comment.
Breaking the points gained for submissions into bands shows that I've earned a great deal of karma for stories that hit 50 to 200 points.
One thing I hoped to gain from this was insight into when my comments and posts did best on Hacker News. Here's the number of points I've gained by UTC hour for submissions:
So, for me at least, the peak times for submitting content to get karma are between 0900 and 1200 UTC (i.e. the morning in the UK). &Commenting has a very different pattern. It appears that it's better for me to submit stories in the morning UTC but wait until the afternoon (i.e. morning in California) to write comments.
But digging a little deeper shows that this pattern really happens because I comment more in the afternoons. Looking at the average points gained per comment by time reveals that it doesn't really matter when I comment.
And the pattern seen above for submissions gets similarly blurred. Although there are some slightly better times than others.
My conclusion is that if I want more points there's no point trying to game Hacker News. It doesn't really matter when I submit a story or write a comment. It's content that's king. That's good news for Hacker News because it indicates that what matters there is content and not game playing.
So, to answer my original question about how I ended up with that much karma: slowly, consistently, over years by submitting things that people like.
If you enjoyed this blog post, you might enjoy my travel book for people interested in science and technology: . Signed copies of The Geek Atlas are .

我要回帖

更多关于 you have ended up 的文章

 

随机推荐