AW: [xsl] XML Query!

Subject: AW: [xsl] XML Query!
From: Delaney Robin <Robin.Delaney@xxxxxxx>
Date: Fri, 10 Jan 2003 12:36:21 +0100
Hello Rakesh,

I hope not, otherwise I spent a few days wasting my time before Xmas :-)

I had a need also to create CSV from XML and with the help of the many
"unsung heroes" in xsl-list, whose patience and willingness to share
knowledge amazes me at times, I managed to do what I needed. Here's a piece
of what I ended up with. You'll have to change it to suit your needs but it
does the basics. It only extracts the element and attribute values of "leaf
nodes" (descendants that don't have children). The seperator is currently a
"!". 

Hope it helps.

############################
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:output method="text"/>
 	<xsl:template match="xyz">
  		  	<xsl:for-each select="(.//*[not(*)]|.//@*)"
				<xsl:value-of select="."/>	
				<xsl:if test="position()!=last()">!</xsl:if>

			</xsl:for-each> 
			<xsl:text>&#10;</xsl:text>

  	</xsl:template>
    </xsl:stylesheet>
############################


Cheers,

Robin
                                                     
Robin Delaney
FJA Feilmeier & Junker GmbH		    
web  http://www.fja.com

> -----Ursprüngliche Nachricht-----
> Von:	Rakesh Seth [SMTP:RakeshSeth@xxxxxxxxxx]
> Gesendet am:	Freitag, 10. Januar 2003 11:08
> An:	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff:	[xsl] XML Query!
> 
> Hi
> I want to convert XML data into a csv file.Is there any parser available
> for that?
> 
> Rakesh Sheth
> rakeshseth@xxxxxxxxxx
> rakeshsheth@xxxxxx
> Tel.No.-6952222
> Extn.No.-1122
> Tel.No.(Resi.)-3802293
> 
> 
> 
> 
> MASTEK
> Investing in relationships
> In the US, we're called MAJESCO
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This
> e-mail and attachments (if any) transmitted with it are confidential
> and/or privileged and solely for the use of the intended person or entity
> to which it is addressed. Any review, re-transmission, dissemination or
> other use of or taking of any action in reliance upon this information by
> persons or entities other than the intended recipient is prohibited. This
> e-mail and its attachments have been scanned for the presence of computer
> viruses. It is the responsibility of the recipient to run the virus check
> on e-mails and attachments before opening them. If you have received this
> e-mail in error, kindly delete this e-mail from all computers.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread