When Lex submitted a large snippet of code from an older ASP/VBScript application that he had inherited, I was considering extracting the following single line and publishing it as a Representative Line...

set rsCSS = db1.execute("select * from tblCSSClasses")

That line alone should gives a great peek into how that application handles Cascading Style Sheets in such a disastrous manner. Of course, there was just so much more that I couldn't resist sharing the whole thing with you...

session("gsStyleSheet") = "<style type=""text/css"">" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".td1" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Home01_2.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".td2" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Home01_3.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".td3" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Home01_910.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".td5" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Home01_5.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".td7" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Home01_7.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".td9" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Home01_9.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".td15" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Home01_15.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".td17" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Home01_17.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".td19" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Home01_19.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".td22" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Home01_22.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".tdSSpacer" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/SecondSpacer.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".tdSideSpacer" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/SideSpacer.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".tdD1" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-IMAGE: url(/images/Secondary%20page_5.jpg)" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".tdWhiteBdr" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BORDER-RIGHT: white thin solid;" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BORDER-TOP: white thin solid;" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BORDER-LEFT: white thin solid;" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BORDER-BOTTOM: white thin solid" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".tdBlackBdr" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BORDER-RIGHT: black 1px solid;" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BORDER-TOP: black 1px solid;" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BORDER-LEFT: black 1px solid;" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     BORDER-BOTTOM: black 1px solid" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".hrgrey" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     color:#d3d3d3"
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".hrblack" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     color:black"
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & ".hrred" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf
session("gsStyleSheet") = session("gsStyleSheet") & "     color:#990000"
session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf

set rsCSS = db1.execute("select * from tblCSSClasses")

while not rsCSS.eof

    if rsCSS("IsClass") then
        sBeginChar = "."
    else
        sBeginChar = ""
    end if

    session("gsStyleSheet") = session("gsStyleSheet") & sBeginChar

    'if sBeginChar = "" then
    '    session("gsStyleSheet") = session("gsStyleSheet") & ucase(trim(rsCSS("ClassName") & " ")) & vbcrlf
    'else
        session("gsStyleSheet") = session("gsStyleSheet") & trim(rsCSS("ClassName") & " ") & vbcrlf
    'end if

    session("gsStyleSheet") = session("gsStyleSheet") & "{" & vbcrlf

    if ucase(trim(rsCss("ClassName"))) = "BODY" then
        session("gsStyleSheet") = session("gsStyleSheet") & "     MARGIN: 0px;"
        session("gsStyleSheet") = session("gsStyleSheet") & "     BACKGROUND-COLOR: silver;"
    end if

    set rsCSSDetail = db1.execute("select * from tblCSSProperties where ClassID = " & rsCSS("ID"))

    while not rsCSSDetail.eof
        session("gsStyleSheet") = session("gsStyleSheet") & "     " & trim(rsCSSDetail("PropertyName") & " ") & " " & trim(rsCSSDetail("PropertyValue") & " " )
        rsCSSDetail.movenext
        if rsCSSDetail.eof = false then
            session("gsStyleSheet") = session("gsStyleSheet") & ";" & vbcrlf
        else
            session("gsStyleSheet") = session("gsStyleSheet") & vbcrlf
        end if
    wend

    rsCSSDetail.close
    set rsCSSDetail = nothing
    session("gsStyleSheet") = session("gsStyleSheet") & "}" & vbcrlf

    rsCSS.movenext

wend

rsCSS.close
set rsCSS = nothing
session("gsStyleSheet") = session("gsStyleSheet") & "</style>" & vbcrlf

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!