Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Parsing text into web page table entries?

Reply
Thread Tools

Parsing text into web page table entries?

 
 
.:mmac:.
Guest
Posts: n/a
 
      05-23-2005
I have a bunch of files (Playlist files for media player) and I am trying to
create an automatically generated web page that includes the last 20 or 30
of these files. The files are created every week and are named XX-XX-XX.ASX
where the X's represent the date i.e. 05-22-05.asx
The files are a specific format and will always contain tags like the
following:
<TITLE>My media file title</TITLE>
<AUTHOR>Media file author</AUTHOR>
<Ref href = "mms://media.mydomainname.com/2005/05-01-05.wma" />
I would like to parse these files for the info in the tags, Title, Author,
and Date and then add them to a table on a web page, but I have had no luck
creating the parsing on my own. Can anyone give me a good start in the right
direction using vbscript to get this going.
I especially have trouble pulling the date out since it is at the end of a
tag.. Though I suppose the filename could be used if that could be converted
into a properly formatted date i.e. May 1, 2005
Help?


 
Reply With Quote
 
 
 
 
Mark Schupp
Guest
Posts: n/a
 
      05-23-2005
Your input files appear to be in XML format. If that is the case then use
the MSXML parser. Unfortunately I don't have any sample code handy. But if
your input is XML let us know and I am sure that someone will be able to get
you started.

--
Mark Schupp



".:mmac:." <lost@sea> wrote in message
news:...
> I have a bunch of files (Playlist files for media player) and I am trying

to
> create an automatically generated web page that includes the last 20 or 30
> of these files. The files are created every week and are named

XX-XX-XX.ASX
> where the X's represent the date i.e. 05-22-05.asx
> The files are a specific format and will always contain tags like the
> following:
> <TITLE>My media file title</TITLE>
> <AUTHOR>Media file author</AUTHOR>
> <Ref href = "mms://media.mydomainname.com/2005/05-01-05.wma" />
> I would like to parse these files for the info in the tags, Title, Author,
> and Date and then add them to a table on a web page, but I have had no

luck
> creating the parsing on my own. Can anyone give me a good start in the

right
> direction using vbscript to get this going.
> I especially have trouble pulling the date out since it is at the end of a
> tag.. Though I suppose the filename could be used if that could be

converted
> into a properly formatted date i.e. May 1, 2005
> Help?
>
>



 
Reply With Quote
 
 
 
 
.:mmac:.
Guest
Posts: n/a
 
      05-23-2005
It's the windows media player playlist format, MS says:
"Advanced Stream Redirector (ASX) files are based on the Extensible Markup
Language (XML) syntax".
From this page
http://msdn.microsoft.com/library/de..._reference.asp
the page is for winCE but the syntax is the same as I am using.
Meanwhile I'll look into MSXML Parser...
thanks



"Mark Schupp" <> wrote in message
news:...
> Your input files appear to be in XML format. If that is the case then use
> the MSXML parser. Unfortunately I don't have any sample code handy. But if
> your input is XML let us know and I am sure that someone will be able to
> get
> you started.
>
> --
> Mark Schupp
>
>
>
> ".:mmac:." <lost@sea> wrote in message
> news:...
>> I have a bunch of files (Playlist files for media player) and I am trying

> to
>> create an automatically generated web page that includes the last 20 or
>> 30
>> of these files. The files are created every week and are named

> XX-XX-XX.ASX
>> where the X's represent the date i.e. 05-22-05.asx
>> The files are a specific format and will always contain tags like the
>> following:
>> <TITLE>My media file title</TITLE>
>> <AUTHOR>Media file author</AUTHOR>
>> <Ref href = "mms://media.mydomainname.com/2005/05-01-05.wma" />
>> I would like to parse these files for the info in the tags, Title,
>> Author,
>> and Date and then add them to a table on a web page, but I have had no

> luck
>> creating the parsing on my own. Can anyone give me a good start in the

> right
>> direction using vbscript to get this going.
>> I especially have trouble pulling the date out since it is at the end of
>> a
>> tag.. Though I suppose the filename could be used if that could be

> converted
>> into a properly formatted date i.e. May 1, 2005
>> Help?
>>
>>

>
>



 
Reply With Quote
 
Chris Hohmann
Guest
Posts: n/a
 
      05-23-2005
".:mmac:." <lost@sea> wrote in message
news:...
>I have a bunch of files (Playlist files for media player) and I am trying
>to create an automatically generated web page that includes the last 20 or
>30 of these files. The files are created every week and are named
>XX-XX-XX.ASX where the X's represent the date i.e. 05-22-05.asx
> The files are a specific format and will always contain tags like the
> following:
> <TITLE>My media file title</TITLE>
> <AUTHOR>Media file author</AUTHOR>
> <Ref href = "mms://media.mydomainname.com/2005/05-01-05.wma" />
> I would like to parse these files for the info in the tags, Title, Author,
> and Date and then add them to a table on a web page, but I have had no
> luck creating the parsing on my own. Can anyone give me a good start in
> the right direction using vbscript to get this going.
> I especially have trouble pulling the date out since it is at the end of a
> tag.. Though I suppose the filename could be used if that could be
> converted into a properly formatted date i.e. May 1, 2005
> Help?


Here's a proof of concept using the MSXML Parser

[ShowASX.asp]
<%
CONST PATH = "<<ASX DIRECTORY>>"
Dim xslt, xsl, proc, xml, fso, fld, fc, f
Set xsl = CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
xsl.Load Server.MapPath("asx2html.xsl")
Set xslt = CreateObject("MSXML2.XSLTemplate.4.0")
Set xslt.stylesheet = xsl
Set proc = xslt.createProcessor()
Set xml = CreateObject("MSXML2.DOMDocument.4.0")

Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder(PATH)
Set fc = fld.Files

Response.Write "<table border='1'>"
For Each f In fc
If Right(f.Name,4) = ".asx" Then
xml.Load Server.MapPath(f.Name)
proc.input = xml
proc.Transform
Response.Write proc.output
End If
Next
Response.Write "</table>"

Set f = Nothing
Set fc = Nothing
Set fld = Nothing
Set xml = Nothing
Set proc = Nothing
Set xslt = Nothing
Set xsl = Nothing
%>

[asx2html.xsl]
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html" version="4.0" indent="yes"/>
<xsl:template match="Asx">
<xsl:apply-templates select="Entry"/>
</xsl:template>
<xsl:template match="Entry">
<tr>
<td><xsl:value-of select="Title"/></td>
<td><xsl:value-of select="Author"/></td>
<td>
<xsl:call-template name="String2Date">
<xsl:with-param name="s"
select="substring(Ref/@href,string-length(Ref/@href)-11,"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template name="String2Date">
<xslaram name="s"/>
<xsl:variable name="m" select="substring($s,1,2)"/>
<xsl:variable name="d" select="substring($s,4,2)"/>
<xsl:variable name="y" select="substring($s,7,2)"/>
<xsl:choose>
<xsl:when test="$m='01'">January</xsl:when>
<xsl:when test="$m='02'">February</xsl:when>
<xsl:when test="$m='03'">March</xsl:when>
<xsl:when test="$m='04'">April</xsl:when>
<xsl:when test="$m='05'">May</xsl:when>
<xsl:when test="$m='06'">June</xsl:when>
<xsl:when test="$m='07'">July</xsl:when>
<xsl:when test="$m='08'">August</xsl:when>
<xsl:when test="$m='09'">September</xsl:when>
<xsl:when test="$m='10'">October</xsl:when>
<xsl:when test="$m='11'">November</xsl:when>
<xsl:when test="$m='12'">December</xsl:when>
</xsl:choose>
<xsl:value-of select="concat(' ',$d,', ')"/>
<xsl:choose>
<xsl:when test="$m &lt; '30'"><xsl:value-of
select="concat('20',$y)"/></xsl:when>
<xsltherwise><xsl:value-of select="concat('19',$y)"/></xsltherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>


Notes:
1. Make sure ShowASX.asp and asx2html.xsl are in the same directory.

2. In ShowASX.asp, you'll need to replace the MSXML version references to
whichever version of MSXML you're using, most likely 3.0. So, for example,
"MSXML2.DOMDocument.4.0" becomes "MSXML2.DOMDocument.3.0"

3. I used a cached template in this scenario since multiple xml files were
being processed by the same xsl stylesheet. This also has the advantage of
using a free-threaded xsl document object. As such, the xsl document can be
safely stored in the application scope which should yield some performance
benefits if the transformed playlists are to be accessed by multiple users.

4. Please consider using ISO standard date formats (YYYY-MM-DD).

HTH
-Chris Hohmann


 
Reply With Quote
 
.:mmac:.
Guest
Posts: n/a
 
      05-24-2005
Wow... thats deep, and I almost get what you are doing.. almost...
When I run the page the resulting page source code is only

<table border='1'></table>

nothing else.
I have looked for what could be the problem and can't locate it. No errors
are reported on screen.
any idea?


"Chris Hohmann" <> wrote in message
news:Ou%23VXF%...
> ".:mmac:." <lost@sea> wrote in message
> news:...
>>I have a bunch of files (Playlist files for media player) and I am trying
>>to create an automatically generated web page that includes the last 20 or
>>30 of these files. The files are created every week and are named
>>XX-XX-XX.ASX where the X's represent the date i.e. 05-22-05.asx
>> The files are a specific format and will always contain tags like the
>> following:
>> <TITLE>My media file title</TITLE>
>> <AUTHOR>Media file author</AUTHOR>
>> <Ref href = "mms://media.mydomainname.com/2005/05-01-05.wma" />
>> I would like to parse these files for the info in the tags, Title,
>> Author, and Date and then add them to a table on a web page, but I have
>> had no luck creating the parsing on my own. Can anyone give me a good
>> start in the right direction using vbscript to get this going.
>> I especially have trouble pulling the date out since it is at the end of
>> a tag.. Though I suppose the filename could be used if that could be
>> converted into a properly formatted date i.e. May 1, 2005
>> Help?

>
> Here's a proof of concept using the MSXML Parser
>
> [ShowASX.asp]
> <%
> CONST PATH = "<<ASX DIRECTORY>>"
> Dim xslt, xsl, proc, xml, fso, fld, fc, f
> Set xsl = CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
> xsl.Load Server.MapPath("asx2html.xsl")
> Set xslt = CreateObject("MSXML2.XSLTemplate.4.0")
> Set xslt.stylesheet = xsl
> Set proc = xslt.createProcessor()
> Set xml = CreateObject("MSXML2.DOMDocument.4.0")
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set fld = fso.GetFolder(PATH)
> Set fc = fld.Files
>
> Response.Write "<table border='1'>"
> For Each f In fc
> If Right(f.Name,4) = ".asx" Then
> xml.Load Server.MapPath(f.Name)
> proc.input = xml
> proc.Transform
> Response.Write proc.output
> End If
> Next
> Response.Write "</table>"
>
> Set f = Nothing
> Set fc = Nothing
> Set fld = Nothing
> Set xml = Nothing
> Set proc = Nothing
> Set xslt = Nothing
> Set xsl = Nothing
> %>
>
> [asx2html.xsl]
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet version="1.0"
> xmlnssl="http://www.w3.org/1999/XSL/Transform">
> <xslutput method="html" version="4.0" indent="yes"/>
> <xsl:template match="Asx">
> <xsl:apply-templates select="Entry"/>
> </xsl:template>
> <xsl:template match="Entry">
> <tr>
> <td><xsl:value-of select="Title"/></td>
> <td><xsl:value-of select="Author"/></td>
> <td>
> <xsl:call-template name="String2Date">
> <xsl:with-param name="s"
> select="substring(Ref/@href,string-length(Ref/@href)-11,"/>
> </xsl:call-template>
> </td>
> </tr>
> </xsl:template>
> <xsl:template name="String2Date">
> <xslaram name="s"/>
> <xsl:variable name="m" select="substring($s,1,2)"/>
> <xsl:variable name="d" select="substring($s,4,2)"/>
> <xsl:variable name="y" select="substring($s,7,2)"/>
> <xsl:choose>
> <xsl:when test="$m='01'">January</xsl:when>
> <xsl:when test="$m='02'">February</xsl:when>
> <xsl:when test="$m='03'">March</xsl:when>
> <xsl:when test="$m='04'">April</xsl:when>
> <xsl:when test="$m='05'">May</xsl:when>
> <xsl:when test="$m='06'">June</xsl:when>
> <xsl:when test="$m='07'">July</xsl:when>
> <xsl:when test="$m='08'">August</xsl:when>
> <xsl:when test="$m='09'">September</xsl:when>
> <xsl:when test="$m='10'">October</xsl:when>
> <xsl:when test="$m='11'">November</xsl:when>
> <xsl:when test="$m='12'">December</xsl:when>
> </xsl:choose>
> <xsl:value-of select="concat(' ',$d,', ')"/>
> <xsl:choose>
> <xsl:when test="$m &lt; '30'"><xsl:value-of
> select="concat('20',$y)"/></xsl:when>
> <xsltherwise><xsl:value-of select="concat('19',$y)"/></xsltherwise>
> </xsl:choose>
> </xsl:template>
> </xsl:stylesheet>
>
>
> Notes:
> 1. Make sure ShowASX.asp and asx2html.xsl are in the same directory.
>
> 2. In ShowASX.asp, you'll need to replace the MSXML version references to
> whichever version of MSXML you're using, most likely 3.0. So, for example,
> "MSXML2.DOMDocument.4.0" becomes "MSXML2.DOMDocument.3.0"
>
> 3. I used a cached template in this scenario since multiple xml files were
> being processed by the same xsl stylesheet. This also has the advantage of
> using a free-threaded xsl document object. As such, the xsl document can
> be safely stored in the application scope which should yield some
> performance benefits if the transformed playlists are to be accessed by
> multiple users.
>
> 4. Please consider using ISO standard date formats (YYYY-MM-DD).
>
> HTH
> -Chris Hohmann
>



 
Reply With Quote
 
Chris Hohmann
Guest
Posts: n/a
 
      05-24-2005
".:mmac:." <> wrote in message
news:%...
> "Chris Hohmann" <> wrote in message
> news:Ou%23VXF%...
>> ".:mmac:." <lost@sea> wrote in message
>> news:...
>>>I have a bunch of files (Playlist files for media player) and I am trying
>>>to create an automatically generated web page that includes the last 20
>>>or 30 of these files. The files are created every week and are named
>>>XX-XX-XX.ASX where the X's represent the date i.e. 05-22-05.asx
>>> The files are a specific format and will always contain tags like the
>>> following:
>>> <TITLE>My media file title</TITLE>
>>> <AUTHOR>Media file author</AUTHOR>
>>> <Ref href = "mms://media.mydomainname.com/2005/05-01-05.wma" />
>>> I would like to parse these files for the info in the tags, Title,
>>> Author, and Date and then add them to a table on a web page, but I have
>>> had no luck creating the parsing on my own. Can anyone give me a good
>>> start in the right direction using vbscript to get this going.
>>> I especially have trouble pulling the date out since it is at the end of
>>> a tag.. Though I suppose the filename could be used if that could be
>>> converted into a properly formatted date i.e. May 1, 2005
>>> Help?

>>
>> Here's a proof of concept using the MSXML Parser
>>
>> [ShowASX.asp]
>> <%
>> CONST PATH = "<<ASX DIRECTORY>>"
>> Dim xslt, xsl, proc, xml, fso, fld, fc, f
>> Set xsl = CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
>> xsl.Load Server.MapPath("asx2html.xsl")
>> Set xslt = CreateObject("MSXML2.XSLTemplate.4.0")
>> Set xslt.stylesheet = xsl
>> Set proc = xslt.createProcessor()
>> Set xml = CreateObject("MSXML2.DOMDocument.4.0")
>>
>> Set fso = CreateObject("Scripting.FileSystemObject")
>> Set fld = fso.GetFolder(PATH)
>> Set fc = fld.Files
>>
>> Response.Write "<table border='1'>"
>> For Each f In fc
>> If Right(f.Name,4) = ".asx" Then
>> xml.Load Server.MapPath(f.Name)
>> proc.input = xml
>> proc.Transform
>> Response.Write proc.output
>> End If
>> Next
>> Response.Write "</table>"
>>
>> Set f = Nothing
>> Set fc = Nothing
>> Set fld = Nothing
>> Set xml = Nothing
>> Set proc = Nothing
>> Set xslt = Nothing
>> Set xsl = Nothing
>> %>
>>
>> [asx2html.xsl]
>> <?xml version="1.0" encoding="utf-8"?>
>> <xsl:stylesheet version="1.0"
>> xmlnssl="http://www.w3.org/1999/XSL/Transform">
>> <xslutput method="html" version="4.0" indent="yes"/>
>> <xsl:template match="Asx">
>> <xsl:apply-templates select="Entry"/>
>> </xsl:template>
>> <xsl:template match="Entry">
>> <tr>
>> <td><xsl:value-of select="Title"/></td>
>> <td><xsl:value-of select="Author"/></td>
>> <td>
>> <xsl:call-template name="String2Date">
>> <xsl:with-param name="s"
>> select="substring(Ref/@href,string-length(Ref/@href)-11,"/>
>> </xsl:call-template>
>> </td>
>> </tr>
>> </xsl:template>
>> <xsl:template name="String2Date">
>> <xslaram name="s"/>
>> <xsl:variable name="m" select="substring($s,1,2)"/>
>> <xsl:variable name="d" select="substring($s,4,2)"/>
>> <xsl:variable name="y" select="substring($s,7,2)"/>
>> <xsl:choose>
>> <xsl:when test="$m='01'">January</xsl:when>
>> <xsl:when test="$m='02'">February</xsl:when>
>> <xsl:when test="$m='03'">March</xsl:when>
>> <xsl:when test="$m='04'">April</xsl:when>
>> <xsl:when test="$m='05'">May</xsl:when>
>> <xsl:when test="$m='06'">June</xsl:when>
>> <xsl:when test="$m='07'">July</xsl:when>
>> <xsl:when test="$m='08'">August</xsl:when>
>> <xsl:when test="$m='09'">September</xsl:when>
>> <xsl:when test="$m='10'">October</xsl:when>
>> <xsl:when test="$m='11'">November</xsl:when>
>> <xsl:when test="$m='12'">December</xsl:when>
>> </xsl:choose>
>> <xsl:value-of select="concat(' ',$d,', ')"/>
>> <xsl:choose>
>> <xsl:when test="$m &lt; '30'"><xsl:value-of
>> select="concat('20',$y)"/></xsl:when>
>> <xsltherwise><xsl:value-of select="concat('19',$y)"/></xsltherwise>
>> </xsl:choose>
>> </xsl:template>
>> </xsl:stylesheet>
>>
>>
>> Notes:
>> 1. Make sure ShowASX.asp and asx2html.xsl are in the same directory.
>>
>> 2. In ShowASX.asp, you'll need to replace the MSXML version references to
>> whichever version of MSXML you're using, most likely 3.0. So, for
>> example, "MSXML2.DOMDocument.4.0" becomes "MSXML2.DOMDocument.3.0"
>>
>> 3. I used a cached template in this scenario since multiple xml files
>> were being processed by the same xsl stylesheet. This also has the
>> advantage of using a free-threaded xsl document object. As such, the xsl
>> document can be safely stored in the application scope which should yield
>> some performance benefits if the transformed playlists are to be accessed
>> by multiple users.
>>
>> 4. Please consider using ISO standard date formats (YYYY-MM-DD).
>>
>> HTH
>> -Chris Hohmann
>>

>
> Wow... thats deep, and I almost get what you are doing.. almost...
> When I run the page the resulting page source code is only
>
> <table border='1'></table>
>
> nothing else.
> I have looked for what could be the problem and can't locate it. No errors
> are reported on screen.
> any idea?
>
>

Did you set the PATH constant correctly at the top of the ShowASX.asp page?


 
Reply With Quote
 
.:mmac:.
Guest
Posts: n/a
 
      05-24-2005
yes, I believe so, I used "E:\www\audio\myasxfiles"
the showasx and XML2html files are in the "audio" directory, I assume it's
OK to have it one level up as long as the path is right?
I "sniffed" the parser version from a utility on a web page and it found
v3.0 and I changed all the references to 3.0


"Chris Hohmann" <> wrote in message
news:uJr%...
> ".:mmac:." <> wrote in message
> news:%...
>> "Chris Hohmann" <> wrote in message
>> news:Ou%23VXF%...
>>> ".:mmac:." <lost@sea> wrote in message
>>> news:...
>>>>I have a bunch of files (Playlist files for media player) and I am
>>>>trying to create an automatically generated web page that includes the
>>>>last 20 or 30 of these files. The files are created every week and are
>>>>named XX-XX-XX.ASX where the X's represent the date i.e. 05-22-05.asx
>>>> The files are a specific format and will always contain tags like the
>>>> following:
>>>> <TITLE>My media file title</TITLE>
>>>> <AUTHOR>Media file author</AUTHOR>
>>>> <Ref href = "mms://media.mydomainname.com/2005/05-01-05.wma" />
>>>> I would like to parse these files for the info in the tags, Title,
>>>> Author, and Date and then add them to a table on a web page, but I
>>>> have had no luck creating the parsing on my own. Can anyone give me a
>>>> good start in the right direction using vbscript to get this going.
>>>> I especially have trouble pulling the date out since it is at the end
>>>> of a tag.. Though I suppose the filename could be used if that could be
>>>> converted into a properly formatted date i.e. May 1, 2005
>>>> Help?
>>>
>>> Here's a proof of concept using the MSXML Parser
>>>
>>> [ShowASX.asp]
>>> <%
>>> CONST PATH = "<<ASX DIRECTORY>>"
>>> Dim xslt, xsl, proc, xml, fso, fld, fc, f
>>> Set xsl = CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
>>> xsl.Load Server.MapPath("asx2html.xsl")
>>> Set xslt = CreateObject("MSXML2.XSLTemplate.4.0")
>>> Set xslt.stylesheet = xsl
>>> Set proc = xslt.createProcessor()
>>> Set xml = CreateObject("MSXML2.DOMDocument.4.0")
>>>
>>> Set fso = CreateObject("Scripting.FileSystemObject")
>>> Set fld = fso.GetFolder(PATH)
>>> Set fc = fld.Files
>>>
>>> Response.Write "<table border='1'>"
>>> For Each f In fc
>>> If Right(f.Name,4) = ".asx" Then
>>> xml.Load Server.MapPath(f.Name)
>>> proc.input = xml
>>> proc.Transform
>>> Response.Write proc.output
>>> End If
>>> Next
>>> Response.Write "</table>"
>>>
>>> Set f = Nothing
>>> Set fc = Nothing
>>> Set fld = Nothing
>>> Set xml = Nothing
>>> Set proc = Nothing
>>> Set xslt = Nothing
>>> Set xsl = Nothing
>>> %>
>>>
>>> [asx2html.xsl]
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <xsl:stylesheet version="1.0"
>>> xmlnssl="http://www.w3.org/1999/XSL/Transform">
>>> <xslutput method="html" version="4.0" indent="yes"/>
>>> <xsl:template match="Asx">
>>> <xsl:apply-templates select="Entry"/>
>>> </xsl:template>
>>> <xsl:template match="Entry">
>>> <tr>
>>> <td><xsl:value-of select="Title"/></td>
>>> <td><xsl:value-of select="Author"/></td>
>>> <td>
>>> <xsl:call-template name="String2Date">
>>> <xsl:with-param name="s"
>>> select="substring(Ref/@href,string-length(Ref/@href)-11,"/>
>>> </xsl:call-template>
>>> </td>
>>> </tr>
>>> </xsl:template>
>>> <xsl:template name="String2Date">
>>> <xslaram name="s"/>
>>> <xsl:variable name="m" select="substring($s,1,2)"/>
>>> <xsl:variable name="d" select="substring($s,4,2)"/>
>>> <xsl:variable name="y" select="substring($s,7,2)"/>
>>> <xsl:choose>
>>> <xsl:when test="$m='01'">January</xsl:when>
>>> <xsl:when test="$m='02'">February</xsl:when>
>>> <xsl:when test="$m='03'">March</xsl:when>
>>> <xsl:when test="$m='04'">April</xsl:when>
>>> <xsl:when test="$m='05'">May</xsl:when>
>>> <xsl:when test="$m='06'">June</xsl:when>
>>> <xsl:when test="$m='07'">July</xsl:when>
>>> <xsl:when test="$m='08'">August</xsl:when>
>>> <xsl:when test="$m='09'">September</xsl:when>
>>> <xsl:when test="$m='10'">October</xsl:when>
>>> <xsl:when test="$m='11'">November</xsl:when>
>>> <xsl:when test="$m='12'">December</xsl:when>
>>> </xsl:choose>
>>> <xsl:value-of select="concat(' ',$d,', ')"/>
>>> <xsl:choose>
>>> <xsl:when test="$m &lt; '30'"><xsl:value-of
>>> select="concat('20',$y)"/></xsl:when>
>>> <xsltherwise><xsl:value-of select="concat('19',$y)"/></xsltherwise>
>>> </xsl:choose>
>>> </xsl:template>
>>> </xsl:stylesheet>
>>>
>>>
>>> Notes:
>>> 1. Make sure ShowASX.asp and asx2html.xsl are in the same directory.
>>>
>>> 2. In ShowASX.asp, you'll need to replace the MSXML version references
>>> to whichever version of MSXML you're using, most likely 3.0. So, for
>>> example, "MSXML2.DOMDocument.4.0" becomes "MSXML2.DOMDocument.3.0"
>>>
>>> 3. I used a cached template in this scenario since multiple xml files
>>> were being processed by the same xsl stylesheet. This also has the
>>> advantage of using a free-threaded xsl document object. As such, the xsl
>>> document can be safely stored in the application scope which should
>>> yield some performance benefits if the transformed playlists are to be
>>> accessed by multiple users.
>>>
>>> 4. Please consider using ISO standard date formats (YYYY-MM-DD).
>>>
>>> HTH
>>> -Chris Hohmann
>>>

>>
>> Wow... thats deep, and I almost get what you are doing.. almost...
>> When I run the page the resulting page source code is only
>>
>> <table border='1'></table>
>>
>> nothing else.
>> I have looked for what could be the problem and can't locate it. No
>> errors are reported on screen.
>> any idea?
>>
>>

> Did you set the PATH constant correctly at the top of the ShowASX.asp
> page?
>



 
Reply With Quote
 
Chris Hohmann
Guest
Posts: n/a
 
      05-24-2005
".:mmac:." <> wrote in message
news:...
> "Chris Hohmann" <> wrote in message
> news:uJr%...
>> ".:mmac:." <> wrote in message
>> news:%...
>>> "Chris Hohmann" <> wrote in message
>>> news:Ou%23VXF%...
>>>> ".:mmac:." <lost@sea> wrote in message
>>>> news:...
>>>>>I have a bunch of files (Playlist files for media player) and I am
>>>>>trying to create an automatically generated web page that includes the
>>>>>last 20 or 30 of these files. The files are created every week and are
>>>>>named XX-XX-XX.ASX where the X's represent the date i.e. 05-22-05.asx
>>>>> The files are a specific format and will always contain tags like the
>>>>> following:
>>>>> <TITLE>My media file title</TITLE>
>>>>> <AUTHOR>Media file author</AUTHOR>
>>>>> <Ref href = "mms://media.mydomainname.com/2005/05-01-05.wma" />
>>>>> I would like to parse these files for the info in the tags, Title,
>>>>> Author, and Date and then add them to a table on a web page, but I
>>>>> have had no luck creating the parsing on my own. Can anyone give me a
>>>>> good start in the right direction using vbscript to get this going.
>>>>> I especially have trouble pulling the date out since it is at the end
>>>>> of a tag.. Though I suppose the filename could be used if that could
>>>>> be converted into a properly formatted date i.e. May 1, 2005
>>>>> Help?
>>>>
>>>> Here's a proof of concept using the MSXML Parser
>>>>
>>>> [ShowASX.asp]
>>>> <%
>>>> CONST PATH = "<<ASX DIRECTORY>>"
>>>> Dim xslt, xsl, proc, xml, fso, fld, fc, f
>>>> Set xsl = CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
>>>> xsl.Load Server.MapPath("asx2html.xsl")
>>>> Set xslt = CreateObject("MSXML2.XSLTemplate.4.0")
>>>> Set xslt.stylesheet = xsl
>>>> Set proc = xslt.createProcessor()
>>>> Set xml = CreateObject("MSXML2.DOMDocument.4.0")
>>>>
>>>> Set fso = CreateObject("Scripting.FileSystemObject")
>>>> Set fld = fso.GetFolder(PATH)
>>>> Set fc = fld.Files
>>>>
>>>> Response.Write "<table border='1'>"
>>>> For Each f In fc
>>>> If Right(f.Name,4) = ".asx" Then
>>>> xml.Load Server.MapPath(f.Name)
>>>> proc.input = xml
>>>> proc.Transform
>>>> Response.Write proc.output
>>>> End If
>>>> Next
>>>> Response.Write "</table>"
>>>>
>>>> Set f = Nothing
>>>> Set fc = Nothing
>>>> Set fld = Nothing
>>>> Set xml = Nothing
>>>> Set proc = Nothing
>>>> Set xslt = Nothing
>>>> Set xsl = Nothing
>>>> %>
>>>>
>>>> [asx2html.xsl]
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <xsl:stylesheet version="1.0"
>>>> xmlnssl="http://www.w3.org/1999/XSL/Transform">
>>>> <xslutput method="html" version="4.0" indent="yes"/>
>>>> <xsl:template match="Asx">
>>>> <xsl:apply-templates select="Entry"/>
>>>> </xsl:template>
>>>> <xsl:template match="Entry">
>>>> <tr>
>>>> <td><xsl:value-of select="Title"/></td>
>>>> <td><xsl:value-of select="Author"/></td>
>>>> <td>
>>>> <xsl:call-template name="String2Date">
>>>> <xsl:with-param name="s"
>>>> select="substring(Ref/@href,string-length(Ref/@href)-11,"/>
>>>> </xsl:call-template>
>>>> </td>
>>>> </tr>
>>>> </xsl:template>
>>>> <xsl:template name="String2Date">
>>>> <xslaram name="s"/>
>>>> <xsl:variable name="m" select="substring($s,1,2)"/>
>>>> <xsl:variable name="d" select="substring($s,4,2)"/>
>>>> <xsl:variable name="y" select="substring($s,7,2)"/>
>>>> <xsl:choose>
>>>> <xsl:when test="$m='01'">January</xsl:when>
>>>> <xsl:when test="$m='02'">February</xsl:when>
>>>> <xsl:when test="$m='03'">March</xsl:when>
>>>> <xsl:when test="$m='04'">April</xsl:when>
>>>> <xsl:when test="$m='05'">May</xsl:when>
>>>> <xsl:when test="$m='06'">June</xsl:when>
>>>> <xsl:when test="$m='07'">July</xsl:when>
>>>> <xsl:when test="$m='08'">August</xsl:when>
>>>> <xsl:when test="$m='09'">September</xsl:when>
>>>> <xsl:when test="$m='10'">October</xsl:when>
>>>> <xsl:when test="$m='11'">November</xsl:when>
>>>> <xsl:when test="$m='12'">December</xsl:when>
>>>> </xsl:choose>
>>>> <xsl:value-of select="concat(' ',$d,', ')"/>
>>>> <xsl:choose>
>>>> <xsl:when test="$m &lt; '30'"><xsl:value-of
>>>> select="concat('20',$y)"/></xsl:when>
>>>> <xsltherwise><xsl:value-of
>>>> select="concat('19',$y)"/></xsltherwise>
>>>> </xsl:choose>
>>>> </xsl:template>
>>>> </xsl:stylesheet>
>>>>
>>>>
>>>> Notes:
>>>> 1. Make sure ShowASX.asp and asx2html.xsl are in the same directory.
>>>>
>>>> 2. In ShowASX.asp, you'll need to replace the MSXML version references
>>>> to whichever version of MSXML you're using, most likely 3.0. So, for
>>>> example, "MSXML2.DOMDocument.4.0" becomes "MSXML2.DOMDocument.3.0"
>>>>
>>>> 3. I used a cached template in this scenario since multiple xml files
>>>> were being processed by the same xsl stylesheet. This also has the
>>>> advantage of using a free-threaded xsl document object. As such, the
>>>> xsl document can be safely stored in the application scope which should
>>>> yield some performance benefits if the transformed playlists are to be
>>>> accessed by multiple users.
>>>>
>>>> 4. Please consider using ISO standard date formats (YYYY-MM-DD).
>>>>
>>>> HTH
>>>> -Chris Hohmann
>>>>
>>>
>>> Wow... thats deep, and I almost get what you are doing.. almost...
>>> When I run the page the resulting page source code is only
>>>
>>> <table border='1'></table>
>>>
>>> nothing else.
>>> I have looked for what could be the problem and can't locate it. No
>>> errors are reported on screen.
>>> any idea?
>>>
>>>

>> Did you set the PATH constant correctly at the top of the ShowASX.asp
>> page?
>>

>
> yes, I believe so, I used "E:\www\audio\myasxfiles"
> the showasx and XML2html files are in the "audio" directory, I assume it's
> OK to have it one level up as long as the path is right?
> I "sniffed" the parser version from a utility on a web page and it found
> v3.0 and I changed all the references to 3.0
>
>

You renamed the xsl stylesheet to XML2html? If so, you'll need to adjust
ShowASX.asp accordingly. It references a file called asx2html.xsl. Also
please post your responses below the quoted text. Top-posting makes it very
difficult to follow the flow of the conversation.


 
Reply With Quote
 
.:mmac:.
Guest
Posts: n/a
 
      05-24-2005

"Chris Hohmann" <> wrote in message
news:...
> ".:mmac:." <> wrote in message
> news:...
>> "Chris Hohmann" <> wrote in message
>> news:uJr%...
>>> ".:mmac:." <> wrote in message
>>> news:%...
>>>> "Chris Hohmann" <> wrote in message
>>>> news:Ou%23VXF%...
>>>>> ".:mmac:." <lost@sea> wrote in message
>>>>> news:...
>>>>>>I have a bunch of files (Playlist files for media player) and I am
>>>>>>trying to create an automatically generated web page that includes the
>>>>>>last 20 or 30 of these files. The files are created every week and are
>>>>>>named XX-XX-XX.ASX where the X's represent the date i.e. 05-22-05.asx
>>>>>> The files are a specific format and will always contain tags like the
>>>>>> following:
>>>>>> <TITLE>My media file title</TITLE>
>>>>>> <AUTHOR>Media file author</AUTHOR>
>>>>>> <Ref href = "mms://media.mydomainname.com/2005/05-01-05.wma" />
>>>>>> I would like to parse these files for the info in the tags, Title,
>>>>>> Author, and Date and then add them to a table on a web page, but I
>>>>>> have had no luck creating the parsing on my own. Can anyone give me a
>>>>>> good start in the right direction using vbscript to get this going.
>>>>>> I especially have trouble pulling the date out since it is at the end
>>>>>> of a tag.. Though I suppose the filename could be used if that could
>>>>>> be converted into a properly formatted date i.e. May 1, 2005
>>>>>> Help?
>>>>>
>>>>> Here's a proof of concept using the MSXML Parser
>>>>>
>>>>> [ShowASX.asp]
>>>>> <%
>>>>> CONST PATH = "<<ASX DIRECTORY>>"
>>>>> Dim xslt, xsl, proc, xml, fso, fld, fc, f
>>>>> Set xsl = CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
>>>>> xsl.Load Server.MapPath("asx2html.xsl")
>>>>> Set xslt = CreateObject("MSXML2.XSLTemplate.4.0")
>>>>> Set xslt.stylesheet = xsl
>>>>> Set proc = xslt.createProcessor()
>>>>> Set xml = CreateObject("MSXML2.DOMDocument.4.0")
>>>>>
>>>>> Set fso = CreateObject("Scripting.FileSystemObject")
>>>>> Set fld = fso.GetFolder(PATH)
>>>>> Set fc = fld.Files
>>>>>
>>>>> Response.Write "<table border='1'>"
>>>>> For Each f In fc
>>>>> If Right(f.Name,4) = ".asx" Then
>>>>> xml.Load Server.MapPath(f.Name)
>>>>> proc.input = xml
>>>>> proc.Transform
>>>>> Response.Write proc.output
>>>>> End If
>>>>> Next
>>>>> Response.Write "</table>"
>>>>>
>>>>> Set f = Nothing
>>>>> Set fc = Nothing
>>>>> Set fld = Nothing
>>>>> Set xml = Nothing
>>>>> Set proc = Nothing
>>>>> Set xslt = Nothing
>>>>> Set xsl = Nothing
>>>>> %>
>>>>>
>>>>> [asx2html.xsl]
>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>> <xsl:stylesheet version="1.0"
>>>>> xmlnssl="http://www.w3.org/1999/XSL/Transform">
>>>>> <xslutput method="html" version="4.0" indent="yes"/>
>>>>> <xsl:template match="Asx">
>>>>> <xsl:apply-templates select="Entry"/>
>>>>> </xsl:template>
>>>>> <xsl:template match="Entry">
>>>>> <tr>
>>>>> <td><xsl:value-of select="Title"/></td>
>>>>> <td><xsl:value-of select="Author"/></td>
>>>>> <td>
>>>>> <xsl:call-template name="String2Date">
>>>>> <xsl:with-param name="s"
>>>>> select="substring(Ref/@href,string-length(Ref/@href)-11,"/>
>>>>> </xsl:call-template>
>>>>> </td>
>>>>> </tr>
>>>>> </xsl:template>
>>>>> <xsl:template name="String2Date">
>>>>> <xslaram name="s"/>
>>>>> <xsl:variable name="m" select="substring($s,1,2)"/>
>>>>> <xsl:variable name="d" select="substring($s,4,2)"/>
>>>>> <xsl:variable name="y" select="substring($s,7,2)"/>
>>>>> <xsl:choose>
>>>>> <xsl:when test="$m='01'">January</xsl:when>
>>>>> <xsl:when test="$m='02'">February</xsl:when>
>>>>> <xsl:when test="$m='03'">March</xsl:when>
>>>>> <xsl:when test="$m='04'">April</xsl:when>
>>>>> <xsl:when test="$m='05'">May</xsl:when>
>>>>> <xsl:when test="$m='06'">June</xsl:when>
>>>>> <xsl:when test="$m='07'">July</xsl:when>
>>>>> <xsl:when test="$m='08'">August</xsl:when>
>>>>> <xsl:when test="$m='09'">September</xsl:when>
>>>>> <xsl:when test="$m='10'">October</xsl:when>
>>>>> <xsl:when test="$m='11'">November</xsl:when>
>>>>> <xsl:when test="$m='12'">December</xsl:when>
>>>>> </xsl:choose>
>>>>> <xsl:value-of select="concat(' ',$d,', ')"/>
>>>>> <xsl:choose>
>>>>> <xsl:when test="$m &lt; '30'"><xsl:value-of
>>>>> select="concat('20',$y)"/></xsl:when>
>>>>> <xsltherwise><xsl:value-of
>>>>> select="concat('19',$y)"/></xsltherwise>
>>>>> </xsl:choose>
>>>>> </xsl:template>
>>>>> </xsl:stylesheet>
>>>>>
>>>>>
>>>>> Notes:
>>>>> 1. Make sure ShowASX.asp and asx2html.xsl are in the same directory.
>>>>>
>>>>> 2. In ShowASX.asp, you'll need to replace the MSXML version references
>>>>> to whichever version of MSXML you're using, most likely 3.0. So, for
>>>>> example, "MSXML2.DOMDocument.4.0" becomes "MSXML2.DOMDocument.3.0"
>>>>>
>>>>> 3. I used a cached template in this scenario since multiple xml files
>>>>> were being processed by the same xsl stylesheet. This also has the
>>>>> advantage of using a free-threaded xsl document object. As such, the
>>>>> xsl document can be safely stored in the application scope which
>>>>> should yield some performance benefits if the transformed playlists
>>>>> are to be accessed by multiple users.
>>>>>
>>>>> 4. Please consider using ISO standard date formats (YYYY-MM-DD).
>>>>>
>>>>> HTH
>>>>> -Chris Hohmann
>>>>>
>>>>
>>>> Wow... thats deep, and I almost get what you are doing.. almost...
>>>> When I run the page the resulting page source code is only
>>>>
>>>> <table border='1'></table>
>>>>
>>>> nothing else.
>>>> I have looked for what could be the problem and can't locate it. No
>>>> errors are reported on screen.
>>>> any idea?
>>>>
>>>>
>>> Did you set the PATH constant correctly at the top of the ShowASX.asp
>>> page?
>>>

>>
>> yes, I believe so, I used "E:\www\audio\myasxfiles"
>> the showasx and XML2html files are in the "audio" directory, I assume
>> it's OK to have it one level up as long as the path is right?
>> I "sniffed" the parser version from a utility on a web page and it found
>> v3.0 and I changed all the references to 3.0
>>
>>

> You renamed the xsl stylesheet to XML2html? If so, you'll need to adjust
> ShowASX.asp accordingly. It references a file called asx2html.xsl. Also
> please post your responses below the quoted text. Top-posting makes it
> very difficult to follow the flow of the conversation.
>

Sorry
no I didn't rename the stylesheet, I just called it the wrong name in my
hurried reply. I used the name you gave it.



 
Reply With Quote
 
.:mmac:.
Guest
Posts: n/a
 
      05-24-2005

"Chris Hohmann" <> wrote in message
news:%...
> "Chris Hohmann" <> wrote in message
> news:...
>> ".:mmac:." <> wrote in message
>> news:...
>>> "Chris Hohmann" <> wrote in message
>>> news:uJr%...
>>>> ".:mmac:." <> wrote in message
>>>> news:%...
>>>>> "Chris Hohmann" <> wrote in message
>>>>> news:Ou%23VXF%...
>>>>>> ".:mmac:." <lost@sea> wrote in message
>>>>>> news:...
>>>>>>>I have a bunch of files (Playlist files for media player) and I am
>>>>>>>trying to create an automatically generated web page that includes
>>>>>>>the last 20 or 30 of these files. The files are created every week
>>>>>>>and are named XX-XX-XX.ASX where the X's represent the date i.e.
>>>>>>>05-22-05.asx

> [snip]
>
> Ugh! The extention on your playlist files is ".ASX", not ".asx" right?
> Because your original post is ambigous on that point. Replace the
> following line in ShowASX.asp:
>
> If Right(f.Name,4) = ".asx" Then
>
> With this line:
>
> If UCase(Right(f.Name,4)) = ".ASX" Then
>
>


no, they are all lowercase, but the change makes sense anyway.
I didn't know this would be case sensitive but I should 'cause I ran into
that before.
Bearing that in mind, is this line" <xsl:template match="Asx">" in the style
sheet OK as far as case goes?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing XML into PHP to insert into a MySQL DB impulse() XML 0 10-13-2006 03:05 PM
Parsing text into dates? Thomas W Python 9 05-17-2005 11:20 PM
Parsing a text file into an array Scott Perl 1 08-17-2004 04:21 PM
How do I insert date of web page into the web page? Bob K. HTML 5 05-16-2004 10:06 AM
parsing data file into mysql table - help smrtalec Perl Misc 3 02-23-2004 11:49 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57