[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: counter vs. functional counterpart

Subject: Re: counter vs. functional counterpart
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Tue, 21 Jul 2009 06:04:11 -0700
Re:  counter vs. functional counterpart
On Mon, Jul 20, 2009 at 8:53 PM, Jeff
Shelley<jshelley@xxxxxxxxxxxxxxxxxxxx> wrote:
> Hello.
> B  Does anybody know what xsl file can take this:
>
> <rows>
> B  <row>
> B  B  B  <name>John</name>
> B  B  B  <otherName/>
> B  </row>
> B  <row>
> B  B  B  <name>Paul</name>
> B  B  B  <otherName/>
> B  </row>
> B  <row>
> B  B  B  <name>Ringo</name>
> B  B  B  <nickName>ClassCastException</nickName>
> B  </row>
> B  <row>
> B  B  B  <name>George</name>
> B  B  B  <otherName/>
> B  </row>
> </rows>
>
>
> and turn it into this?
>
> B  B  B  B 1-John
> B  B  B  B 2-Paul
> B  B  B  B 3-Ringo
> B  B  B  B 4-ClassCastException
> B  B  B  B 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>

--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.