Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Convert xml file to plain text file Convert xml file to plain text fileTo: NULL Date: 6/14/2007 1:39:00 PM
Hi!
I have an xml file where I want to extract certain texts and create a text
file.
<?xml version="1.0" encoding="UTF-8"?>
<HEADER>
<ROWS>
<ROW>
<TEXT>TEST row1</TEXT>
</ROW>
<ROW>
<TEXT>TEST row 2</TEXT>
</ROW>
<ROW>
<TEXT>TEST row 3</TEXT>
</ROW>
</ROWS>
</HEADER>
will output a textfile with
Test row1
Test row2
Test row3
I have not worked much with xsl but I tried to create a stylesheet like
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:apply-templates select="HEADER/ROWS/ROW"/>
</xsl:template>
<xsl:template match="HEADER/ROWS/ROW">
<xsl:value-of select="TEXT" />
</xsl:template>
</xsl:stylesheet>
And then call (from VB6 where doc is a domdocument that contains the xml
document, stylesheet is also a domdocument holding the styleheet and
MyStream is a Adodb.Stream object)
doc.transformNodeToObject stylesheet, MyStream
MyStream.SaveToFile("c.\test.txt")
but the file is always empty.
Regards
/Hans
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
