467,146 Members | 1,308 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,146 developers. It's quick & easy.

Parsing text into web page table entries?

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?
Jul 22 '05 #1
  • viewed: 2955
Share:
35 Replies
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:eo**************@TK2MSFTNGP15.phx.gbl...
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?

Jul 22 '05 #2
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" <no****@nospam.com> wrote in message
news:Or**************@TK2MSFTNGP14.phx.gbl...
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:eo**************@TK2MSFTNGP15.phx.gbl...
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?


Jul 22 '05 #3
".:mmac:." <lost@sea> wrote in message
news:eo**************@TK2MSFTNGP15.phx.gbl...
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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output 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,8)"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template name="String2Date">
<xsl:param 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>
<xsl:otherwise><xsl:value-of select="concat('19',$y)"/></xsl:otherwise>
</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
Jul 22 '05 #4
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" <no****@thankyou.com> wrote in message
news:Ou*****************@TK2MSFTNGP10.phx.gbl...
".:mmac:." <lost@sea> wrote in message
news:eo**************@TK2MSFTNGP15.phx.gbl...
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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output 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,8)"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template name="String2Date">
<xsl:param 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>
<xsl:otherwise><xsl:value-of select="concat('19',$y)"/></xsl:otherwise>
</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

Jul 22 '05 #5
".:mmac:." <no@thank.you> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ou*****************@TK2MSFTNGP10.phx.gbl...
".:mmac:." <lost@sea> wrote in message
news:eo**************@TK2MSFTNGP15.phx.gbl...
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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output 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,8)"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template name="String2Date">
<xsl:param 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>
<xsl:otherwise><xsl:value-of select="concat('19',$y)"/></xsl:otherwise>
</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?
Jul 22 '05 #6
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" <no****@thankyou.com> wrote in message
news:uJ****************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ou*****************@TK2MSFTNGP10.phx.gbl...
".:mmac:." <lost@sea> wrote in message
news:eo**************@TK2MSFTNGP15.phx.gbl...
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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output 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,8)"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template name="String2Date">
<xsl:param 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>
<xsl:otherwise><xsl:value-of select="concat('19',$y)"/></xsl:otherwise>
</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?

Jul 22 '05 #7
".:mmac:." <no@thank.you> wrote in message
news:OL**************@TK2MSFTNGP14.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:uJ****************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ou*****************@TK2MSFTNGP10.phx.gbl...
".:mmac:." <lost@sea> wrote in message
news:eo**************@TK2MSFTNGP15.phx.gbl...
>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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output 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,8)"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template name="String2Date">
<xsl:param 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>
<xsl:otherwise><xsl:value-of
select="concat('19',$y)"/></xsl:otherwise>
</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.
Jul 22 '05 #8
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ot*************@TK2MSFTNGP14.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:OL**************@TK2MSFTNGP14.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:uJ****************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ou*****************@TK2MSFTNGP10.phx.gbl...
> ".:mmac:." <lost@sea> wrote in message
> news:eo**************@TK2MSFTNGP15.phx.gbl...
>>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
Jul 22 '05 #9

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ot*************@TK2MSFTNGP14.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:OL**************@TK2MSFTNGP14.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:uJ****************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ou*****************@TK2MSFTNGP10.phx.gbl...
> ".:mmac:." <lost@sea> wrote in message
> news:eo**************@TK2MSFTNGP15.phx.gbl...
>>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"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output 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,8)"/>
> </xsl:call-template>
> </td>
> </tr>
> </xsl:template>
> <xsl:template name="String2Date">
> <xsl:param 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>
> <xsl:otherwise><xsl:value-of
> select="concat('19',$y)"/></xsl:otherwise>
> </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.

Jul 22 '05 #10

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ot*************@TK2MSFTNGP14.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:OL**************@TK2MSFTNGP14.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:uJ****************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> "Chris Hohmann" <no****@thankyou.com> wrote in message
> news:Ou*****************@TK2MSFTNGP10.phx.gbl...
>> ".:mmac:." <lost@sea> wrote in message
>> news:eo**************@TK2MSFTNGP15.phx.gbl...
>>>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?
Jul 22 '05 #11

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ot*************@TK2MSFTNGP14.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:OL**************@TK2MSFTNGP14.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:uJ****************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> "Chris Hohmann" <no****@thankyou.com> wrote in message
> news:Ou*****************@TK2MSFTNGP10.phx.gbl...
>> ".:mmac:." <lost@sea> wrote in message
>> news:eo**************@TK2MSFTNGP15.phx.gbl...
>>>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


IF I add a line in your script:

Response.Write "<table border='1'>"
For Each f In fc
If UCase(Right(f.Name,4)) = ".ASX" Then
xml.Load Server.MapPath(f.Name)
proc.input = xml
proc.Transform
Response.Write proc.output
response.Write f + "<br>" <---------------added this line
End If
Next
Response.Write "</table>"

I get a list of the files with path like this
E:\Www\myfiles\AUDIO\2005\01-02-05.asx
E:\Www\myfiles\AUDIO\2005\01-09-05.asx
E:\Www\myfiles\AUDIO\2005\01-16-05.asx
E:\Www\myfiles\AUDIO\2005\01-23-05.asx
E:\Www\myfiles\AUDIO\2005\01-30-05.asx
E:\Www\myfiles\AUDIO\2005\02-06-05.asx

so part of it is working....
Jul 22 '05 #12

".:mmac:." <no@thank.you> wrote in message
news:eY**************@TK2MSFTNGP15.phx.gbl...

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ot*************@TK2MSFTNGP14.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:OL**************@TK2MSFTNGP14.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:uJ****************@TK2MSFTNGP12.phx.gbl...
> ".:mmac:." <no@thank.you> wrote in message
> news:%2****************@tk2msftngp13.phx.gbl...
>> "Chris Hohmann" <no****@thankyou.com> wrote in message
>> news:Ou*****************@TK2MSFTNGP10.phx.gbl...
>>> ".:mmac:." <lost@sea> wrote in message
>>> news:eo**************@TK2MSFTNGP15.phx.gbl...
>>>>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


IF I add a line in your script:

Response.Write "<table border='1'>"
For Each f In fc
If UCase(Right(f.Name,4)) = ".ASX" Then
xml.Load Server.MapPath(f.Name)
proc.input = xml
proc.Transform
Response.Write proc.output
response.Write f + "<br>" <---------------added this line
End If
Next
Response.Write "</table>"

I get a list of the files with path like this
E:\Www\myfiles\AUDIO\2005\01-02-05.asx
E:\Www\myfiles\AUDIO\2005\01-09-05.asx
E:\Www\myfiles\AUDIO\2005\01-16-05.asx
E:\Www\myfiles\AUDIO\2005\01-23-05.asx
E:\Www\myfiles\AUDIO\2005\01-30-05.asx
E:\Www\myfiles\AUDIO\2005\02-06-05.asx

so part of it is working....

Can you post one of the asx files so I can confirm the format?
Jul 22 '05 #13

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

".:mmac:." <no@thank.you> wrote in message
news:eY**************@TK2MSFTNGP15.phx.gbl...

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Ot*************@TK2MSFTNGP14.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:OL**************@TK2MSFTNGP14.phx.gbl...
> "Chris Hohmann" <no****@thankyou.com> wrote in message
> news:uJ****************@TK2MSFTNGP12.phx.gbl...
>> ".:mmac:." <no@thank.you> wrote in message
>> news:%2****************@tk2msftngp13.phx.gbl...
>>> "Chris Hohmann" <no****@thankyou.com> wrote in message
>>> news:Ou*****************@TK2MSFTNGP10.phx.gbl...
>>>> ".:mmac:." <lost@sea> wrote in message
>>>> news:eo**************@TK2MSFTNGP15.phx.gbl...

so part of it is working....

Can you post one of the asx files so I can confirm the format?


here you are...

<ASX version = "3.0">
<TITLE>Valley </TITLE>
<MOREINFO HREF="http://www.mywebsite.com" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogosm.gif" Style
= "ICON" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogolg.gif" Style
= "mark" />
<Entry ClientSkip="yes">
<BANNER HREF = "http://www.mywebsite.com/audio/images/valleybanner.gif">
<Abstract>Visit my website</abstract>
<MoreInfo href = "http://www.mywebsite.com" />
</BANNER>
<Logo href = "http://www mywebsite.com/audio/images/valleylogosm.gif" Style
= "ICON" />
<MoreInfo href = "http://www.mywebsite.com" />
<Abstract>Visit mywebsite</abstract>

<!-- All above this line remains the same for each
file - - - - - - - - - - - - - - - - - - - - - - - - -->
<TITLE>The title of the audio file</TITLE>
<AUTHOR>Files author</AUTHOR>
<COPYRIGHT>(c)2005 my web site</COPYRIGHT>
<Ref href = "mms://media.mywebsite.com/2005/05-01-05.wma" />
</Entry>
</ASX>
Jul 22 '05 #14
".:mmac:." <no@thank.you> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
so part of it is working....

Can you post one of the asx files so I can confirm the format?


here you are...

<ASX version = "3.0">
<TITLE>Valley </TITLE>
<MOREINFO HREF="http://www.mywebsite.com" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogolg.gif"
Style = "mark" />
<Entry ClientSkip="yes">
<BANNER HREF = "http://www.mywebsite.com/audio/images/valleybanner.gif">
<Abstract>Visit my website</abstract>
<MoreInfo href = "http://www.mywebsite.com" />
</BANNER>
<Logo href = "http://www mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<MoreInfo href = "http://www.mywebsite.com" />
<Abstract>Visit mywebsite</abstract>

<!-- All above this line remains the same for each
file - - - - - - - - - - - - - - - - - - - - - - - - -->
<TITLE>The title of the audio file</TITLE>
<AUTHOR>Files author</AUTHOR>
<COPYRIGHT>(c)2005 my web site</COPYRIGHT>
<Ref href = "mms://media.mywebsite.com/2005/05-01-05.wma" />
</Entry>
</ASX>

In answer to your earlier question, XML is case sensitive. As such, you will
need to modify asx2html.xsl accordingly. Can I ask how these playlist files
are being generated? For my own testing, I did the following:

1. Opened Windows Media Player 10.
2. Selected File->New Now Playing List.
3. Dragged files from the media library to the now playing list.
4. Selected File->Save Now Playing List As...
5. Specified Save as Type->Any Playlist(*.wpl,*.asx,*.m3u)
6. Specified File name->05-22-05.asx
7. Saved playlist.

I based the asx2html.xsl file on the resulting playlist file which contained
mixed case entity names. Note, that this contradicts the online
documentation which lists all entities in uppercase and also states
"Elements and attributes are not case sensitive. The text used in the
playlist to define an element or attribute can be either uppercase or
lowercase, or a mixture of both." Here's a link to the documentation:

http://msdn.microsoft.com/library/en...eplaylists.asp

What they're actually saying is that Windows Media Player is case
insensitive when it comes to ASX files. XML on the other hand is case
sensitive. But as long as the files are being generated in a consistent
manner, then all you need to do is make the appropriate replacements in the
asx.html.xsl file and all should be well.
Jul 22 '05 #15
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:eP*************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
so part of it is working....
Can you post one of the asx files so I can confirm the format?


here you are...

<ASX version = "3.0">
<TITLE>Valley </TITLE>
<MOREINFO HREF="http://www.mywebsite.com" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogolg.gif"
Style = "mark" />
<Entry ClientSkip="yes">
<BANNER HREF = "http://www.mywebsite.com/audio/images/valleybanner.gif">
<Abstract>Visit my website</abstract>
<MoreInfo href = "http://www.mywebsite.com" />
</BANNER>
<Logo href = "http://www mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<MoreInfo href = "http://www.mywebsite.com" />
<Abstract>Visit mywebsite</abstract>

<!-- All above this line remains the same for each
file - - - - - - - - - - - - - - - - - - - - - - - - -->
<TITLE>The title of the audio file</TITLE>
<AUTHOR>Files author</AUTHOR>
<COPYRIGHT>(c)2005 my web site</COPYRIGHT>
<Ref href = "mms://media.mywebsite.com/2005/05-01-05.wma" />
</Entry>
</ASX>

In answer to your earlier question, XML is case sensitive. As such, you
will need to modify asx2html.xsl accordingly.


Here's a modified version of asx2html.xsl based on the playlist file sample
you posted:

[asx2html.xsl]
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output 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,8)"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template name="String2Date">
<xsl:param 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>
<xsl:otherwise><xsl:value-of select="concat('19',$y)"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Jul 22 '05 #16

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:eP*************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
so part of it is working....
Can you post one of the asx files so I can confirm the format?


here you are...

<ASX version = "3.0">
<TITLE>Valley </TITLE>
<MOREINFO HREF="http://www.mywebsite.com" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogolg.gif"
Style = "mark" />
<Entry ClientSkip="yes">
<BANNER HREF = "http://www.mywebsite.com/audio/images/valleybanner.gif">
<Abstract>Visit my website</abstract>
<MoreInfo href = "http://www.mywebsite.com" />
</BANNER>
<Logo href = "http://www mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<MoreInfo href = "http://www.mywebsite.com" />
<Abstract>Visit mywebsite</abstract>

<!-- All above this line remains the same for each
file - - - - - - - - - - - - - - - - - - - - - - - - -->
<TITLE>The title of the audio file</TITLE>
<AUTHOR>Files author</AUTHOR>
<COPYRIGHT>(c)2005 my web site</COPYRIGHT>
<Ref href = "mms://media.mywebsite.com/2005/05-01-05.wma" />
</Entry>
</ASX>

In answer to your earlier question, XML is case sensitive. As such, you
will need to modify asx2html.xsl accordingly. Can I ask how these playlist
files are being generated? For my own testing, I did the following:

1. Opened Windows Media Player 10.
2. Selected File->New Now Playing List.
3. Dragged files from the media library to the now playing list.
4. Selected File->Save Now Playing List As...
5. Specified Save as Type->Any Playlist(*.wpl,*.asx,*.m3u)
6. Specified File name->05-22-05.asx
7. Saved playlist.

I based the asx2html.xsl file on the resulting playlist file which
contained mixed case entity names. Note, that this contradicts the online
documentation which lists all entities in uppercase and also states
"Elements and attributes are not case sensitive. The text used in the
playlist to define an element or attribute can be either uppercase or
lowercase, or a mixture of both." Here's a link to the documentation:

http://msdn.microsoft.com/library/en...eplaylists.asp

What they're actually saying is that Windows Media Player is case
insensitive when it comes to ASX files. XML on the other hand is case
sensitive. But as long as the files are being generated in a consistent
manner, then all you need to do is make the appropriate replacements in
the asx.html.xsl file and all should be well.

I hand type each one changing the data below the "all above this line..."
each week.
I don't understand what replacements I need to make to that file.
If I am using all lowercase then this should work? then what am I doing
wrong??
I renamed one of the extensions to uppercase and no change.
How should the web page display in your view?
Jul 22 '05 #17
> news:eP*************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
> so part of it is working....
Can you post one of the asx files so I can confirm the format?
here you are...

<ASX version = "3.0">
<TITLE>Valley </TITLE>
<MOREINFO HREF="http://www.mywebsite.com" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogolg.gif"
Style = "mark" />
<Entry ClientSkip="yes">
<BANNER HREF = "http://www.mywebsite.com/audio/images/valleybanner.gif">
<Abstract>Visit my website</abstract>
<MoreInfo href = "http://www.mywebsite.com" />
</BANNER>
<Logo href = "http://www mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<MoreInfo href = "http://www.mywebsite.com" />
<Abstract>Visit mywebsite</abstract>

<!-- All above this line remains the same for each
file - - - - - - - - - - - - - - - - - - - - - - - - -->
<TITLE>The title of the audio file</TITLE>
<AUTHOR>Files author</AUTHOR>
<COPYRIGHT>(c)2005 my web site</COPYRIGHT>
<Ref href = "mms://media.mywebsite.com/2005/05-01-05.wma" />
</Entry>
</ASX>

In answer to your earlier question, XML is case sensitive. As such, you
will need to modify asx2html.xsl accordingly.


Here's a modified version of asx2html.xsl based on the playlist file
sample you posted:

[asx2html.xsl]
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output 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,8)"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template name="String2Date">
<xsl:param 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>
<xsl:otherwise><xsl:value-of select="concat('19',$y)"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>


Chris, I see what you mean by case sensitive, You mean the tags as well as
the filename. Got it.
But the page still doesn't work on my end. It doesn't look like anything is
being processed. I get the list of files by adding that response.write line
but nothing formatted by the stylesheet.
What should it look like? I have an idea but what does it look like when you
run it?
How can I step through it to look for where it breaks?
Jul 22 '05 #18
".:mmac:." <no@thank.you> wrote in message
news:u2*************@TK2MSFTNGP12.phx.gbl...

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:eP*************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
> so part of it is working....
Can you post one of the asx files so I can confirm the format?
here you are...

<ASX version = "3.0">
<TITLE>Valley </TITLE>
<MOREINFO HREF="http://www.mywebsite.com" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogolg.gif"
Style = "mark" />
<Entry ClientSkip="yes">
<BANNER HREF = "http://www.mywebsite.com/audio/images/valleybanner.gif">
<Abstract>Visit my website</abstract>
<MoreInfo href = "http://www.mywebsite.com" />
</BANNER>
<Logo href = "http://www mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<MoreInfo href = "http://www.mywebsite.com" />
<Abstract>Visit mywebsite</abstract>

<!-- All above this line remains the same for each
file - - - - - - - - - - - - - - - - - - - - - - - - -->
<TITLE>The title of the audio file</TITLE>
<AUTHOR>Files author</AUTHOR>
<COPYRIGHT>(c)2005 my web site</COPYRIGHT>
<Ref href = "mms://media.mywebsite.com/2005/05-01-05.wma" />
</Entry>
</ASX>

In answer to your earlier question, XML is case sensitive. As such, you
will need to modify asx2html.xsl accordingly. Can I ask how these
playlist files are being generated? For my own testing, I did the
following:

1. Opened Windows Media Player 10.
2. Selected File->New Now Playing List.
3. Dragged files from the media library to the now playing list.
4. Selected File->Save Now Playing List As...
5. Specified Save as Type->Any Playlist(*.wpl,*.asx,*.m3u)
6. Specified File name->05-22-05.asx
7. Saved playlist.

I based the asx2html.xsl file on the resulting playlist file which
contained mixed case entity names. Note, that this contradicts the online
documentation which lists all entities in uppercase and also states
"Elements and attributes are not case sensitive. The text used in the
playlist to define an element or attribute can be either uppercase or
lowercase, or a mixture of both." Here's a link to the documentation:

http://msdn.microsoft.com/library/en...eplaylists.asp

What they're actually saying is that Windows Media Player is case
insensitive when it comes to ASX files. XML on the other hand is case
sensitive. But as long as the files are being generated in a consistent
manner, then all you need to do is make the appropriate replacements in
the asx.html.xsl file and all should be well.

I hand type each one changing the data below the "all above this line..."
each week.
I don't understand what replacements I need to make to that file.
If I am using all lowercase then this should work? then what am I doing
wrong??
I renamed one of the extensions to uppercase and no change.
How should the web page display in your view?

The <Abstract> tags in your asx files are not properly closed. You start the
tag is mixed case and the end tag is lowercase. After I made that change,
your sample asx file processed correctly with the modified version of
asx2html.xsl I sent.
Jul 22 '05 #19

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:u2*************@TK2MSFTNGP12.phx.gbl...

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:eP*************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
>> so part of it is working....
> Can you post one of the asx files so I can confirm the format?
>

here you are...

<ASX version = "3.0">
<TITLE>Valley </TITLE>
<MOREINFO HREF="http://www.mywebsite.com" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<Logo href = "http://www.mywebsite.com/audio/images/valleylogolg.gif"
Style = "mark" />
<Entry ClientSkip="yes">
<BANNER HREF =
"http://www.mywebsite.com/audio/images/valleybanner.gif">
<Abstract>Visit my website</abstract>
<MoreInfo href = "http://www.mywebsite.com" />
</BANNER>
<Logo href = "http://www mywebsite.com/audio/images/valleylogosm.gif"
Style = "ICON" />
<MoreInfo href = "http://www.mywebsite.com" />
<Abstract>Visit mywebsite</abstract>

<!-- All above this line remains the same for each
file - - - - - - - - - - - - - - - - - - - - - - - - -->
<TITLE>The title of the audio file</TITLE>
<AUTHOR>Files author</AUTHOR>
<COPYRIGHT>(c)2005 my web site</COPYRIGHT>
<Ref href = "mms://media.mywebsite.com/2005/05-01-05.wma" />
</Entry>
</ASX>
In answer to your earlier question, XML is case sensitive. As such, you
will need to modify asx2html.xsl accordingly. Can I ask how these
playlist files are being generated? For my own testing, I did the
following:

1. Opened Windows Media Player 10.
2. Selected File->New Now Playing List.
3. Dragged files from the media library to the now playing list.
4. Selected File->Save Now Playing List As...
5. Specified Save as Type->Any Playlist(*.wpl,*.asx,*.m3u)
6. Specified File name->05-22-05.asx
7. Saved playlist.

I based the asx2html.xsl file on the resulting playlist file which
contained mixed case entity names. Note, that this contradicts the
online documentation which lists all entities in uppercase and also
states "Elements and attributes are not case sensitive. The text used in
the playlist to define an element or attribute can be either uppercase
or lowercase, or a mixture of both." Here's a link to the documentation:

http://msdn.microsoft.com/library/en...eplaylists.asp

What they're actually saying is that Windows Media Player is case
insensitive when it comes to ASX files. XML on the other hand is case
sensitive. But as long as the files are being generated in a consistent
manner, then all you need to do is make the appropriate replacements in
the asx.html.xsl file and all should be well.

I hand type each one changing the data below the "all above this line..."
each week.
I don't understand what replacements I need to make to that file.
If I am using all lowercase then this should work? then what am I doing
wrong??
I renamed one of the extensions to uppercase and no change.
How should the web page display in your view?

The <Abstract> tags in your asx files are not properly closed. You start
the tag is mixed case and the end tag is lowercase. After I made that
change, your sample asx file processed correctly with the modified version
of asx2html.xsl I sent.


Yeeeea! I got some success! I found I have LOTS of case changes to make!
This is REALLY great! Thanks a ton! If I'm not being too greedy I have a
couple more q's.

1. I found that I have to have these two files in the same directory as the
ASX files or the stylesheet doesn't see them. The ASP script does as
evidenced by the listing of files with the ".write f" that I added,
Shouldn't the PATH const allow me to place the two files anywhere?

2. I would like to have a small gif at one end or the other linked to the
asx file for clicking to play the asx file. How can I do that?

3. In the ASX file I supplied, there are Two "TITLE" tags, how does this
know which one to read? Does it not look until finding the first ENTRY tag?
Jul 22 '05 #20
..:mmac:. wrote:

Yeeeea! I got some success! I found I have LOTS of case changes to
make! This is REALLY great! Thanks a ton! If I'm not being too
greedy I have a couple more q's.


I realize this is late in the discussion, but have you considered just using
publishing points in Media Services?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #21
".:mmac:." <lost@sea> wrote in message
news:uc*************@TK2MSFTNGP12.phx.gbl...
Yeeeea! I got some success! I found I have LOTS of case changes to make!
This is REALLY great! Thanks a ton! If I'm not being too greedy I have a
couple more q's.

1. I found that I have to have these two files in the same directory as
the ASX files or the stylesheet doesn't see them. The ASP script does as
evidenced by the listing of files with the ".write f" that I added,
Shouldn't the PATH const allow me to place the two files anywhere?
As long as the ShowASX.asp and the asx2html.xsl files are in the same
directory, they should work regardless of where the actual asx files are
located.
2. I would like to have a small gif at one end or the other linked to the
asx file for clicking to play the asx file. How can I do that?
You will need to modify the asx2html.xsl file. It shouldn't be too hard. You
would add something like the following:

<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="Ref/@href"/>
</xsl:attribute>
<img src="icon.gif"/>
</a>
</td>

I'll leave it to you to do the copy and paste.
3. In the ASX file I supplied, there are Two "TITLE" tags, how does this
know which one to read? Does it not look until finding the first ENTRY
tag?


Yes, the reference to the TITLE tag occurs within a template that processes
the ENTRY tag. As such it does not apply to the TITLE tag that is a direct
descendant of the ASX tag.
Jul 22 '05 #22
ummm ... no... I was having so much fun with the XML I didn't think beyond
that. How does that work?

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:u2**************@TK2MSFTNGP10.phx.gbl...
.:mmac:. wrote:

Yeeeea! I got some success! I found I have LOTS of case changes to
make! This is REALLY great! Thanks a ton! If I'm not being too
greedy I have a couple more q's.


I realize this is late in the discussion, but have you considered just
using publishing points in Media Services?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.
Use of this email address implies consent to these terms. Please do not
contact me directly or ask me to contact you directly for assistance. If
your question is worth asking, it's worth posting.

Jul 22 '05 #23
>> 1. I found that I have to have these two files in the same directory as
the ASX files or the stylesheet doesn't see them. The ASP script does as
evidenced by the listing of files with the ".write f" that I added,
Shouldn't the PATH const allow me to place the two files anywhere?


As long as the ShowASX.asp and the asx2html.xsl files are in the same
directory, they should work regardless of where the actual asx files are
located.


Thanks Chris, this has been very enlightening!

As for the file location, I tried it in two folders and it only displayed
when I placed it in the same dir as the asx files. I guess then there is a
path issue? I'll fiddle with that.

Would sorting the display by date be a major undertaking? I would like to
show them in top down decending date order.
I believe that it would be a bigger deal than I am capable of but I thought
I would ask.

Jul 22 '05 #24
".:mmac:." wrote:
I realize this is late in the discussion, but have you considered
just using publishing points in Media Services?


ummm ... no... I was having so much fun with the XML I didn't think beyond
that. How does that work?


I have only used it a little, but it has been fairly easy to accomplish
things. Here is the media services site:
http://www.microsoft.com/windows/win...es/server.aspx
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #25
".:mmac:." <lost@sea> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
1. I found that I have to have these two files in the same directory as
the ASX files or the stylesheet doesn't see them. The ASP script does as
evidenced by the listing of files with the ".write f" that I added,
Shouldn't the PATH const allow me to place the two files anywhere?
As long as the ShowASX.asp and the asx2html.xsl files are in the same
directory, they should work regardless of where the actual asx files are
located.


Thanks Chris, this has been very enlightening!

As for the file location, I tried it in two folders and it only displayed
when I placed it in the same dir as the asx files. I guess then there is a
path issue? I'll fiddle with that.


Whoops, my mistake. Replace the following line in ShowASX.asp:

xml.Load Server.MapPath(f.Name)

With this line:

xml.Load PATH & f.Name

Also, make sure there's a trailing backslash in the PATH constant.

Would sorting the display by date be a major undertaking? I would like to
show them in top down descending date order.
I believe that it would be a bigger deal than I am capable of but I
thought I would ask.


Two things would be involved. First, you would need to combine all the
playlist data into one file, either programmatically or manually. Then you
could use the <xsl:sort> tag in XSL to sort the ENTRY tags by date
associated with Ref/@href.

Here's a section of the wcschools.com tutorial on XSL that deals with
sorting:
http://www.w3schools.com/xsl/xsl_sort.asp
Jul 22 '05 #26
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
".:mmac:." <lost@sea> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
1. I found that I have to have these two files in the same directory
as the ASX files or the stylesheet doesn't see them. The ASP script
does as evidenced by the listing of files with the ".write f" that I
added, Shouldn't the PATH const allow me to place the two files
anywhere?

As long as the ShowASX.asp and the asx2html.xsl files are in the same
directory, they should work regardless of where the actual asx files are
located.


Thanks Chris, this has been very enlightening!

As for the file location, I tried it in two folders and it only displayed
when I placed it in the same dir as the asx files. I guess then there is
a path issue? I'll fiddle with that.


Whoops, my mistake. Replace the following line in ShowASX.asp:

xml.Load Server.MapPath(f.Name)

With this line:

xml.Load PATH & f.Name

Also, make sure there's a trailing backslash in the PATH constant.

Would sorting the display by date be a major undertaking? I would like to
show them in top down descending date order.
I believe that it would be a bigger deal than I am capable of but I
thought I would ask.


Two things would be involved. First, you would need to combine all the
playlist data into one file, either programmatically or manually. Then you
could use the <xsl:sort> tag in XSL to sort the ENTRY tags by date
associated with Ref/@href.

Here's a section of the wcschools.com tutorial on XSL that deals with
sorting:
http://www.w3schools.com/xsl/xsl_sort.asp


Chris, I am in your debt.
I gotta get my head around this XML, it seems to be a good solution to my
ever growing web site wish-list.
Thank you again, Very Much for your time.
I'm gonna start work on the sorting now. the school site makes it look so
easy!
-michael
Jul 22 '05 #27
>> 2. I would like to have a small gif at one end or the other linked to the
asx file for clicking to play the asx file. How can I do that?


You will need to modify the asx2html.xsl file. It shouldn't be too hard.
You would add something like the following:

<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="Ref/@href"/>
</xsl:attribute>
<img src="icon.gif"/>
</a>
</td>


Chris, The sample above functions, but links to the wma file (from the href
in the asx file) , not the asx file itself.
I can't locate a call to the filename in the xsl because it isn't in the
..asx file. I can figure out a response.write solution but the xsl is so
interesting I want to stick with it. can you tell how to display the .asx
filename in the link?
Jul 22 '05 #28
".:mmac:." <no@thank.you> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
2. I would like to have a small gif at one end or the other linked to
the asx file for clicking to play the asx file. How can I do that?


You will need to modify the asx2html.xsl file. It shouldn't be too hard.
You would add something like the following:

<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="Ref/@href"/>
</xsl:attribute>
<img src="icon.gif"/>
</a>
</td>


Chris, The sample above functions, but links to the wma file (from the
href in the asx file) , not the asx file itself.
I can't locate a call to the filename in the xsl because it isn't in the
.asx file. I can figure out a response.write solution but the xsl is so
interesting I want to stick with it. can you tell how to display the .asx
filename in the link?

Oh, I see. I misinterpreted the question above. Since the playlist file does
not contain a reference to the asx filename, you will need to pass in a
parameter to the stylesheet processor. This will involve the following
steps:

1. Add a global parameter tag to the stylesheet.
2. Add a link to the playlist file in the output of the stylesheet
referencing the asx_uri parameter.
3. Add code to ShowASX.asp to pass in the asx_uri parameter value to the
stylesheet processor.

Here are the modified versions of the asx2html.xsl and ShowASX.asp files.
These modifications are based on a directory structure where the asx
playlist files are in a "Files" subdirectory relative to the ShowASX.asp and
asx2html.xsl files. You will need to make adjustments based on your own
directory structure. You will also need to adjust for the case sensitivity
as you did before.

[ShowASX.asp]
<%
CONST PATH = "C:\INETPUB\ANSWER\PUBLIC_HTML\ASX\FILES\"
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 UCase(Right(f.Name,4)) = ".ASX" Then
xml.Load PATH & f.Name
proc.input = xml
proc.addParameter "asx_uri", "Files/" & f.Name
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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" indent="yes"/>
<xsl:param name="asx_uri" select="concat('Files/',/Asx/Title,'.asx')"/>
<xsl:template match="Asx">
<tr>
<td colspan="3">
<a>
<xsl:attribute name="href">
<xsl:value-of select="$asx_uri"/>
</xsl:attribute>
<img src="icon.gif"/>
</a>
</td>
</tr>
<xsl:for-each select="Entry">
<xsl:sort
order="descending"
select="concat( substring(Ref/@href,string-length(Ref/@href)-5,2),
substring(Ref/@href,string-length(Ref/@href)-11,2),
substring(Ref/@href,string-length(Ref/@href)-8,2))"
/>
<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,8)"/>
</xsl:call-template>
</td>
</tr>
</xsl:for-each>
</xsl:template>
<xsl:template name="String2Date">
<xsl:param 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>
<xsl:otherwise><xsl:value-of select="concat('19',$y)"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Jul 22 '05 #29

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
".:mmac:." <no@thank.you> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
2. I would like to have a small gif at one end or the other linked to
the asx file for clicking to play the asx file. How can I do that?

You will need to modify the asx2html.xsl file. It shouldn't be too hard.
You would add something like the following:

<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="Ref/@href"/>
</xsl:attribute>
<img src="icon.gif"/>
</a>
</td>


Chris, The sample above functions, but links to the wma file (from the
href in the asx file) , not the asx file itself.
I can't locate a call to the filename in the xsl because it isn't in the
.asx file. I can figure out a response.write solution but the xsl is so
interesting I want to stick with it. can you tell how to display the .asx
filename in the link?

Oh, I see. I misinterpreted the question above. Since the playlist file
does not contain a reference to the asx filename, you will need to pass in
a parameter to the stylesheet processor. This will involve the following
steps:

1. Add a global parameter tag to the stylesheet.
2. Add a link to the playlist file in the output of the stylesheet
referencing the asx_uri parameter.
3. Add code to ShowASX.asp to pass in the asx_uri parameter value to the
stylesheet processor.

Here are the modified versions of the asx2html.xsl and ShowASX.asp files.
These modifications are based on a directory structure where the asx
playlist files are in a "Files" subdirectory relative to the ShowASX.asp
and asx2html.xsl files. You will need to make adjustments based on your
own directory structure. You will also need to adjust for the case
sensitivity as you did before.

[ShowASX.asp]
<%
CONST PATH = "C:\INETPUB\ANSWER\PUBLIC_HTML\ASX\FILES\"
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 UCase(Right(f.Name,4)) = ".ASX" Then
xml.Load PATH & f.Name
proc.input = xml
proc.addParameter "asx_uri", "Files/" & f.Name
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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" indent="yes"/>
<xsl:param name="asx_uri" select="concat('Files/',/Asx/Title,'.asx')"/>
<xsl:template match="Asx">
<tr>
<td colspan="3">
<a>
<xsl:attribute name="href">
<xsl:value-of select="$asx_uri"/>
</xsl:attribute>
<img src="icon.gif"/>
</a>
</td>
</tr>
<xsl:for-each select="Entry">
<xsl:sort
order="descending"
select="concat( substring(Ref/@href,string-length(Ref/@href)-5,2),
substring(Ref/@href,string-length(Ref/@href)-11,2),
substring(Ref/@href,string-length(Ref/@href)-8,2))"
/>
<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,8)"/>
</xsl:call-template>
</td>
</tr>
</xsl:for-each>
</xsl:template>
<xsl:template name="String2Date">
<xsl:param 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>
<xsl:otherwise><xsl:value-of select="concat('19',$y)"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>


Thanks for not taking a holiday Chris ;-),
I noticed you did the sort! You are too cool! I'll be testing tonight.

Just out of curiousity, can I create a custom tag in the ASX file and then
call it from the XSL file?
For instance, if I had a tag in the ASX file that looked like this:
<MikesCustomTag>01-01-05.asx</MikesCustomTag>
Then using <td><xsl:value-of select="MikesCustomTag"/></td> in it's place,
would that be possible? Or is that not supported?

BTW I did discover the hard way that ampersands are a no-no in the tags
using this method. Important discovery! The listing doesn't generate any
error, it just doesn't show up!
Jul 22 '05 #30
".:mmac:." <lost@sea> wrote in message
news:eu**************@tk2msftngp13.phx.gbl...

[snip]
Just out of curiousity, can I create a custom tag in the ASX file and then
call it from the XSL file?
For instance, if I had a tag in the ASX file that looked like this:
<MikesCustomTag>01-01-05.asx</MikesCustomTag>
Then using <td><xsl:value-of select="MikesCustomTag"/></td> in it's place,
would that be possible? Or is that not supported?
Yes and no. You could certainly add custom tags and process them in the
asx2html.xsl stylesheet. However, technically it would no longer be an ASX
file and media player might not be able to "play" the resulting file.
BTW I did discover the hard way that ampersands are a no-no in the tags
using this method. Important discovery! The listing doesn't generate any
error, it just doesn't show up!


Yes, the ampersand (&) is a reserved character in XML, as are the less-than
(<), greater-than (>), quote (") and apostrophe (') characters. These
characters have special meaning in markup languages like XML. Namely, they
are used to define elements (tags) and attributes. Of the five (5) "entity"
characters, only the "<" and the "&" are strictly reserved, but it's good
practice to uses entity references when dealing with any of these special
characters. Here's a discussion about how character data is handled in XML:

http://www.w3schools.com/xml/xml_cdata.asp
Jul 22 '05 #31
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:uZ**************@TK2MSFTNGP09.phx.gbl...
".:mmac:." <lost@sea> wrote in message
news:eu**************@tk2msftngp13.phx.gbl...

[snip]


This is really great Chris!
I got all of this to work except the sort, I looked all over for syntax
errors and even tried an "order-by" syntax and still the sort doesn't
change. It's like the "concat(..." is not coming back with a value so it's
being ignored.
Jul 22 '05 #32
".:mmac:." <lost@sea> wrote in message
news:uV**************@tk2msftngp13.phx.gbl...
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:uZ**************@TK2MSFTNGP09.phx.gbl...
".:mmac:." <lost@sea> wrote in message
news:eu**************@tk2msftngp13.phx.gbl...

[snip]


This is really great Chris!
I got all of this to work except the sort, I looked all over for syntax
errors and even tried an "order-by" syntax and still the sort doesn't
change. It's like the "concat(..." is not coming back with a value so
it's being ignored.

It's hard to diagnose without seeing your code. Please post your current
asx2html.xsl and one of the asx files you're processing.
Jul 22 '05 #33
[snip]


This is really great Chris!
I got all of this to work except the sort, I looked all over for syntax
errors and even tried an "order-by" syntax and still the sort doesn't
change. It's like the "concat(..." is not coming back with a value so
it's being ignored.

It's hard to diagnose without seeing your code. Please post your current
asx2html.xsl and one of the asx files you're processing.

Here it is, I only changed the layout and the border for the gif

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="3.0" indent="yes"/>
<xsl:param name="asx_uri" select="concat('2005/',/Asx/Title,'.asx')"/>
<xsl:template match="ASX">

<!-- Supposed to sort but doesn't -->
<xsl:for-each select="ENTRY">
<xsl:sort
order="descending"
select="concat( substring(Ref/@href,string-length(Ref/@href)-5,2),
substring(Ref/@href,string-length(Ref/@href)-11,2),
substring(Ref/@href,string-length(Ref/@href)-8,2))"
/>
<tr>
<td>

<!-- Hyperlinked image code -->
<a>
<xsl:attribute name="href">
<xsl:value-of select="$asx_uri"/>
</xsl:attribute>
<img border="0" src="\images\wmp.gif"/>
</a>
</td>

<!-- Title Cell -->
<td><xsl:value-of select="TITLE"/></td>

<!-- Author Cell -->
<td><xsl:value-of select="AUTHOR"/></td>

<!-- Date Routine -->
<td>
<xsl:call-template name="String2Date">
<xsl:with-param name="s"
select="substring(Ref/@href,string-length(Ref/@href)-11,8)"/>
</xsl:call-template>
</td>
</tr>
</xsl:for-each>
</xsl:template>
<xsl:template name="String2Date">
<xsl:param 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>
<xsl:otherwise><xsl:value-of select="concat('19',$y)"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

---------
<ASX version = "3.0">
<TITLE>My Web Site</TITLE>
<MOREINFO HREF="http://www.MyWebSite.com" />
<Logo href = "http://www.MyWebSite.com/audio/images/valleylogosm.gif" Style
= "ICON" />
<Logo href = "http://www.MyWebSite.com/audio/images/valleylogolg.gif" Style
= "mark" />
<ENTRY ClientSkip="yes">
<BANNER HREF = "http://www.MyWebSite.com/audio/images/valleybanner.gif">
<ABSTRACT> My Web Site </ABSTRACT>
<MoreInfo href = "http://www.MyWebSite.com" />
</BANNER>
<Logo href = "http://www.MyWebSite.com/audio/images/valleylogosm.gif" Style
= "ICON" />
<MoreInfo href = "http://www.MyWebSite.com" />
<ABSTRACT>Visit MyWebSite</ABSTRACT>

<!-- All above this line remains the
same - - - - - - - - - - - - - - - - - - - - - - - - -->
<TITLE>Like a Rock</TITLE>
<AUTHOR> MMAC </AUTHOR>
<COPYRIGHT>(c)2005 MyWebSite</COPYRIGHT>
<Ref href = "mms://media.MyWebSite.com/2005/01-02-05.wma" />
</ENTRY>
</ASX>
Jul 22 '05 #34
".:mmac:." <lost@sea> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
[snip]

This is really great Chris!
I got all of this to work except the sort, I looked all over for syntax
errors and even tried an "order-by" syntax and still the sort doesn't
change. It's like the "concat(..." is not coming back with a value so
it's being ignored.

It's hard to diagnose without seeing your code. Please post your current
asx2html.xsl and one of the asx files you're processing.

Here it is, I only changed the layout and the border for the gif

[snip]

I don't see anything wrong at first glance. Is there only one wma reference
per asx file? If so, that would explain why it's not sorting. I mentioned
previously, that to accomplish the sort you will need to merge the contents
of all the asx files into one file. Can you try adding a few more entries to
one of the asx files and see if that asx file in particular sorts correctly?
Jul 22 '05 #35
I do remember you saying that, I thought you had found a way around it.
My bad.
As for combining them into one, I'm not sure that would work for me. In my
case, each entry would have to have it's own asx file to play so that would
mean that each week I would have to modify the main asx file and also create
the one that plays the file. I live with the ascending order. Which is still
really cool BTW and I am very grateful.
I always had a vision of generating these playlists on the fly,
eliminating the need to keep building them every week...but given what you
have shown me, that sounds like a much larger project and you have been so
generous and such a tremendous help that to ask any more of you would be
rude.
Thanks so much for all your help.

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:uV**************@TK2MSFTNGP10.phx.gbl...
".:mmac:." <lost@sea> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
> [snip]

This is really great Chris!
I got all of this to work except the sort, I looked all over for syntax
errors and even tried an "order-by" syntax and still the sort doesn't
change. It's like the "concat(..." is not coming back with a value so
it's being ignored.

It's hard to diagnose without seeing your code. Please post your current
asx2html.xsl and one of the asx files you're processing.

Here it is, I only changed the layout and the border for the gif

[snip]

I don't see anything wrong at first glance. Is there only one wma
reference per asx file? If so, that would explain why it's not sorting. I
mentioned previously, that to accomplish the sort you will need to merge
the contents of all the asx files into one file. Can you try adding a few
more entries to one of the asx files and see if that asx file in
particular sorts correctly?

Jul 22 '05 #36

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Thomas W | last post: by
4 posts views Thread by Earl | last post: by
reply views Thread by bruce | last post: by
3 posts views Thread by Aaron | last post: by
13 posts views Thread by Chris Carlen | last post: by
15 posts views Thread by Matthew | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.