Klaus Eichner


Win32::MinXSLT - XSLT Interface to the Win32 Msxml2.DOMDocument library


An example that performs a file-to-file transformation:

  use Win32::MinXSLT;

  my $parser     = Win32::MinXML->new();
  my $xslt       = Win32::MinXSLT->new();

  my $source     = $parser->parse_file('foo.xml');
  my $style_doc  = $parser->parse_file('bar.xsl');

  my $stylesheet = $xslt->parse_stylesheet($style_doc);
  my $results    = $stylesheet->transform($source);

  $stylesheet->output_file($results, 'output.html');

Another example that performs an in-memory transformation:

  use Win32::MinXSLT;
  my $parser     = Win32::MinXML->new();
  my $xslt       = Win32::MinXSLT->new();
  my $source     = $parser->parse_string(
  q{<?xml version="1.0" encoding="iso-8859-1"?>

  my $style_doc  = $parser->parse_string(
  q{<?xml version="1.0" encoding="iso-8859-1"?>
    <xsl:stylesheet version="1.0"
      <xsl:output method="xml" indent="yes" encoding="iso-8859-1"/>
      <xsl:template match="/">
            <xsl:for-each select="index/data">
              <p>Test: *** <xsl:value-of select="."/> ***</p>

  my $stylesheet = $xslt->parse_stylesheet($style_doc);
  my $results    = $stylesheet->transform($source);

  print $stylesheet->output_string($results);


You are on Windows and you would like to use XML::LibXSLT, but there is no pre-compiled version of XML::LibXSLT available (that is, for example, currently the case on 64-bit Windows, where only 32-bit versions of XML::LibXSLT are available).

In that case you can use Win32::MinXSLT as a drop-in replacement for XML::LibXSLT. In fact, I have copied the interface from XML::LibXSLT to work with MSXML.

Win32::MinXSLT uses Win32::OLE to call function in 'Msxml2.DOMDocument', version 6, to do the XSLT transformation.

Different versions of 'Msxml2.DOMDocument' can be selected by using an additional parameter. For example, the following use statement selects 'Msxml2.DOMDocument', version 3:

  use Win32::MinXSLT qw(:v3);


Klaus Eichner, <klaus03@gmail.com>


The library Win32::MinXSLT is Copyright (C) 2009 by Klaus Eichner.

The interface, which has been copied from XML::LibXSLT, however, is not owned by Klaus Eichner.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.