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[(_at_)id='EVENTLIST_AAA']">
<xsl:for-each select="EVENTLIST/EVENT">
<xsl:if test = "DURATION[(_at_)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