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

newbie q: xml to txt - please help!

Subject: newbie q: xml to txt - please help!
From: "milena schrevel" <milena_s@xxxxxxxxxxxxxxxx>
Date: Tue, 29 Oct 2002 12:51:01 +0000
xml to txt
hi all,
TASK: i want to exctract certain data from a xml-file, which contains programdetails of several tv channels, and put it into a txt-file (one textfile for each tvchannel). the programm should read from the xml file the data starting from 6:00 am of the next day till 5:59 am of the day after that. (this will be executed once a day for every following day.) 

QUESTIONS: can my problem be solved with xsl/xslt, or do i need another programminglanguage (vbscript or c)? how will get xsl sysdate? there are 22 tvchannels in the xmlfile, for every channel i need a different textfile. how to pass parameter?
thanx!
milena schrevel

XML-FILE:
...
<RESOURCE id="EVENTLIST_AAA"> 
  <EVENTLIST originalnetworkid="2" transportstreamid="1099" serviceid="0x2EE5" servicename="AAA"> 			
  <EVENT eventid="0x23BB96"> 	
    <STARTTIME country="deu" date="21.09.2002" time="16:00:00" /> 
    <DURATION country="deu" time="01:00" /> 
    <SHORTEVENTDESC language="ger">	
    <EVENTNAME>News</EVENTNAME> 
    </SHORTEVENTDESC> 
  </EVENT> 
  <EVENT eventid="0x23BB7A">
    <STARTTIME country="deu" date="21.09.2002" time="17:00:00" />
    <DURATION country="deu" time="00:15" />
    <SHORTEVENTDESC language="ger">
    <EVENTNAME>Weather</EVENTNAME>
    </SHORTEVENTDESC>
  </EVENT>
  </EVENTLIST> 
</RESOURCE> 
<RESOURCE id="EVENTLIST_BBB">
  <EVENTLIST originalnetworkid="2" transportstreamid="1099" serviceid="0x2EF3" servicename="BBB">
  <EVENT eventid="0x23A6A1">................</EVENT>
  </EVENTLIST> 
</RESOURCE> 
.........
		
example of output aaa.txt :  
aaa  21.09.2002  16:00:00  News
aaa  21.09.2002  17:00:00  Weather

My first XSL-FILE, which does the job wihtout checking for the dates and only for one tvchannel:(
 
<?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" media-type = "text/plain" encoding="ISO-8859-1"/>
<xsl:strip-space elements="*"/>
<xsl:template match="RESOURCE[@id='EVENTLIST_AAA']"> 
	<xsl:for-each select="EVENTLIST/EVENT">
		<xsl:if test = "DURATION[@time!='00:00']">
			<xsl:text>aaa	</xsl:text>
			<xsl:apply-templates/>
			<xsl:text>
</xsl:text>			
		</xsl:if>
	</xsl:for-each>
</xsl:template>
<xsl:template match = "STARTTIME">
	<xsl:value-of select = "@date"/>
	<xsl:text> </xsl:text>
	<xsl:value-of select = "@time"/>
	<xsl:text>	</xsl:text>
</xsl:template>
<xsl:template match = "SHORTEVENTDESC">
	<xsl:apply-templates/>
</xsl:template>
<xsl:template match = "EVENTNAME">
	<xsl:value-of select = "."/>
</xsl:template>
</xsl:stylesheet>

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


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.