|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Dumb questions from a newbie
Hi Mike,
This is a very basic example that take advantage of MSXML + ADO +
JSCRIPT. It is strongly based on Microsoft technology but is pretty
compact solution.
I tested using the nwind.mdb example shipped with MS Office, and it
worked well.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:ado="ado">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<msxml:script language="JScript" implements-prefix="ado"><![CDATA[
function GetRecords(connection, tablename)
{
var output;
var conn = new ActiveXObject("ADODB.Connection");
var cmd = new ActiveXObject("ADODB.Command");
var rs = new ActiveXObject("ADODB.Recordset");
var Err, ErrCount, fPos;
conn.Open(connection);
cmd.CommandText = "SELECT * FROM " + tablename;
cmd.ActiveConnection = conn;
rs = cmd.Execute();
ErrCount = conn.errors.count;
if(ErrCount > 0){
for(Err = 0; Err < ErrCount; Err++){
output += conn.errors.item(Err);
}
}
else{
output += "\n";
while (!rs.EOF){
output += "<" + tablename + ">\n";
for (fPos = 0; fPos < rs.fields.count; fPos++){
output += "\t<"+ rs.fields(fPos).name + ">";
v = rs.fields(fPos).value;
if(v != null) output += v.toString();
output += "</"+ rs.fields(fPos).name+ ">\n";
}
output += "</" + tablename + ">\n";
rs.MoveNext;
}
}
return output;
}
]]>
</msxml:script>
<xsl:template match="/">
<dao>
<xsl:value-of disable-output-escaping="yes"
select="ado:GetRecords('Provider = Microsoft.Jet.OLEDB.4.0;Data Source =
c:\\nwind.Mdb;', 'Customers')"/>
</dao>
</xsl:template>
</xsl:stylesheet>
Ivan Pedruzzi
eXcelon Corporation
http://www.stylusstudio.com
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Mike Ferrando
> Sent: Tuesday, December 11, 2001 12:11 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: Dumb questions from a newbie
>
>
> --- Michael Kay <michael.h.kay@xxxxxxxxxxxx> wrote:
> > > My question is about being able to write xsl to pull data out of
> > mdb
> > > files? Is this possible?
> >
> > mdb is Microsoft Access I assume?
>
> Yes.
>
> I have multiple files that make up my documents. The mdb
> files can or could go to active web pages seperately or
> accessed by search engines through the final document. Other
> parts of the document are different in nature (such is the
> EAD coder life). I don't want to get locked into using Access
> and its HTML creations. The coding seems very microsoft
> dependent in their web pages. There is more to data than
> databases that is the beauty of XML.
>
> Thanks for the info, I will get on the list and ask about it.
>
> Mike F.
> Library of Congress
> Washington, DC
>
> __________________________________________________
> Do You Yahoo!?
> Check out Yahoo! Shopping and Yahoo! Auctions for all of
> your unique holiday gifts! Buy at http://shopping.yahoo.com
> or bid at http://auctions.yahoo.com
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








