Re: [xsl] counter vs. functional counterpart

Subject: Re: [xsl] counter vs. functional counterpart
From: Jeff Shelley <jshelley@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Jul 2009 10:39:35 -0700
Thanks, everybody, for your help. If anybody ever has any crazy Java questions, I owe you big time.

Dimitre Novatchev wrote:
On Mon, Jul 20, 2009 at 8:53 PM, Jeff
Shelley<jshelley@xxxxxxxxxxxxxxxxxxxx> wrote:
Hello.
  Does anybody know what xsl file can take this:

<rows>
  <row>
      <name>John</name>
      <otherName/>
  </row>
  <row>
      <name>Paul</name>
      <otherName/>
  </row>
  <row>
      <name>Ringo</name>
      <nickName>ClassCastException</nickName>
  </row>
  <row>
      <name>George</name>
      <otherName/>
  </row>
</rows>


and turn it into this?


1-John
2-Paul
3-Ringo
4-ClassCastException
5-George

This problem is so simple, that it doesn't ever need <xsl:number/>:


<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:output method="text"/>

	<xsl:template match="/">
	  <xsl:for-each select=
	     "*/*/*[self::name or self::nickName]">
	
	     <xsl:value-of select=
	       "concat('&#xA;', position(), '-', .)"/>
	  </xsl:for-each>
	</xsl:template>
</xsl:stylesheet>


-- Jeff Shelley, Director of Software Development Stuntman Software, Inc http://www.stuntmansoftware.com 949-533-4513

Current Thread