Index: modules/export_docbook/export_docbook.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/export_docbook/export_docbook.module,v
retrieving revision 1.4
diff -u -r1.4 export_docbook.module
--- modules/export_docbook/export_docbook.module	30 Nov 2005 17:45:28 -0000	1.4
+++ modules/export_docbook/export_docbook.module	2 Nov 2006 21:03:58 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: export_docbook.module,v 1.4 2005/11/30 17:45:28 puregin Exp $
+// $Id: export_docbook.module,v 1.5 2006/04/07 18:50:47 puregin Exp $
 
 /**
  * @file 
@@ -55,7 +55,7 @@
  */
 function book_export_docbook($nid = 0, $depth) {
   $type = drupal_strtolower($type);
-  $depth = _book_get_depth($nid);
+  $depth = count(book_location($node)) + 1;
 
   if (user_access('export books as DocBook XML')) {
     drupal_set_header('Content-Type: text/xml; charset=utf-8');
@@ -79,7 +79,6 @@
 function _export_tidy($html) {
   // Initialize Tidy
   ob_start();
-  tidy_set_encoding('Utf8');
 
   // Set up some configuration options for Tidy
   $config = Array(
@@ -87,12 +86,10 @@
                   'Numeric-Entities' => True,
                   'Output-Xhtml' => True,
                   'Wrap' => 80);
-  foreach ($config as $key => $value) {
-      tidy_setopt($key,$value);
-  }
-  tidy_parse_string($html);
-  tidy_clean_repair();
-  $content = tidy_get_output();
+  $tidy = new tidy;
+  $tidy->parseString($html, $config, 'utf8');
+  $tidy->cleanRepair();
+  $content = $tidy;
 
   $newdom = new DOMDocument('1.0');
 
@@ -153,29 +150,30 @@
 
   // grab the XSL stylesheet from the node where it's stored
   // and initialize the XSLT processor
-  $xsl = new DOMDocument();
+  $xsl = new DOMDocument('1.0', 'iso-8859-1');
   try {
-      $xsl->load('misc/h2db.xsl');
+      $xsl->load(drupal_get_path('module', 'export_docbook').'/h2db.xsl');
   }
   catch (DOMException $e) {
       echo '<pre>';
       print_r ($e);
       echo '</pre>';
   }
-  $xsltproc = new XSLTProcessor();
-  $xsltproc->importStylesheet($xsl);
   
   // make a new input DOM document
-  $inputdoc = new DOMDocument();
-  if (!$inputdoc->loadXML($content)) {
+  $xml = new DOMDocument('1.0', 'iso-8859-1');
+  if (!$xml->loadXML($content)) {
       drupal_set_message(t("There was an error while parsing the content as XML\n"));
   }
 
+  $xsltproc = new XSLTProcessor();
+  $xsltproc->importStylesheet($xsl);
+  
   // Strip out XML directives
   $content = preg_replace('/<\?xml version=.*\?>\s*/i', '', $content);
 
   // Perform the XSLT transformation
-  $content = $xsltproc->transformToXML($inputdoc);
+  $content = $xsltproc->transformToXML($xml);
 
   // Strip out XML directives
   $content = preg_replace('/<\?xml version=.*\?>\s*/i', '', $content);
@@ -269,6 +267,4 @@
   if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'outline') {
     return t('The outline feature allows you to include posts in the <a href="%book">book hierarchy</a>.', array('%book' => url('book')));
   }
-}
-
-?>
+}
\ No newline at end of file
