Last night I went to a bookstore and found an exellent volume on Win32
Perl called "Win32 Perl Programming, The Standard Extensions", second
edition by Dave Roth (New Riders Publishing, ISBN 1-57870-216-x). Chapter
Five in on Win32::OLE and it gave me some debugging tips.

Based on that, I have modified my earlier script as can be seen below.
I have inserted some additional print statements so that when the program
is run, a message explaining the debugging measures is printed to STDOUT.

In short, the effort to assign the DOM Document resulting from parsing
the data file to the "input" property of the XSLProcessor object fails
  $XSLProc->{input} = $DOMDoc;
because the input property cannot be found.

This is especially puzzling because immediately after creating $XSLProc,
I loop through all the keys and values of the blessed hash which $XSLProc
represents, and print then out, including the missing "input" property.

I know that Jan Dubois monitors the list because I've seen the posts.
As the co-author/maintainer of Win32::OLE, I appeal to you to look this
over and tell me where I'm going wrong.

Thanks.

use strict;
use Win32::OLE;

my $XSLProc;
my $DOMDoc;
my $XSLT;
my $XSLTemplate;

$XSLT = Win32::OLE->new("Msxml2.FreeThreadedDOMDocument.4.0");
$XSLT->{async} = "false";
$XSLT->load("ServerMap2.xsl");

if($XSLT->parseError->reason eq ""){
  $DOMDoc = Win32::OLE->new("Msxml2.DOMDocument.4.0");
  $DOMDoc->{async} = "false";
  $DOMDoc->load("Servers2.xml");
  if($DOMDoc->parseError->reason eq ""){
    $XSLTemplate = Win32::OLE->new("Msxml2.XSLTemplate.4.0");
    $XSLTemplate->{stylesheet} = $XSLT;
    $XSLProc = $XSLTemplate->createProcessor();
    print 'Here is a list of the properties of $XSLProc and their 
values'."\n".'obtained
by querying the object itself immediately after creating it:'."\n";
    print "Property\tValue\n";
    foreach(keys %$XSLProc){
      print "$_\t".$XSLProc->{$_}."\n";
    }
    $XSLProc->{input} = $DOMDoc;
    print "\n".'After assigning $DOMDoc to $XSLProc->input we check the
last error recorded: '."\n". Win32::OLE->LastError()."\n";
    print "Which yields the puzzling message appearing to state that
the property we just\n showed to exist by iterating through the keys
of the hash which comprises ".'$XSLProc'.",\n doesn't exist!\n\n";
    print "Which further explains why when we check the 'readyState'
property before the transform\n";
    print "we see the expected value: ".$XSLProc->readyState."\n";
    $XSLProc->transform();
    print "And after calling the transform method the value does not
change: \n";
    print $XSLProc->readyState."\n";
    print "because we can't set a property which can't be found by the
method \n that is supposed to set it.\n";
    print $XSLProc->output;
    $DOMDoc->DESTROY();
    $XSLT->DESTROY();
    $XSLProc->DESTROY();
  }else{
    print "Data document parse failure: ".$DOMDoc->parseError->reason;
    $DOMDoc->DESTROY();
    $XSLT->DESTROY();
  }
}else{
  print "XSL document parse failure: ".$XSLT->parseError->reason;
  $XSLT->DESTROY();
}


-- 
Charles Knell
[EMAIL PROTECTED] - email
(703) 234-3955 x2544 - voicemail/fax



__________________________________________________
Voicemail, email, and fax...all in one place.
Sign Up Now! http://www.onebox.com

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to