RE: #fogo weblog (via chump IRC bot)

Replies:

Parents:

This is a multi-part message in MIME format.

------=_NextPart_000_0001_01C38A1F.14491920
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Gerald,

Attached are two files that will translate XML to HTML given an XSL file.

I will only work on stupid Windows tho


Cheers,

David.

-----Original Message-----
From: [email protected] [mailto:[email protected]]On
Behalf Of Gerald Oskoboiny
Sent: Saturday, October 04, 2003 1:18 AM
To: [email protected]
Subject: #fogo weblog (via chump IRC bot)


I read a lot of great stuff online but hardly ever bother to send
notes on what I read to this email list. Sometimes I keep notes
on IRC about stuff I might want to look up later, but I'd much
rather publish my comments online than have them buried in an
unpublished irc log.

So I finally installed an IRC bot that takes comments on IRC and
turns them into a weblog:

   http://impressive.net/weblogs/fogo/

To add comments or post your own stuff to the weblog, drop by
irc://irc.impressive.net/fogo and talk to 'chump'. (you can ask
it for help, or read http://usefulinc.com/chump/MANUAL.txt )

I think I'll set something up later to send a copy of each day's
log to this list. I also need to figure out how to improve
navigation around the weblog, and generate HTML versions of each
page. (currently the output is XML; looks fine in galeon)

Here's a well-run chump-backed weblog elsewhere:

   http://rdfig.xmlhack.com/

--
Gerald Oskoboiny <[email protected]>
http://impressive.net/people/gerald/
------=_NextPart_000_0001_01C38A1F.14491920
Content-Type: image/x-icon;
name="translator.ico"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="translator.ico"

AAABAAEAEBAQAAAAAAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAgAAAAACAAACAgAAAAACAAIAAgAAAgIAAwMDAAICAgAD/AAAAAP8AAP//AAAAAP8A
/wD/AAD//wD///8AAAAAAAAAzMwAAAAAAADMzAAAAAAAAMwAAAAMwAwAzAAAAAzAzMDMAAAADMDA
wMwAAAAMwMDAzADAAAzMwMzMAMwADMzADMwAzMAMzAAAzAAMzMwAAAAAAADMzAAAAAAAAMzMAAAA
AAAMwMzAAAAAAMwADMAAAAAAwAAAwAAAAAD/8AAA//AAAP/zAAD5swAA+RMAAPlTAAD5UwAAeEMA
ADhjAAAY8wAAg/8AAMP/AADD/wAAkf8AADn/AAB9/wAA

------=_NextPart_000_0001_01C38A1F.14491920
Content-Type: application/hta;
name="xmltohtml.hta"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="xmltohtml.hta"

<html>
<head>
 <HTA:APPLICATION ID=3D"HTAEx"=20
   APPLICATIONNAME=3D"HTAEx"=20
   ICON=3D"translator.ico"
   WINDOWSTATE=3D"normal">
<meta http-equiv=3D"Content-Language" content=3D"en-us">
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dwindows-1252">
<meta name=3D"GENERATOR" content=3D"Microsoft FrontPage 4.0">
<meta name=3D"ProgId" content=3D"FrontPage.Editor.Document">
<title>XML -> HTML Translator</title>
<SCRIPT LANGUAGE=3D"JavaScript" for=3D"window" event=3D"onload">
<!--
//debugger;
xmldoc.async =3D false;
try {
xmldoc.load("xmltohtml.xml");
f.xmlFile.value =3D =
unescape(xmldoc.selectSingleNode("//files/@xmlfile").nodeValue);
f.xslFile.value =3D =
unescape(xmldoc.selectSingleNode("//files/@xslfile").nodeValue);
f.htmlFile.value =3D =
unescape(xmldoc.selectSingleNode("//files/@htmlfile").nodeValue);
=
f.translator[xmldoc.selectSingleNode("//translator/@which").nodeValue].ch=
ecked =3D true;
f.valid.checked =3D =
xmldoc.selectSingleNode("//opt/@validate").nodeValue;
}catch(exception){
xmldoc.loadXML("<xmltohtml><files xmlfile=3D\"\" xslfile=3D\"\" =
htmlfile=3D\"\" /><translator which=3D\"0\" /><opt validate=3D\"\" =
/></xmltohtml>");
}
//-->
</SCRIPT>

<SCRIPT LANGUAGE=3D"JavaScript">
<!--
var xmldoc =3D new ActiveXObject("Microsoft.XMLDOM");
var oDxml =3D new ActiveXObject("MSComDlg.CommonDialog");
oDxml.Filter =3D "All Files (*.*)|*.*|XML Files (*.xml)|*.xml";
oDxml.MaxFileSize =3D 1000;
var oDxsl =3D new ActiveXObject("MSComDlg.CommonDialog");
oDxsl.Filter =3D "All Files (*.*)|*.*|XSL/T Files =
(*.xsl;*.xslt)|*.xsl;*.xslt";
oDxsl.MaxFileSize =3D 1000;
var oDhtml =3D new ActiveXObject("MSComDlg.CommonDialog");
oDhtml.Filter =3D "All Files (*.*)|*.*|HTML/SP Files =
(*.htm;*.html;*.asp;*.jsp)|*.html;*.htm;*.asp;*.jsp";
oDhtml.MaxFileSize =3D 1000;

function doTranslate(){
var which;
for (i=3D0; i< f.translator.length; i++){
if (f.translator[i].checked){
which =3D f.translator[i].value;
}
}
switch(which){
case "msxsl":
msxsl();
break;
case "msxsl2":
msxsl2();
break;
case "xt":
xt();
break;
case "saxon":
saxon();
break;
}
=09
}
function doView(){
=09
window.open(f.htmlFile.value, "viewer");
}
function xmlBrowsef(){
   oDxml.FilterIndex =3D 2;
oDxml.ShowOpen();
f.xmlFile.value =3D oDxml.FileName;
xmldoc.selectSingleNode("//files/@xmlfile").nodeValue =3D =
escape(oDxml.FileName);
xmldoc.save("xmltohtml.xml");
}
function xslBrowsef(){
   oDxsl.FilterIndex =3D 2;
oDxsl.ShowOpen();
f.xslFile.value =3D oDxsl.FileName;
xmldoc.selectSingleNode("//files/@xslfile").nodeValue =3D =
escape(oDxsl.FileName);
xmldoc.save("xmltohtml.xml");
}
function htmlBrowsef(){
   oDhtml.FilterIndex =3D 2;
oDhtml.ShowOpen();
f.htmlFile.value =3D oDhtml.FileName;
xmldoc.selectSingleNode("//files/@htmlfile").nodeValue =3D =
escape(oDhtml.FileName);
xmldoc.save("xmltohtml.xml");
}
function radio(t){
for (i=3D0; i < f.translator.length; i++){
if (t.value =3D=3D f.translator[i].value) break;
}
xmldoc.selectSingleNode("//translator/@which").nodeValue =3D i;
xmldoc.save("xmltohtml.xml");
}
function validate(t){
xmldoc.selectSingleNode("//opt/@validate").nodeValue =3D =
f.valid.checked;
xmldoc.save("xmltohtml.xml");
}
function msxsl(){
var x =3D new ActiveXObject("Microsoft.XMLDOM");
var s =3D new ActiveXObject("Microsoft.XMLDOM");
var t =3D new ActiveXObject("Scripting.FileSystemObject");
x.async =3D false
x.validateOnParse =3D f.valid.checked;
s.async =3D false
x.load(f.xmlFile.value);
if (x.parseError.errorCode){
f.errorBox.value =3D formatError(x.parseError);
}else{
s.load(f.xslFile.value);
if (s.parseError.errorCode){
f.errorBox.value =3D formatError(s.parseError);
}else{
var of =3D t.CreateTextFile(f.htmlFile.value, true, true);
f.errorBox.value =3D "";
try{
of.write(x.transformNode(s));
of.Close();
}catch(exception){
of.Close();
f.errorBox.value =3D formatError(exception);
}
}
}
}
function msxsl2(){
var x =3D new ActiveXObject("MSXML2.DOMDocument");
var s =3D new ActiveXObject("MSXML2.DOMDocument");
var t =3D new ActiveXObject("Scripting.FileSystemObject");
x.async =3D false
x.validateOnParse =3D f.valid.checked;
s.async =3D false
x.load(f.xmlFile.value);
if (x.parseError.errorCode){
f.errorBox.value =3D formatError(x.parseError);
}else{
s.load(f.xslFile.value);
if (s.parseError.errorCode){
f.errorBox.value =3D formatError(s.parseError);
}else{
var of =3D t.CreateTextFile(f.htmlFile.value, true, true);
f.errorBox.value =3D "";
try{
of.write(x.transformNode(s));
of.Close();
}catch(exception){
of.Close();
f.errorBox.value =3D formatError(exception);
}
}
}
}
function xt(){
var s =3D new ActiveXObject("Wscript.Shell");
//var t =3D new ActiveXObject("Scripting.FileSystemObject");
//var tf =3D t.GetSpecialFolder(2);
//var tn =3D t.GetTempName();
var command =3D "%COMSPEC% /c xt.exe \"" + f.xmlFile.value + "\" \"" + =
f.xslFile.value + "\" \"" + f.htmlFile.value + "\"  " //+ tf.path + "\\" =
+ tn;
f.errorBox.value =3D command;
var run =3D s.run(command, 0, true );
//var tfh =3D t.OpenTextFile(tf.path + "\\" + tn, 1, -1);
//if (!tfh.AtEndOfStream){
// f.errorBox.value =3D tfh.ReadAll();
//}
}
function saxon(){
var s =3D new ActiveXObject("Wscript.Shell");
//var t =3D new ActiveXObject("Scripting.FileSystemObject");
//var tf =3D t.GetSpecialFolder(2);
//var tn =3D t.GetTempName();
var command =3D "%COMSPEC% /c saxon.exe -o \"" + f.htmlFile.value + "\" =
\"" + f.xmlFile.value + "\" \"" + f.xslFile.value + "\"  "; //+ tf.path =
+ "\\" + tn;
f.errorBox.value =3D command;
var run =3D s.run(command, true, true );
//var tfh =3D t.OpenTextFile(tf.path + "\\" + tn, 1, -1);
//if (!tfh.AtEndOfStream){
// f.errorBox.value =3D tfh.ReadAll();
//}
}
=20
function formatError(pe){
var o =3D "";
var e;
for (i=3D0; i < pe.linepos-1; i++){
if (pe.srcText.substr(i,1) =3D=3D "\t"){
o +=3D "\t";
}else{
o +=3D "-";
}
}
o +=3D "^";
e =3D pe.reason + ": " + pe.errorCode + "\n" + pe.srcText + "\n" + o + =
"\n" + pe.url;
return e;
}
//-->
</SCRIPT>

</head>

<body bgcolor=3D"#B0B0B0" LANGUAGE=3D"JavaScript">
<h1 align=3D"center">XML->Translate(XSL)->HTML</h1>
<form id=3D"f">
 <table border=3D"1" width=3D"100%">
   <tr>
     <td colspan=3D"2"><input type=3D"button" value=3D"Translate" =
name=3D"Prev" onclick=3D"doTranslate();">
     <input type=3D"button" value=3D"View" name=3D"View" =
onclick=3D"doView();">
     <input type=3D"checkbox" name=3D"valid" =
onclick=3D"validate(this);">Validate</td>
   </tr>
   <tr>
     <td>MSXSL</td>
     <td><input type=3D"radio" name=3D"translator" value=3D"msxsl" =
checked onclick=3D"radio(this);">(normal
       Microsoft xsl translator)</td>
   </tr>
   <tr>
     <td>MSXSL2</td>
     <td><input type=3D"radio" name=3D"translator" value=3D"msxsl2" =
onclick=3D"radio(this);">(Microsoft xslt
       previw release)</td>
   </tr>
   <tr>
     <td>XT</td>
     <td><input type=3D"radio" name=3D"translator" value=3D"xt" =
onclick=3D"radio(this);">(James Clark's xslt
       translator)</td>
   </tr>
   <tr>
     <td>Saxon</td>
     <td><input type=3D"radio" name=3D"translator" value=3D"saxon" =
onclick=3D"radio(this);">(Mike Kay's xslt translator)</td>
   </tr>
   <tr>
     <td>XML File</td>
     <td width=3D"75%" colspan=3D"3"><input name=3D"xmlFile" =
size=3D"77"><input type=3D"button" value=3D"Browse" name=3D"xmlBrowse" =
onclick=3D"xmlBrowsef();"></td>
   </tr>
   <tr>
     <td>XSL File</td>
     <td width=3D"75%" colspan=3D"3"><input name=3D"xslFile" =
size=3D"77"><input type=3D"button" value=3D"Browse" name=3D"xslBrowse" =
onclick=3D"xslBrowsef();"></td>
   </tr>
   <tr>
     <td>HTML File</td>
     <td width=3D"75%" colspan=3D"3"><input name=3D"htmlFile" =
size=3D"77"><input type=3D"button" value=3D"Browse" name=3D"htmlBrowse" =
onclick=3D"htmlBrowsef();"></td>
   </tr>
   <tr>
     <td colspan=3D"4"><textarea cols=3D"77" name=3D"errorBox" =
rows=3D"6"></textarea></td>
   </tr>
 </table>
</form>


</body>

</html>

------=_NextPart_000_0001_01C38A1F.14491920--

Re: #fogo weblog (via chump IRC bot)

Replies:

  • None.

Parents:

* David A. Jones <[email protected]> [2003-10-04 02:27-0400]
> Gerald,
>
> Attached are two files that will translate XML to HTML given an XSL file.
>
> I will only work on stupid Windows tho

ugh ;) but thanks.

chump actually comes with xslt to convert from xml to html, and
there are several quality free xslt processors for linux, I just
need to figure out how I want to do it.

(generate on the fly in apache? generate on demand only when
necessary? generate them in batch mode periodically? etc.)

--
Gerald Oskoboiny <[email protected]>
http://impressive.net/people/gerald/

HURL: fogo mailing list archives, maintained by Gerald Oskoboiny