[xml/sgml-commit] r563 - in packages/libxslt: . branches/upstream/current branches/upstream/current/doc branches/upstream/current/libexslt branches/upstream/current/libxslt

Mike Hommey glandium at costa.debian.org
Thu Jun 8 22:24:17 UTC 2006


Author: glandium
Date: 2006-06-08 22:23:55 +0000 (Thu, 08 Jun 2006)
New Revision: 563

Modified:
   packages/libxslt/
   packages/libxslt/branches/upstream/current/ChangeLog
   packages/libxslt/branches/upstream/current/configure
   packages/libxslt/branches/upstream/current/configure.in
   packages/libxslt/branches/upstream/current/doc/API.html
   packages/libxslt/branches/upstream/current/doc/FAQ.html
   packages/libxslt/branches/upstream/current/doc/bugs.html
   packages/libxslt/branches/upstream/current/doc/contribs.html
   packages/libxslt/branches/upstream/current/doc/docbook.html
   packages/libxslt/branches/upstream/current/doc/docs.html
   packages/libxslt/branches/upstream/current/doc/downloads.html
   packages/libxslt/branches/upstream/current/doc/extensions.html
   packages/libxslt/branches/upstream/current/doc/help.html
   packages/libxslt/branches/upstream/current/doc/index.html
   packages/libxslt/branches/upstream/current/doc/internals.html
   packages/libxslt/branches/upstream/current/doc/intro.html
   packages/libxslt/branches/upstream/current/doc/libxslt.xsa
   packages/libxslt/branches/upstream/current/doc/news.html
   packages/libxslt/branches/upstream/current/doc/python.html
   packages/libxslt/branches/upstream/current/doc/xslt.html
   packages/libxslt/branches/upstream/current/doc/xsltproc2.html
   packages/libxslt/branches/upstream/current/libexslt/exsltconfig.h
   packages/libxslt/branches/upstream/current/libexslt/functions.c
   packages/libxslt/branches/upstream/current/libxslt.spec
   packages/libxslt/branches/upstream/current/libxslt.spec.in
   packages/libxslt/branches/upstream/current/libxslt/attributes.c
   packages/libxslt/branches/upstream/current/libxslt/documents.c
   packages/libxslt/branches/upstream/current/libxslt/extensions.c
   packages/libxslt/branches/upstream/current/libxslt/extensions.h
   packages/libxslt/branches/upstream/current/libxslt/imports.c
   packages/libxslt/branches/upstream/current/libxslt/keys.c
   packages/libxslt/branches/upstream/current/libxslt/namespaces.c
   packages/libxslt/branches/upstream/current/libxslt/pattern.c
   packages/libxslt/branches/upstream/current/libxslt/preproc.c
   packages/libxslt/branches/upstream/current/libxslt/templates.c
   packages/libxslt/branches/upstream/current/libxslt/transform.c
   packages/libxslt/branches/upstream/current/libxslt/variables.c
   packages/libxslt/branches/upstream/current/libxslt/xslt.c
   packages/libxslt/branches/upstream/current/libxslt/xsltInternals.h
   packages/libxslt/branches/upstream/current/libxslt/xsltconfig.h
   packages/libxslt/branches/upstream/current/libxslt/xsltutils.c
   packages/libxslt/branches/upstream/current/libxslt/xsltutils.h
   packages/libxslt/branches/upstream/current/libxslt/xsltwin32config.h
Log:
 r1078 at namakemono:  mh | 2006-06-08 11:23:09 +0200
 Load /tmp/libxslt-1.1.17 into
 libxslt/branches/upstream/current.



Property changes on: packages/libxslt
___________________________________________________________________
Name: svk:merge
   - 85a06573-1206-0410-a182-ce9117885d71:/local/libxslt:284
a066b643-3b0a-0410-a6ba-ed4cca522822:/local/libxslt:1059

   + 85a06573-1206-0410-a182-ce9117885d71:/local/libxslt:284
a066b643-3b0a-0410-a6ba-ed4cca522822:/local/libxslt:1078

Modified: packages/libxslt/branches/upstream/current/ChangeLog
===================================================================
--- packages/libxslt/branches/upstream/current/ChangeLog	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/ChangeLog	2006-06-08 22:23:55 UTC (rev 563)
@@ -1,3 +1,112 @@
+Tue Jun  6 17:16:33 CEST 2006 Daniel Veillard <daniel at veillard.com>
+
+	* configure.in libxslt.spec.in doc//*: preparing release of 1.1.17
+
+Tue Jun  6 11:44:34 CEST 2006 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* libxslt/attributes.c: Eliminated a tiny difference wrt to
+	  the old behaviour in the naming of newly generated ns-decls
+	  in xsltAttributeInternal().
+
+Thu Jun  1 15:06:31 CEST 2006 Daniel Veillard <daniel at veillard.com>
+
+	* configure.in: fix a problem in Python detection
+
+Thu Jun  1 13:58:19 CEST 2006 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* libxslt/attributes.c libxslt/variables.c
+	  libxslt/transform.c libxslt/xslt.c:
+	  Next step in the refactored code: enhanced xsl:attribute;
+	  enhanced xsltCopyProp.
+	  Added the creation of an XPath cache in
+	  xsltNewTransformContext().
+
+Wed May 31 22:32:44 CEST 2006 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* libxslt/transform.c: Fixed a difference in processing of
+	  xsl:value-of and  xsl:text wrt to merging of strings of
+	  output-escaped text-nodes. This difference made the
+	  optimized string-merging mechanism run out of sync, which
+	  led to segfaults in subsequent string reallocations. See
+	  bug #343411, reported by Grzegorz Kaczor.
+	* xslt.c: Added check for ctxt->internalized when we parse
+	  xsl:text and internalize the strings.
+
+Mon May 22 10:32:57 CEST 2006 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* libxslt/attributes.c libxslt/documents.c
+	  libxslt/extensions.c libxslt/keys.c libxslt/pattern.c
+	  libxslt/preproc.c libxslt/templates.c
+	  libxslt/transform.c libxslt/variables.c
+	  libxslt/xslt.c libxslt/xsltInternals.h:
+	  Next tiny step of refactoring - mostly bug fixes and
+	  cosmetic changes.
+	  Changes outside of the refactored code:
+	  1) Optimized xsl:attribute if the content consists of
+	   just 1 text node.
+	  2) Optimized computation of xsl:key. The keys will now be
+	   computed for a specific document not until the first call
+	   of a key() function; here only the keys with the specific
+	   name used by key() are computed. This means that this
+	   now avoids computation of all keys for all loaded
+	   input documents (even if no key() was called on them).
+	   One exception is the scenario where a key() is used in
+	   a template's match pattern; in this case all keys are
+	   computed for a document if there's a chance that
+	   a "keyed" template could match a node (this could still
+	   be optimized a bit).
+
+Mon May 15 22:32:13 CEST 2006 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* libxslt/namespaces.c libxslt/attributes.c:
+	  Fixed bug #302020, reported by Thomas Blatter.
+
+Fri May 12 23:23:06 CEST 2006 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* libxslt/documents.c libxslt/namespaces.c
+	  libxslt/preproc.c libxslt/transform.c
+	  libxslt/xslt.c libxslt/xsltInternals.h libxslt/xsltutils.c:
+	  Next step of refactoring. For more details see bug #341588.
+	  I applied the suggestion of Jerome Pesenti to the refactored
+	  (still IDFEDed out with XSLT_REFACTORED) code: The XPath
+	  compilation context (accessible via the compilation context)
+	  is now reused for compilation of expressions at
+	  compilation-time; this should reduce compilation time to 50%
+	  for avarage stylesheets.
+
+Thu May 11 22:12:22 CEST 2006 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* libxslt/extensions.c: Changed a comment to indicate that a
+	  specific bug was already fixed.
+	  
+Fri May  5 23:10:47 CEST 2006 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* libxslt/xsltInternals.h libxslt/attributes.c
+	  libxslt/documents.c libxslt/extensions.c
+	  libxslt/extensions.h libxslt/functions.c
+	  libxslt/imports.c libxslt/keys.c libxslt/preproc.c
+	  libxslt/transform.c libxslt/variables.c libxslt/xslt.c
+	  libxslt/xsltutils.c libxslt/xsltutils.h libexslt/functions.c:
+	  Next step of refactoring (plus some bug-fixes).
+	  For more details see #340780.
+
+Fri May  5 14:31:53 CEST 2006 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* tests/exslt/common/node-set.5.out
+	  tests/exslt/sets/difference.1.out
+	  tests/exslt/functions/function.6.out: Reverting the
+	  changes; I'll rather change the processing stylesheet
+	  documents in a way that they will produce the same results
+	  for broken and stricter whitespace-stripping.
+
+Thu May  4 22:55:26 CEST 2006 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* tests/exslt/common/node-set.5.out
+	  tests/exslt/sets/difference.1.out
+	  tests/exslt/functions/function.6.out: Changed regression test
+	  results (bug #340684). Those will now produce regression
+	  errors; so we need to fix the processor.
+
 Mon May  1 17:39:27 EDT 2006 Daniel Veillard <daniel at veillard.com>
 
 	* configure.in NEWS doc//*: preparing release of 1.1.16, updated and

Modified: packages/libxslt/branches/upstream/current/configure
===================================================================
--- packages/libxslt/branches/upstream/current/configure	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/configure	2006-06-08 22:23:55 UTC (rev 563)
@@ -1589,12 +1589,12 @@
 
 LIBXSLT_MAJOR_VERSION=1
 LIBXSLT_MINOR_VERSION=1
-LIBXSLT_MICRO_VERSION=16
+LIBXSLT_MICRO_VERSION=17
 PACKAGE=libxslt
 LIBEXSLT_MAJOR_VERSION=0
 LIBEXSLT_MINOR_VERSION=8
 LIBEXSLT_MICRO_VERSION=13
-LIBXML_REQUIRED_VERSION=2.6.17 # if you need module support.
+LIBXML_REQUIRED_VERSION=2.6.25
 
 
 LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
@@ -21724,7 +21724,7 @@
     fi
     if test "$with_python" != ""
     then
-        pythondir=$(PYTHON_SITE_PACKAGES)
+        pythondir='$(PYTHON_SITE_PACKAGES)'
     else
         pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
     fi

Modified: packages/libxslt/branches/upstream/current/configure.in
===================================================================
--- packages/libxslt/branches/upstream/current/configure.in	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/configure.in	2006-06-08 22:23:55 UTC (rev 563)
@@ -10,12 +10,12 @@
 dnl
 LIBXSLT_MAJOR_VERSION=1
 LIBXSLT_MINOR_VERSION=1
-LIBXSLT_MICRO_VERSION=16
+LIBXSLT_MICRO_VERSION=17
 PACKAGE=libxslt
 LIBEXSLT_MAJOR_VERSION=0
 LIBEXSLT_MINOR_VERSION=8
 LIBEXSLT_MICRO_VERSION=13
-LIBXML_REQUIRED_VERSION=2.6.17 # if you need module support.
+LIBXML_REQUIRED_VERSION=2.6.25
 
 
 LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
@@ -223,7 +223,7 @@
     fi
     if test "$with_python" != ""
     then
-        pythondir=$(PYTHON_SITE_PACKAGES)
+        pythondir='$(PYTHON_SITE_PACKAGES)'
     else
         pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
     fi

Modified: packages/libxslt/branches/upstream/current/doc/API.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/API.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/API.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,19 +8,19 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>The programming API</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>The programming API</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>Okay this section is clearly incomplete. But integrating libxslt into your
-application should be relatively easy. First check the few steps described
-below, then for more detailed informations, look at the<a href="html/libxslt-lib.html"> generated pages</a> for the API and the source
-of libxslt/xsltproc.c  and the  <a href="tutorial/libxslttutorial.html">tutorial</a>.</p><p>Basically doing an XSLT transformation can be done in a few steps:</p><ol><li>configure the parser for XSLT:
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>Okay this section is clearly incomplete. But integrating libxslt into
+yourapplication should be relatively easy. First check the few steps
+describedbelow, then for more detailed informations, look at the<a href="html/libxslt-lib.html">generated pages</a>for the API and the sourceof
+libxslt/xsltproc.c  and the  <a href="tutorial/libxslttutorial.html">tutorial</a>.</p><p>Basically doing an XSLT transformation can be done in a few steps:</p><ol><li>configure the parser for XSLT:
     <p>xmlSubstituteEntitiesDefault(1);</p>
     <p>xmlLoadExtDtdDefaultValue = 1;</p>
   </li>
   <li>parse the stylesheet with xsltParseStylesheetFile()</li>
   <li>parse the document with xmlParseFile()</li>
   <li>apply the stylesheet using xsltApplyStylesheet()</li>
-  <li>save the result using xsltSaveResultToFile() if needed set
-    xmlIndentTreeOutput to 1</li>
-</ol><p>Steps 2,3, and 5 will probably need to be changed depending on you
-processing needs and environment for example if reading/saving from/to
-memory, or if you want to apply XInclude processing to the stylesheet or
-input documents.</p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>
+  <li>save the result using xsltSaveResultToFile() if needed
+    setxmlIndentTreeOutput to 1</li>
+</ol><p>Steps 2,3, and 5 will probably need to be changed depending on
+youprocessing needs and environment for example if reading/saving
+from/tomemory, or if you want to apply XInclude processing to the stylesheet
+orinput documents.</p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/FAQ.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/FAQ.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/FAQ.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -9,35 +9,35 @@
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>FAQ</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>FAQ</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
           <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><ol><li><em>Troubles compiling or linking programs using libxslt</em>
-    <p>Usually the problem comes from the fact that the compiler doesn't get
-    the right compilation or linking flags. There is a small shell script
-    <code>xslt-config</code> which is installed as part of libxslt usual
-    install process which provides those flags. Use</p>
+    <p>Usually the problem comes from the fact that the compiler doesn't
+    getthe right compilation or linking flags. There is a small shell
+    script<code>xslt-config</code>which is installed as part of libxslt
+    usualinstall process which provides those flags. Use</p>
     <p><code>xslt-config --cflags</code></p>
     <p>to get the compilation flags and</p>
     <p><code>xslt-config --libs</code></p>
-    <p>to get the linker flags. Usually this is done directly from the
-    Makefile as:</p>
+    <p>to get the linker flags. Usually this is done directly from
+    theMakefile as:</p>
     <p><code>CFLAGS=`xslt-config --cflags`</code></p>
     <p><code>LIBS=`xslt-config --libs`</code></p>
-    <p>Note also that if you use the EXSLT extensions from the program then
-    you should prepend <code>-lexslt</code> to the LIBS options</p>
+    <p>Note also that if you use the EXSLT extensions from the program
+    thenyou should prepend <code>-lexslt</code>to the LIBS options</p>
   </li>
   <li><em>passing parameters on the xsltproc command line doesn't work</em>
     <p><em>xsltproc --param test alpha foo.xsl foo.xml</em></p>
     <p><em>the param does not get passed and ends up as ""</em></p>
     <p>In a nutshell do a double escaping at the shell prompt:</p>
     <p>xsltproc --param test "'alpha'" foo.xsl foo.xml</p>
-    <p>i.e. the string value is surrounded by " and ' then terminated by '
-    and ". Libxslt interpret the parameter values as XPath expressions, so
-    the string -&gt;<code>alpha</code>&lt;- is intepreted as the node set
-    matching this string. You really want -&gt;<code>'alpha'</code>&lt;- to
-    be passed to the processor. And to allow this you need to escape the
-    quotes at the shell level using -&gt;<code>"'alpha'"</code>&lt;- .</p>
+    <p>i.e. the string value is surrounded by " and ' then terminated by 'and
+    ". Libxslt interpret the parameter values as XPath expressions, sothe
+    string -&gt;<code>alpha</code>&lt;- is intepreted as the node setmatching
+    this string. You really want -&gt;<code>'alpha'</code>&lt;- tobe passed
+    to the processor. And to allow this you need to escape thequotes at the
+    shell level using -&gt;<code>"'alpha'"</code>&lt;- .</p>
     <p>or use</p>
     <p>xsltproc --stringparam test alpha foo.xsl foo.xml</p>
   </li>
   <li><em>Is there C++ bindings ?</em>
-    <p>Yes for example <a href="http://pmade.org/pjones/software/xmlwrapp/">xmlwrapp</a> , see <a href="python.html">the related pages about bindings</a></p>
+    <p>Yes for example <a href="http://pmade.org/pjones/software/xmlwrapp/">xmlwrapp</a>, see <a href="python.html">the related pages about bindings</a></p>
   </li>
 </ol><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/bugs.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/bugs.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/bugs.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,86 +8,84 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>Reporting bugs and getting help</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>Reporting bugs and getting help</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>If you need help with the XSLT language itself, here are a number of
-useful resources:</p><ul><li>I strongly suggest to subscribe to <a href="http://www.mulberrytech.com/xsl/xsl-list">XSL-list</a>, check <a href="http://www.biglist.com/lists/xsl-list/archives/">the XSL-list
-    archives</a></li>
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>If you need help with the XSLT language itself, here are a number ofuseful
+resources:</p><ul><li>I strongly suggest to subscribe to <a href="http://www.mulberrytech.com/xsl/xsl-list">XSL-list</a>, check <a href="http://www.biglist.com/lists/xsl-list/archives/">the
+    XSL-listarchives</a></li>
   <li>The <a href="http://www.dpawson.co.uk/xsl/xslfaq.html">XSL FAQ</a>.</li>
-  <li>The <a href="http://www.nwalsh.com/docs/tutorials/xsl/xsl/slides.html">tutorial</a>
-    written by Paul Grosso and Norman Walsh is a very good on-line
-    introdution to the language.</li>
-  <li>The <a href="http://www.zvon.org/xxl/XSLTutorial/Books/Book1/index.html">only
-    Zvon XSLT tutorial</a> details a lot of constructs with examples.</li>
-  <li><a href="http://www.jenitennison.com/xslt/index.html">Jeni Tennison's
-    XSLT</a> pages provide links to a lot of answers</li>
-  <li>the <a href="http://incrementaldevelopment.com/xsltrick/">Gallery of
-    XSLT Tricks</a> provides non-standard use case of XSLT</li>
-  <li>And I suggest to buy Michael Kay "XSLT Programmer's Reference" book
-    published by <a href="http://www.wrox.com/">Wrox</a> if you plan to work
-    seriously with XSLT in the future.</li>
-</ul><p>Well, bugs or missing features are always possible, and I will make a
-point of fixing them in a timely fashion. The best way to report a bug is to
-use the <a href="http://bugzilla.gnome.org/enter_bug.cgi?product=libxslt">Gnome bug
-tracking database</a> (make sure to use the "libxslt" module name). Before
-filing a bug, check the <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">list of existing
-libxslt bugs</a> to make sure it hasn't already been filed. I look at reports
-there regularly and it's good to have a reminder when a bug is still open. Be
-sure to specify that the bug is for the package libxslt.</p><p>For small problems you can try to get help on IRC, the #xml channel on
-irc.gnome.org (port 6667) usually have a few person subscribed which may help
-(but there is no garantee and if a real issue is raised it should go on the
-mailing-list for archival).</p><p>There is also a mailing-list <a href="mailto:xslt at gnome.org">xslt at gnome.org</a> for libxslt, with an <a href="http://mail.gnome.org/archives/xslt/">on-line archive</a>. To subscribe
-to this list, please visit the <a href="http://mail.gnome.org/mailman/listinfo/xslt">associated Web</a> page
-and follow the instructions.</p><p>Alternatively, you can just send the bug to the <a href="mailto:xslt at gnome.org">xslt at gnome.org</a> list, if it's really libxslt
-related I will approve it.. Please do not send me mail directly especially
-for portability problem, it makes things really harder to track and in some
-cases I'm not the best person to answer a given question, ask the list
-instead. <strong>Do not send code, I won't debug it</strong> (but patches are
-really appreciated!).</p><p>Please note that with the current amount of virus and SPAM, sending mail
-to the list without being subscribed won't work. There is *far too many
-bounces* (in the order of a thousand a day !) I cannot approve them manually
-anymore. If your mail to the list bounced waiting for administrator approval,
-it is LOST ! Repost it and fix the problem triggering the error. Also please
-note that <span style="color: #FF0000; background-color: #FFFFFF">emails with
-a legal warning asking to not copy or redistribute freely the informations
-they contain</span> are <strong>NOT</strong> acceptable for the mailing-list,
-such mail will as much as possible be discarded automatically, and are less
-likely to be answered if they made it to the list, <strong>DO NOT</strong>
-post to the list from an email address where such legal requirements are
-automatically added, get private paying support if you can't share
-informations.</p><p>Check the following too <span style="color: #E50000">before
-posting</span>:</p><ul><li><a href="search.php">use the search engine</a> to get informations
-    related to your problem.</li>
-  <li>make sure you are <a href="ftp://xmlsoft.org/libxslt/">using a recent
-    version</a>, and that the problem still shows up in those</li>
-  <li>check the <a href="http://mail.gnome.org/archives/xslt/">list
-    archives</a> to see if the problem was reported already, in this case
-    there is probably a fix available, similarly check the <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">registered
-    open bugs</a></li>
-  <li>make sure you can reproduce the bug with xsltproc, a very useful thing
-    to do is run the transformation with -v argument and redirect the
-    standard error to a file, then search in this file for the transformation
-    logs just preceding the possible problem</li>
-  <li>Please send the command showing the error as well as the input and
-    stylesheet (as an attachment)</li>
-</ul><p>Then send the bug with associated informations to reproduce it to the <a href="mailto:xslt at gnome.org">xslt at gnome.org</a> list; if it's really libxslt
-related I will approve it. Please do not send mail to me directly, it makes
-things really hard to track and in some cases I am not the best person to
-answer a given question, ask on the list.</p><p>To <span style="color: #E50000">be really clear about support</span>:</p><ul><li>Support or help <span style="color: #E50000">request MUST be sent to
-    the list or on bugzilla</span> in case of problems, so that the Question
-    and Answers can be shared publicly. Failing to do so carries the implicit
-    message "I want free support but I don't want to share the benefits with
-    others" and is not welcome. I will automatically Carbon-Copy the
-    xslt at gnome.org mailing list for any technical reply made about libxml2 or
-    libxslt.</li>
-  <li>There is <span style="color: #E50000">no garantee for support</span>,
-    if your question remains unanswered after a week, repost it, making sure
-    you gave all the detail needed and the informations requested.</li>
-  <li>Failing to provide informations as requested or double checking first
-    for prior feedback also carries the implicit message "the time of the
-    library maintainers is less valuable than my time" and might not be
-    welcome.</li>
-</ul><p>Of course, bugs reports with a suggested patch for fixing them will
-probably be processed faster.</p><p>If you're looking for help, a quick look at <a href="http://mail.gnome.org/archives/xslt/">the list archive</a> may actually
-provide the answer, I usually send source samples when answering libxslt
-usage questions. The <a href="html/libxslt-lib.html#LIBXSLT-LIB">auto-generated documentation</a> is
-not as polished as I would like (I need to learn more about Docbook), but
-it's a good starting point.</p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>
+  <li>The <a href="http://www.nwalsh.com/docs/tutorials/xsl/xsl/slides.html">tutorial</a>written
+    by Paul Grosso and Norman Walsh is a very good on-lineintrodution to the
+    language.</li>
+  <li>The <a href="http://www.zvon.org/xxl/XSLTutorial/Books/Book1/index.html">onlyZvon
+    XSLT tutorial</a>details a lot of constructs with examples.</li>
+  <li><a href="http://www.jenitennison.com/xslt/index.html">Jeni
+    Tennison'sXSLT</a>pages provide links to a lot of answers</li>
+  <li>the <a href="http://incrementaldevelopment.com/xsltrick/">Gallery
+    ofXSLT Tricks</a>provides non-standard use case of XSLT</li>
+  <li>And I suggest to buy Michael Kay "XSLT Programmer's Reference"
+    bookpublished by <a href="http://www.wrox.com/">Wrox</a>if you plan to
+    workseriously with XSLT in the future.</li>
+</ul><p>Well, bugs or missing features are always possible, and I will make apoint
+of fixing them in a timely fashion. The best way to report a bug is touse the
+<a href="http://bugzilla.gnome.org/enter_bug.cgi?product=libxslt">Gnome
+bugtracking database</a>(make sure to use the "libxslt" module name).
+Beforefiling a bug, check the <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">list of
+existinglibxslt bugs</a>to make sure it hasn't already been filed. I look at
+reportsthere regularly and it's good to have a reminder when a bug is still
+open. Besure to specify that the bug is for the package libxslt.</p><p>For small problems you can try to get help on IRC, the #xml channel
+onirc.gnome.org (port 6667) usually have a few person subscribed which may
+help(but there is no garantee and if a real issue is raised it should go on
+themailing-list for archival).</p><p>There is also a mailing-list <a href="mailto:xslt at gnome.org">xslt at gnome.org</a>for libxslt, with an <a href="http://mail.gnome.org/archives/xslt/">on-line archive</a>. To
+subscribeto this list, please visit the <a href="http://mail.gnome.org/mailman/listinfo/xslt">associated Web</a>pageand
+follow the instructions.</p><p>Alternatively, you can just send the bug to the <a href="mailto:xslt at gnome.org">xslt at gnome.org</a>list, if it's really
+libxsltrelated I will approve it.. Please do not send me mail directly
+especiallyfor portability problem, it makes things really harder to track and
+in somecases I'm not the best person to answer a given question, ask the
+listinstead. <strong>Do not send code, I won't debug it</strong>(but patches
+arereally appreciated!).</p><p>Please note that with the current amount of virus and SPAM, sending mailto
+the list without being subscribed won't work. There is *far too manybounces*
+(in the order of a thousand a day !) I cannot approve them manuallyanymore.
+If your mail to the list bounced waiting for administrator approval,it is
+LOST ! Repost it and fix the problem triggering the error. Also pleasenote
+that <span style="color: #FF0000; background-color: #FFFFFF">emails witha
+legal warning asking to not copy or redistribute freely the informationsthey
+contain</span>are <strong>NOT</strong>acceptable for the mailing-list,such
+mail will as much as possible be discarded automatically, and are lesslikely
+to be answered if they made it to the list, <strong>DO NOT</strong>post to
+the list from an email address where such legal requirements areautomatically
+added, get private paying support if you can't shareinformations.</p><p>Check the following too <span style="color: #E50000">beforeposting</span>:</p><ul><li><a href="search.php">use the search engine</a>to get
+    informationsrelated to your problem.</li>
+  <li>make sure you are <a href="ftp://xmlsoft.org/libxslt/">using a
+    recentversion</a>, and that the problem still shows up in those</li>
+  <li>check the <a href="http://mail.gnome.org/archives/xslt/">listarchives</a>to see if the
+    problem was reported already, in this casethere is probably a fix
+    available, similarly check the <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">registeredopen
+    bugs</a></li>
+  <li>make sure you can reproduce the bug with xsltproc, a very useful
+    thingto do is run the transformation with -v argument and redirect
+    thestandard error to a file, then search in this file for the
+    transformationlogs just preceding the possible problem</li>
+  <li>Please send the command showing the error as well as the input
+    andstylesheet (as an attachment)</li>
+</ul><p>Then send the bug with associated informations to reproduce it to the <a href="mailto:xslt at gnome.org">xslt at gnome.org</a>list; if it's really
+libxsltrelated I will approve it. Please do not send mail to me directly, it
+makesthings really hard to track and in some cases I am not the best person
+toanswer a given question, ask on the list.</p><p>To <span style="color: #E50000">be really clear about support</span>:</p><ul><li>Support or help <span style="color: #E50000">request MUST be sent tothe
+    list or on bugzilla</span>in case of problems, so that the Questionand
+    Answers can be shared publicly. Failing to do so carries the
+    implicitmessage "I want free support but I don't want to share the
+    benefits withothers" and is not welcome. I will automatically Carbon-Copy
+    thexslt at gnome.org mailing list for any technical reply made about libxml2
+    orlibxslt.</li>
+  <li>There is <span style="color: #E50000">no garantee for support</span>,if
+    your question remains unanswered after a week, repost it, making sureyou
+    gave all the detail needed and the informations requested.</li>
+  <li>Failing to provide informations as requested or double checking
+    firstfor prior feedback also carries the implicit message "the time of
+    thelibrary maintainers is less valuable than my time" and might not
+    bewelcome.</li>
+</ul><p>Of course, bugs reports with a suggested patch for fixing them
+willprobably be processed faster.</p><p>If you're looking for help, a quick look at <a href="http://mail.gnome.org/archives/xslt/">the list archive</a>may
+actuallyprovide the answer, I usually send source samples when answering
+libxsltusage questions. The <a href="html/libxslt-lib.html#LIBXSLT-LIB">auto-generated
+documentation</a>isnot as polished as I would like (I need to learn more
+about Docbook), butit's a good starting point.</p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/contribs.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/contribs.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/contribs.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,34 +8,33 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>Contributions</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>Contributions</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><ul><li>Bjorn Reese is the author of the number support and worked on the
-    XSLTMark support</li>
-  <li>William Brack was an early adopted, contributed a number of patches and
-    spent quite some time debugging non-trivial problems in early versions of
-    libxslt</li>
-  <li><a href="mailto:igor at zlatkovic.com">Igor  Zlatkovic</a> is now the
-    maintainer of the Windows port, <a href="http://www.zlatkovic.com/projects/libxml/index.html">he provides
-    binaries</a></li>
-  <li>Thomas Broyer provided a lot of suggestions, and drafted most of the
-    extension API</li>
-  <li>John Fleck maintains <a href="tutorial/libxslttutorial.html">a tutorial
-    for libxslt</a></li>
-  <li><a href="http://mail.gnome.org/archives/xml/2001-March/msg00014.html">Matt
-    Sergeant</a> developed <a href="http://axkit.org/download/">XML::LibXSLT</a>, a perl wrapper for
-    libxml2/libxslt as part of the <a href="http://axkit.com/">AxKit XML
-    application server</a></li>
-  <li>there is a module for <a href="http://acs-misc.sourceforge.net/nsxml.html">libxml/libxslt support
-    in OpenNSD/AOLServer</a></li>
-  <li><a href="mailto:dkuhlman at cutter.rexx.com">Dave Kuhlman</a> provides
-    libxml/libxslt <a href="http://www.rexx.com/~dkuhlman">wrappers for
-    Python</a></li>
-  <li><a href="mailto:Steve.Ball at explain.com.au">Steve Ball</a>, and
-    contributors maintain <a href="http://tclxml.sourceforge.net/">tcl
-    bindings for libxml2 and libxslt</a>, as well as <a href="http://tclxml.sf.net/tkxmllint.html">tkxmllint</a> a GUI for
-    xmllint and <a href="http://tclxml.sf.net/tkxsltproc.html">tkxsltproc</a>
-    a GUI for xsltproc.</li>
-  <li>If you want to use libxslt in a Mac OS X/Cocoa or Objective-C
-    framework, Marc Liyanage provides <a href="http://www.entropy.ch/software/macosx/#testxslt">an application
-    TestXSLT for XSLT and XML editing</a> including wrapper classes for the
-    XML parser and XSLT processor.</li>
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><ul><li>Bjorn Reese is the author of the number support and worked on
+    theXSLTMark support</li>
+  <li>William Brack was an early adopted, contributed a number of patches
+    andspent quite some time debugging non-trivial problems in early versions
+    oflibxslt</li>
+  <li><a href="mailto:igor at zlatkovic.com">Igor  Zlatkovic</a>is now
+    themaintainer of the Windows port, <a href="http://www.zlatkovic.com/projects/libxml/index.html">he
+    providesbinaries</a></li>
+  <li>Thomas Broyer provided a lot of suggestions, and drafted most of
+    theextension API</li>
+  <li>John Fleck maintains <a href="tutorial/libxslttutorial.html">a
+    tutorialfor libxslt</a></li>
+  <li><a href="http://mail.gnome.org/archives/xml/2001-March/msg00014.html">MattSergeant</a>developed
+    <a href="http://axkit.org/download/">XML::LibXSLT</a>, a perl wrapper
+    forlibxml2/libxslt as part of the <a href="http://axkit.com/">AxKit
+    XMLapplication server</a></li>
+  <li>there is a module for <a href="http://acs-misc.sourceforge.net/nsxml.html">libxml/libxslt
+    supportin OpenNSD/AOLServer</a></li>
+  <li><a href="mailto:dkuhlman at cutter.rexx.com">Dave
+    Kuhlman</a>provideslibxml/libxslt <a href="http://www.rexx.com/~dkuhlman">wrappers forPython</a></li>
+  <li><a href="mailto:Steve.Ball at explain.com.au">Steve Ball</a>,
+    andcontributors maintain <a href="http://tclxml.sourceforge.net/">tclbindings for libxml2 and
+    libxslt</a>, as well as <a href="http://tclxml.sf.net/tkxmllint.html">tkxmllint</a>a GUI forxmllint
+    and <a href="http://tclxml.sf.net/tkxsltproc.html">tkxsltproc</a>a GUI
+    for xsltproc.</li>
+  <li>If you want to use libxslt in a Mac OS X/Cocoa or Objective-Cframework,
+    Marc Liyanage provides <a href="http://www.entropy.ch/software/macosx/#testxslt">an
+    applicationTestXSLT for XSLT and XML editing</a>including wrapper classes
+    for theXML parser and XSLT processor.</li>
 </ul><p></p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/docbook.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/docbook.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/docbook.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,56 +8,53 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>DocBook</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>DocBook</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p><img src="duck.png" align="right" alt="The duck picture" /></p><p><a href="http://www.oasis-open.org/committees/docbook/">DocBook</a> is an
-XML/SGML vocabulary particularly well suited to books and papers about
-computer hardware and software.</p><p>xsltproc and libxslt are not specifically dependant on DocBook, but since
-a lot of people use xsltproc and libxml2 for DocBook formatting, here are a
-few pointers and informations which may be helpful:</p><ul><li>The <a href="http://www.oasis-open.org/committees/docbook/">DocBook
-    homepage at Oasis</a> you should find pointers there on all the lastest
-    versions of the DTDs and XSLT stylesheets</li>
-  <li><a href="http://www.docbook.org/">DocBook: The Definitive Guide</a> is
-    the official reference documentation for DocBook.</li>
-  <li><a href="https://sourceforge.net/docman/index.php?group_id=21935">DocBook
-    Open Repository</a> contains a lot of informations about DocBook</li>
-  <li>Bob Stayton provides a <a href="http://www.sagehill.net/">lot of
-    resources</a> and consulting services around DocBook.</li>
-  <li>Here is a <a href="/buildDocBookCatalog">shell script</a> to generate
-    XML Catalogs for DocBook 4.1.2 . If it can write to the /etc/xml/
-    directory, it will set-up /etc/xml/catalog and /etc/xml/docbook based on
-    the resources found on the system. Otherwise it will just create
-    ~/xmlcatalog and ~/dbkxmlcatalog and doing:
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p><img src="duck.png" align="right" alt="The duck picture" /></p><p><a href="http://www.oasis-open.org/committees/docbook/">DocBook</a>is
+anXML/SGML vocabulary particularly well suited to books and papers
+aboutcomputer hardware and software.</p><p>xsltproc and libxslt are not specifically dependant on DocBook, but sincea
+lot of people use xsltproc and libxml2 for DocBook formatting, here are afew
+pointers and informations which may be helpful:</p><ul><li>The <a href="http://www.oasis-open.org/committees/docbook/">DocBookhomepage at
+    Oasis</a>you should find pointers there on all the lastestversions of the
+    DTDs and XSLT stylesheets</li>
+  <li><a href="http://www.docbook.org/">DocBook: The Definitive
+    Guide</a>isthe official reference documentation for DocBook.</li>
+  <li><a href="https://sourceforge.net/docman/index.php?group_id=21935">DocBookOpen
+    Repository</a>contains a lot of informations about DocBook</li>
+  <li>Bob Stayton provides a <a href="http://www.sagehill.net/">lot
+    ofresources</a>and consulting services around DocBook.</li>
+  <li>Here is a <a href="/buildDocBookCatalog">shell script</a>to generateXML
+    Catalogs for DocBook 4.1.2 . If it can write to the /etc/xml/directory,
+    it will set-up /etc/xml/catalog and /etc/xml/docbook based onthe
+    resources found on the system. Otherwise it will just create~/xmlcatalog
+    and ~/dbkxmlcatalog and doing:
     <p><code>export XMLCATALOG=$HOME/xmlcatalog</code></p>
-    <p>should allow to process DocBook documentations without requiring
-    network accesses for the DTd or stylesheets</p>
+    <p>should allow to process DocBook documentations without
+    requiringnetwork accesses for the DTd or stylesheets</p>
   </li>
-  <li>I have uploaded <a href="ftp://xmlsoft.org/libxml2/test/dbk412catalog.tar.gz">a
-    small tarball</a> containing XML Catalogs for DocBook 4.1.2 which seems
-    to work fine for me too</li>
-  <li>Informations on installing a <a href="http://ourworld.compuserve.com/homepages/hoenicka_markus/ntsgml.html">Windows
-    DocBook processing setup</a> based on Cygwin (using the binaries from the
-    official Windows port should be possible too)</li>
-  <li>Alexander Kirillov's page on <a href="http://www.math.sunysb.edu/~kirillov/dbxml/">Using DocBook XML
-    4.1.2</a> (RPM packages)</li>
-  <li>Tim Waugh's <a href="http://cyberelk.net/tim/xmlto/">xmlto front-end
-    conversion script</a></li>
-  <li>Linux Documentation Project <a href="http://www.linuxdoc.org/HOWTO/mini/DocBook-Install/">
-    DocBook-Install-mini-HOWTO</a></li>
-  <li>ScrollKeeper the open documentation cataloging project has a <a href="http://scrollkeeper.sourceforge.net/docbook.shtml">DocBook
-    section</a></li>
-  <li>Dan York presentation on <a href="http://www.lodestar2.com/people/dyork/talks/2001/xugo/docbook/index.html">Publishing
-    using DocBook XML</a></li>
-</ul><p>Do not use the --docbook option of xsltproc to process XML DocBook
-documents, this option is only intended to provide some (limited) support of
-the SGML version of DocBook.</p><p>Points which are not DocBook specific but still worth mentionning
-again:</p><ul><li>if you think DocBook processing time is too slow, make sure you have
-    XML Catalogs pointing to a local installation of the DTD of DocBook.
-    Check the <a href="http://xmlsoft.org/catalog.html">XML Catalog page</a>
-    to understand more on this subject.</li>
+  <li>I have uploaded <a href="ftp://xmlsoft.org/libxml2/test/dbk412catalog.tar.gz">asmall
+    tarball</a>containing XML Catalogs for DocBook 4.1.2 which seemsto work
+    fine for me too</li>
+  <li>Informations on installing a <a href="http://ourworld.compuserve.com/homepages/hoenicka_markus/ntsgml.html">WindowsDocBook
+    processing setup</a>based on Cygwin (using the binaries from theofficial
+    Windows port should be possible too)</li>
+  <li>Alexander Kirillov's page on <a href="http://www.math.sunysb.edu/~kirillov/dbxml/">Using DocBook
+    XML4.1.2</a>(RPM packages)</li>
+  <li>Tim Waugh's <a href="http://cyberelk.net/tim/xmlto/">xmlto
+    front-endconversion script</a></li>
+  <li>Linux Documentation Project <a href="http://www.linuxdoc.org/HOWTO/mini/DocBook-Install/">DocBook-Install-mini-HOWTO</a></li>
+  <li>ScrollKeeper the open documentation cataloging project has a <a href="http://scrollkeeper.sourceforge.net/docbook.shtml">DocBooksection</a></li>
+  <li>Dan York presentation on <a href="http://www.lodestar2.com/people/dyork/talks/2001/xugo/docbook/index.html">Publishingusing
+    DocBook XML</a></li>
+</ul><p>Do not use the --docbook option of xsltproc to process XML
+DocBookdocuments, this option is only intended to provide some (limited)
+support ofthe SGML version of DocBook.</p><p>Points which are not DocBook specific but still worth mentionningagain:</p><ul><li>if you think DocBook processing time is too slow, make sure you haveXML
+    Catalogs pointing to a local installation of the DTD of DocBook.Check the
+    <a href="http://xmlsoft.org/catalog.html">XML Catalog page</a>to
+    understand more on this subject.</li>
   <li>before processing a new document, use the command
     <p><code>xmllint --valid --noout path_to_document</code></p>
-    <p>to make sure that your input is valid DocBook. And fixes the errors
-    before processing further. Note that XSLT processing may work correctly
-    with some forms of validity errors left, but in general it can give
-    troubles on output.</p>
+    <p>to make sure that your input is valid DocBook. And fixes the
+    errorsbefore processing further. Note that XSLT processing may work
+    correctlywith some forms of validity errors left, but in general it can
+    givetroubles on output.</p>
   </li>
 </ul><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/docs.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/docs.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/docs.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,12 +8,11 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>Documentation</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>Documentation</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>There are some on-line resources about using libxslt:</p><ol><li>Check the <a href="html/libxslt-lib.html#LIBXSLT-LIB">API
-    documentation</a> automatically extracted from code comments (using the
-    program apibuild.py, developed for libxml, together with the xsl script
-    'newapi.xsl' and the libxslt xsltproc program).</li>
-  <li>Look at the <a href="http://mail.gnome.org/archives/xslt/">mailing-list
-    archive</a>.</li>
-  <li>Of course since libxslt is based on libxml, it's a good idea to at
-    least read <a href="http://xmlsoft.org/">libxml description</a></li>
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>There are some on-line resources about using libxslt:</p><ol><li>Check the <a href="html/libxslt-lib.html#LIBXSLT-LIB">APIdocumentation</a>automatically
+    extracted from code comments (using theprogram apibuild.py, developed for
+    libxml, together with the xsl script'newapi.xsl' and the libxslt xsltproc
+    program).</li>
+  <li>Look at the <a href="http://mail.gnome.org/archives/xslt/">mailing-listarchive</a>.</li>
+  <li>Of course since libxslt is based on libxml, it's a good idea to atleast
+    read <a href="http://xmlsoft.org/">libxml description</a></li>
 </ol><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/downloads.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/downloads.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/downloads.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,23 +8,21 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>Downloads</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>Downloads</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>The latest versions of libxslt can be found on the <a href="ftp://xmlsoft.org/libxslt/">xmlsoft.org</a> server and on mirrors (<a href="ftp://fr.rpmfind.net/pub/libxml/">France</a>) or on the <a href="ftp://ftp.gnome.org/pub/GNOME/MIRRORS.html">Gnome FTP server</a> as a
-<a href="ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/">source
-archive</a>, Antonin Sprinzl also provides <a href="ftp://gd.tuwien.ac.at/pub/libxml/">a mirror in Austria</a>. (NOTE that
-you need the <a href="http://rpmfind.net/linux/RPM/libxml2.html">libxml2</a>,
-<a href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml2-devel</a>,
-<a href="http://rpmfind.net/linux/RPM/libxslt.html">libxslt</a> and <a href="http://rpmfind.net/linux/RPM/libxslt-devel.html">libxslt-devel</a>
-packages installed to compile applications using libxslt.) <a href="mailto:igor at zlatkovic.com">Igor Zlatkovic</a> is now the maintainer of
-the Windows port, <a href="http://www.zlatkovic.com/projects/libxml/index.html">he provides
-binaries</a>. <a href="mailto:Gary.Pennington at sun.com">Gary Pennington</a>
-provides <a href="http://garypennington.net/libxml2/">Solaris binaries</a>.
-<a href="mailto:Steve.Ball at explain.com.au">Steve Ball</a> provides <a href="http://www.explain.com.au/oss/libxml2xslt.html">Mac Os X
-binaries</a>.</p><p><a name="Contribs" id="Contribs">Contribs:</a></p><p>I do accept external contributions, especially if compiling on another
-platform, get in touch with me to upload the package. I will keep them in the
-<a href="ftp://xmlsoft.org/libxml2/contribs/">contrib directory</a></p><p>Libxslt is also available from CVS:</p><ul><li><p>The <a href="http://cvs.gnome.org/viewcvs/libxslt/">Gnome CVS
-    base</a>. Check the <a href="http://developer.gnome.org/tools/cvs.html">Gnome CVS Tools</a>
-    page; the CVS module is <b>libxslt</b>.</p>
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>The latest versions of libxslt can be found on the <a href="ftp://xmlsoft.org/libxslt/">xmlsoft.org</a>server and on mirrors (<a href="ftp://fr.rpmfind.net/pub/libxml/">France</a>) or on the <a href="ftp://ftp.gnome.org/pub/GNOME/MIRRORS.html">Gnome FTP server</a>as a<a href="ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/">sourcearchive</a>,
+Antonin Sprinzl also provides <a href="ftp://gd.tuwien.ac.at/pub/libxml/">a
+mirror in Austria</a>. (NOTE thatyou need the <a href="http://rpmfind.net/linux/RPM/libxml2.html">libxml2</a>,<a href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml2-devel</a>,<a href="http://rpmfind.net/linux/RPM/libxslt.html">libxslt</a>and <a href="http://rpmfind.net/linux/RPM/libxslt-devel.html">libxslt-devel</a>packages
+installed to compile applications using libxslt.) <a href="mailto:igor at zlatkovic.com">Igor Zlatkovic</a>is now the maintainer
+ofthe Windows port, <a href="http://www.zlatkovic.com/projects/libxml/index.html">he
+providesbinaries</a>. <a href="mailto:Gary.Pennington at sun.com">Gary
+Pennington</a>provides <a href="http://garypennington.net/libxml2/">Solaris
+binaries</a>.<a href="mailto:Steve.Ball at explain.com.au">Steve
+Ball</a>provides <a href="http://www.explain.com.au/oss/libxml2xslt.html">Mac
+Os Xbinaries</a>.</p><p><a name="Contribs" id="Contribs">Contribs:</a></p><p>I do accept external contributions, especially if compiling on
+anotherplatform, get in touch with me to upload the package. I will keep them
+in the<a href="ftp://xmlsoft.org/libxml2/contribs/">contrib directory</a></p><p>Libxslt is also available from CVS:</p><ul><li><p>The <a href="http://cvs.gnome.org/viewcvs/libxslt/">Gnome
+    CVSbase</a>. Check the <a href="http://developer.gnome.org/tools/cvs.html">Gnome CVS Tools</a>page;
+    the CVS module is <b>libxslt</b>.</p>
   </li>
-  <li><a href="ftp://xmlsoft.org/libxml2/libxslt-cvs-snapshot.tar.gz">snapshots from
-    CVS</a> updated every hour are also provided</li>
+  <li><a href="ftp://xmlsoft.org/libxml2/libxslt-cvs-snapshot.tar.gz">snapshots
+    fromCVS</a>updated every hour are also provided</li>
 </ul><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/extensions.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/extensions.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/extensions.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -13,54 +13,53 @@
   <li><a href="extensions.html#Keep">Extension modules</a></li>
   <li><a href="extensions.html#Registerin">Registering a module</a></li>
   <li><a href="extensions.html#module">Loading a module</a></li>
-  <li><a href="extensions.html#Registerin1">Registering an extension
-    function</a></li>
-  <li><a href="extensions.html#Implementi">Implementing an extension
-    function</a></li>
-  <li><a href="extensions.html#Examples">Examples for extension
-  functions</a></li>
-  <li><a href="extensions.html#Registerin2">Registering an extension
-    element</a></li>
-  <li><a href="extensions.html#Implementi1">Implementing an extension
-    element</a></li>
-  <li><a href="extensions.html#Example">Example for extension
-  elements</a></li>
+  <li><a href="extensions.html#Registerin1">Registering an
+    extensionfunction</a></li>
+  <li><a href="extensions.html#Implementi">Implementing an
+    extensionfunction</a></li>
+  <li><a href="extensions.html#Examples">Examples for
+  extensionfunctions</a></li>
+  <li><a href="extensions.html#Registerin2">Registering an
+    extensionelement</a></li>
+  <li><a href="extensions.html#Implementi1">Implementing an
+    extensionelement</a></li>
+  <li><a href="extensions.html#Example">Example for extensionelements</a></li>
   <li><a href="extensions.html#shutdown">The shutdown of a module</a></li>
   <li><a href="extensions.html#Future">Future work</a></li>
-</ul><h3><a name="Introducti1" id="Introducti1">Introduction</a></h3><p>This document describes the work needed to write extensions to the
-standard XSLT library for use with <a href="http://xmlsoft.org/XSLT/">libxslt</a>, the <a href="http://www.w3.org/TR/xslt">XSLT</a> C library developed for the <a href="http://www.gnome.org/">Gnome</a> project.</p><p>Before starting reading this document it is highly recommended to get
-familiar with <a href="internals.html">the libxslt internals</a>.</p><p>Note: this documentation is by definition incomplete and I am not good at
-spelling, grammar, so patches and suggestions are <a href="mailto:veillard at redhat.com">really welcome</a>.</p><h3><a name="Basics" id="Basics">Basics</a></h3><p>The <a href="http://www.w3.org/TR/xslt">XSLT specification</a> provides
-two <a href="http://www.w3.org/TR/xslt">ways to extend an XSLT engine</a>:</p><ul><li>providing <a href="http://www.w3.org/TR/xslt">new extension
-    functions</a> which can be called from XPath expressions</li>
-  <li>providing <a href="http://www.w3.org/TR/xslt">new extension
-    elements</a> which can be inserted in stylesheets</li>
-</ul><p>In both cases the extensions need to be associated to a new namespace,
-i.e. an URI used as the name for the extension's namespace (there is no need
-to have a resource there for this to work).</p><p>libxslt provides a few extensions itself, either in the libxslt namespace
-"http://xmlsoft.org/XSLT/namespace" or in namespaces for other well known
-extensions provided by other XSLT processors like Saxon, Xalan or XT.</p><h3><a name="Keep" id="Keep">Extension modules</a></h3><p>Since extensions are bound to a namespace name, usually sets of extensions
-coming from a given source are using the same namespace name defining in
-practice a group of extensions providing elements, functions or both. From
-the libxslt point of view those are considered as an "extension module", and
-most of the APIs work at a module point of view.</p><p>Registration of new functions or elements are bound to the activation of
-the module. This is currently done by declaring the namespace as an extension
-by using the attribute  <code>extension-element-prefixes</code> on the
-<code><a href="http://www.w3.org/TR/xslt">xsl:stylesheet</a></code>
-element.</p><p>An extension module is defined by 3 objects:</p><ul><li>the namespace name associated</li>
+</ul><h3><a name="Introducti1" id="Introducti1">Introduction</a></h3><p>This document describes the work needed to write extensions to thestandard
+XSLT library for use with <a href="http://xmlsoft.org/XSLT/">libxslt</a>, the
+<a href="http://www.w3.org/TR/xslt">XSLT</a>C library developed for the <a href="http://www.gnome.org/">Gnome</a>project.</p><p>Before starting reading this document it is highly recommended to
+getfamiliar with <a href="internals.html">the libxslt internals</a>.</p><p>Note: this documentation is by definition incomplete and I am not good
+atspelling, grammar, so patches and suggestions are <a href="mailto:veillard at redhat.com">really welcome</a>.</p><h3><a name="Basics" id="Basics">Basics</a></h3><p>The <a href="http://www.w3.org/TR/xslt">XSLT specification</a>providestwo
+<a href="http://www.w3.org/TR/xslt">ways to extend an XSLT engine</a>:</p><ul><li>providing <a href="http://www.w3.org/TR/xslt">new
+    extensionfunctions</a>which can be called from XPath expressions</li>
+  <li>providing <a href="http://www.w3.org/TR/xslt">new
+    extensionelements</a>which can be inserted in stylesheets</li>
+</ul><p>In both cases the extensions need to be associated to a new namespace,i.e.
+an URI used as the name for the extension's namespace (there is no needto
+have a resource there for this to work).</p><p>libxslt provides a few extensions itself, either in the libxslt
+namespace"http://xmlsoft.org/XSLT/namespace" or in namespaces for other well
+knownextensions provided by other XSLT processors like Saxon, Xalan or XT.</p><h3><a name="Keep" id="Keep">Extension modules</a></h3><p>Since extensions are bound to a namespace name, usually sets of
+extensionscoming from a given source are using the same namespace name
+defining inpractice a group of extensions providing elements, functions or
+both. Fromthe libxslt point of view those are considered as an "extension
+module", andmost of the APIs work at a module point of view.</p><p>Registration of new functions or elements are bound to the activation
+ofthe module. This is currently done by declaring the namespace as an
+extensionby using the attribute  <code>extension-element-prefixes</code>on
+the<code><a href="http://www.w3.org/TR/xslt">xsl:stylesheet</a></code>element.</p><p>An extension module is defined by 3 objects:</p><ul><li>the namespace name associated</li>
   <li>an initialization function</li>
   <li>a shutdown function</li>
-</ul><h3><a name="Registerin" id="Registerin">Registering a module</a></h3><p>Currently a libxslt module has to be compiled within the application using
-libxslt. There is no code to load dynamically shared libraries associated to
-a namespace (this may be added but is likely to become a portability
-nightmare).</p><p>The current way to register a module is to link the code implementing it
-with the application and to call a registration function:</p><pre>int xsltRegisterExtModule(const xmlChar *URI,
+</ul><h3><a name="Registerin" id="Registerin">Registering a module</a></h3><p>Currently a libxslt module has to be compiled within the application
+usinglibxslt. There is no code to load dynamically shared libraries
+associated toa namespace (this may be added but is likely to become a
+portabilitynightmare).</p><p>The current way to register a module is to link the code implementing
+itwith the application and to call a registration function:</p><pre>int xsltRegisterExtModule(const xmlChar *URI,
                           xsltExtInitFunction initFunc,
-                          xsltExtShutdownFunction shutdownFunc);</pre><p>The associated header is read by:</p><pre>#include&lt;libxslt/extensions.h&gt;</pre><p>which also defines the type for the initialization and shutdown
-functions</p><h3><a name="module" id="module">Loading a module</a></h3><p>Once the module URI has been registered and if the XSLT processor detects
-that a given stylesheet needs the functionalities of an extended module, this
-one is initialized.</p><p>The xsltExtInitFunction type defines the interface for an initialization
-function:</p><pre>/**
+                          xsltExtShutdownFunction shutdownFunc);</pre><p>The associated header is read by:</p><pre>#include&lt;libxslt/extensions.h&gt;</pre><p>which also defines the type for the initialization and
+shutdownfunctions</p><h3><a name="module" id="module">Loading a module</a></h3><p>Once the module URI has been registered and if the XSLT processor
+detectsthat a given stylesheet needs the functionalities of an extended
+module, thisone is initialized.</p><p>The xsltExtInitFunction type defines the interface for an
+initializationfunction:</p><pre>/**
  * xsltExtInitFunction:
  * @ctxt:  an XSLT transformation context
  * @URI:  the namespace URI for the extension
@@ -72,30 +71,30 @@
  * transformation
  */
 typedef void *(*xsltExtInitFunction)(xsltTransformContextPtr ctxt,
-                                     const xmlChar *URI);</pre><p>There are 3 things to notice:</p><ul><li>The function gets passed the namespace name URI as an argument. This
-    allows a single function to provide the initialization for multiple
-    logical modules.</li>
-  <li>It also gets passed a transformation context. The initialization is
-    done at run time before any processing occurs on the stylesheet but it
-    will be invoked separately each time for each transformation.</li>
-  <li>It returns a pointer.  This can be used to store module specific
-    information which can be retrieved later when a function or an element
-    from the extension is used.  An obvious example is a connection to a
-    database which should be kept and reused along with the transformation.
-    NULL is a perfectly valid return; there is no way to indicate a failure
-    at this level</li>
-</ul><p>What this function is expected to do is:</p><ul><li>prepare the context for this module (like opening the database
-    connection)</li>
+                                     const xmlChar *URI);</pre><p>There are 3 things to notice:</p><ul><li>The function gets passed the namespace name URI as an argument.
+    Thisallows a single function to provide the initialization for
+    multiplelogical modules.</li>
+  <li>It also gets passed a transformation context. The initialization isdone
+    at run time before any processing occurs on the stylesheet but itwill be
+    invoked separately each time for each transformation.</li>
+  <li>It returns a pointer.  This can be used to store module
+    specificinformation which can be retrieved later when a function or an
+    elementfrom the extension is used.  An obvious example is a connection to
+    adatabase which should be kept and reused along with the
+    transformation.NULL is a perfectly valid return; there is no way to
+    indicate a failureat this level</li>
+</ul><p>What this function is expected to do is:</p><ul><li>prepare the context for this module (like opening the
+    databaseconnection)</li>
   <li>register the extensions specific to this module</li>
 </ul><h3><a name="Registerin1" id="Registerin1">Registering an extension function</a></h3><p>There is a single call to do this registration:</p><pre>int xsltRegisterExtFunction(xsltTransformContextPtr ctxt,
                             const xmlChar *name,
                             const xmlChar *URI,
-                            xmlXPathEvalFunc function);</pre><p>The registration is bound to a single transformation instance referred by
-ctxt, name is the UTF8 encoded name for the NCName of the function, and URI
-is the namespace name for the extension (no checking is done, a module could
-register functions or elements from a different namespace, but it is not
-recommended).</p><h3><a name="Implementi" id="Implementi">Implementing an extension function</a></h3><p>The implementation of the function must have the signature of a libxml
-XPath function:</p><pre>/**
+                            xmlXPathEvalFunc function);</pre><p>The registration is bound to a single transformation instance referred
+byctxt, name is the UTF8 encoded name for the NCName of the function, and
+URIis the namespace name for the extension (no checking is done, a module
+couldregister functions or elements from a different namespace, but it is
+notrecommended).</p><h3><a name="Implementi" id="Implementi">Implementing an extension function</a></h3><p>The implementation of the function must have the signature of a
+libxmlXPath function:</p><pre>/**
  * xmlXPathEvalFunc:
  * @ctxt: an XPath parser context
  * @nargs: the number of arguments passed to the function
@@ -105,43 +104,43 @@
  */
 
 typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
-                                 int nargs);</pre><p>The context passed to an XPath function is not an XSLT context but an <a href="internals.html#XPath1">XPath context</a>. However it is possible to
-find one from the other:</p><ul><li>The function xsltXPathGetTransformContext provides this lookup facility:
+                                 int nargs);</pre><p>The context passed to an XPath function is not an XSLT context but an <a href="internals.html#XPath1">XPath context</a>. However it is possible tofind
+one from the other:</p><ul><li>The function xsltXPathGetTransformContext provides this lookup facility:
     <pre>xsltTransformContextPtr
          xsltXPathGetTransformContext
                           (xmlXPathParserContextPtr ctxt);</pre>
   </li>
-  <li>The <code>xmlXPathContextPtr</code> associated to an
-    <code>xsltTransformContext</code> is stored in the <code>xpathCtxt</code>
-    field.</li>
-</ul><p>The first thing an extension function may want to do is to check the
-arguments passed on the stack, the <code>nargs</code> parameter will tell how
-many of them were provided on the XPath expression. The macro valuePop will
-extract them from the XPath stack:</p><pre>#include &lt;libxml/xpath.h&gt;
+  <li>The <code>xmlXPathContextPtr</code>associated to
+    an<code>xsltTransformContext</code>is stored in the
+    <code>xpathCtxt</code>field.</li>
+</ul><p>The first thing an extension function may want to do is to check
+thearguments passed on the stack, the <code>nargs</code>parameter will tell
+howmany of them were provided on the XPath expression. The macro valuePop
+willextract them from the XPath stack:</p><pre>#include &lt;libxml/xpath.h&gt;
 #include &lt;libxml/xpathInternals.h&gt;
 
-xmlXPathObjectPtr obj = valuePop(ctxt); </pre><p>Note that <code>ctxt</code> is the XPath context not the XSLT one. It is
-then possible to examine the content of the value. Check <a href="internals.html#Descriptio">the description of XPath objects</a> if
-necessary. The following is a common sequence checking whether the argument
-passed is a string and converting it using the built-in XPath
-<code>string()</code> function if this is not the case:</p><pre>if (obj-&gt;type != XPATH_STRING) {
+xmlXPathObjectPtr obj = valuePop(ctxt); </pre><p>Note that <code>ctxt</code>is the XPath context not the XSLT one. It
+isthen possible to examine the content of the value. Check <a href="internals.html#Descriptio">the description of XPath
+objects</a>ifnecessary. The following is a common sequence checking whether
+the argumentpassed is a string and converting it using the built-in
+XPath<code>string()</code>function if this is not the case:</p><pre>if (obj-&gt;type != XPATH_STRING) {
     valuePush(ctxt, obj);
     xmlXPathStringFunction(ctxt, 1);
     obj = valuePop(ctxt);
-}</pre><p>Most common XPath functions are available directly at the C level and are
-exported either in <code>&lt;libxml/xpath.h&gt;</code> or in
-<code>&lt;libxml/xpathInternals.h&gt;</code>.</p><p>The extension function may also need to retrieve the data associated to
-this module instance (the database connection in the previous example) this
-can be done using the xsltGetExtData:</p><pre>void * xsltGetExtData(xsltTransformContextPtr ctxt,
-                      const xmlChar *URI);</pre><p>Again the URI to be provided is the one which was used when registering
-the module.</p><p>Once the function finishes, don't forget to:</p><ul><li>push the return value on the stack using <code>valuePush(ctxt,
-    obj)</code></li>
-  <li>deallocate the parameters passed to the function using
-    <code>xmlXPathFreeObject(obj)</code></li>
-</ul><h3><a name="Examples" id="Examples">Examples for extension functions</a></h3><p>The module libxslt/functions.c contains the sources of the XSLT built-in
-functions, including document(), key(), generate-id(), etc. as well as a full
-example module at the end. Here is the test function implementation for the
-libxslt:test function:</p><pre>/**
+}</pre><p>Most common XPath functions are available directly at the C level and
+areexported either in <code>&lt;libxml/xpath.h&gt;</code>or
+in<code>&lt;libxml/xpathInternals.h&gt;</code>.</p><p>The extension function may also need to retrieve the data associated
+tothis module instance (the database connection in the previous example)
+thiscan be done using the xsltGetExtData:</p><pre>void * xsltGetExtData(xsltTransformContextPtr ctxt,
+                      const xmlChar *URI);</pre><p>Again the URI to be provided is the one which was used when registeringthe
+module.</p><p>Once the function finishes, don't forget to:</p><ul><li>push the return value on the stack using
+    <code>valuePush(ctxt,obj)</code></li>
+  <li>deallocate the parameters passed to the function
+    using<code>xmlXPathFreeObject(obj)</code></li>
+</ul><h3><a name="Examples" id="Examples">Examples for extension functions</a></h3><p>The module libxslt/functions.c contains the sources of the XSLT
+built-infunctions, including document(), key(), generate-id(), etc. as well
+as a fullexample module at the end. Here is the test function implementation
+for thelibxslt:test function:</p><pre>/**
  * xsltExtFunctionTest:
  * @ctxt:  the XPath Parser context
  * @nargs:  the number of arguments
@@ -173,13 +172,14 @@
 }</pre><h3><a name="Registerin2" id="Registerin2">Registering an extension element</a></h3><p>There is a single call to do this registration:</p><pre>int xsltRegisterExtElement(xsltTransformContextPtr ctxt,
                            const xmlChar *name,
                            const xmlChar *URI,
-                           xsltTransformFunction function);</pre><p>It is similar to the mechanism used to register an extension function,
-except that the signature of an extension element implementation is
-different.</p><p>The registration is bound to a single transformation instance referred to
-by ctxt, name is the UTF8 encoded name for the NCName of the element, and URI
-is the namespace name for the extension (no checking is done, a module could
-register elements for a different namespace, but it is not recommended).</p><h3><a name="Implementi1" id="Implementi1">Implementing an extension element</a></h3><p>The implementation of the element must have the signature of an XSLT
-transformation function:</p><pre>/** 
+                           xsltTransformFunction function);</pre><p>It is similar to the mechanism used to register an extension
+function,except that the signature of an extension element implementation
+isdifferent.</p><p>The registration is bound to a single transformation instance referred
+toby ctxt, name is the UTF8 encoded name for the NCName of the element, and
+URIis the namespace name for the extension (no checking is done, a module
+couldregister elements for a different namespace, but it is not
+recommended).</p><h3><a name="Implementi1" id="Implementi1">Implementing an extension element</a></h3><p>The implementation of the element must have the signature of an
+XSLTtransformation function:</p><pre>/** 
  * xsltTransformFunction: 
  * @ctxt: the XSLT transformation context
  * @node: the input node
@@ -193,27 +193,27 @@
                           (xsltTransformContextPtr ctxt,
                            xmlNodePtr node,
                            xmlNodePtr inst,
-                           xsltStylePreCompPtr comp);</pre><p>The first argument is the XSLT transformation context. The second and
-third arguments are xmlNodePtr i.e. internal memory <a href="internals.html#libxml">representation of  XML nodes</a>. They are
-respectively <code>node</code> from the the input document being transformed
-by the stylesheet and <code>inst</code> the extension element in the
-stylesheet. The last argument is <code>comp</code> a pointer to a precompiled
-representation of <code>inst</code> but usually for an extension function
-this value is <code>NULL</code> by default (it could be added and associated
-to the instruction in <code>inst-&gt;_private</code>).</p><p>The same functions are available from a function implementing an extension
-element as in an extension function, including
-<code>xsltGetExtData()</code>.</p><p>The goal of an extension element being usually to enrich the generated
-output, it is expected that they will grow the currently generated output
-tree. This can be done by grabbing ctxt-&gt;insert which is the current
-libxml node being generated (Note this can also be the intermediate value
-tree being built for example to initialize a variable, the processing should
-be similar). The functions for libxml tree manipulation from <a href="http://xmlsoft.org/html/libxml-tree.html">&lt;libxml/tree.h&gt;</a> can
-be employed to extend or modify the tree, but it is required to preserve the
-insertion node and its ancestors since there are existing pointers to those
-elements still in use in the XSLT template execution stack.</p><h3><a name="Example" id="Example">Example for extension elements</a></h3><p>The module libxslt/transform.c contains the sources of the XSLT built-in
-elements, including xsl:element, xsl:attribute, xsl:if, etc. There is a small
-but full example in functions.c providing the implementation for the
-libxslt:test element, it will output a comment in the result tree:</p><pre>/**
+                           xsltStylePreCompPtr comp);</pre><p>The first argument is the XSLT transformation context. The second andthird
+arguments are xmlNodePtr i.e. internal memory <a href="internals.html#libxml">representation of  XML nodes</a>. They
+arerespectively <code>node</code>from the the input document being
+transformedby the stylesheet and <code>inst</code>the extension element in
+thestylesheet. The last argument is <code>comp</code>a pointer to a
+precompiledrepresentation of <code>inst</code>but usually for an extension
+functionthis value is <code>NULL</code>by default (it could be added and
+associatedto the instruction in <code>inst-&gt;_private</code>).</p><p>The same functions are available from a function implementing an
+extensionelement as in an extension function,
+including<code>xsltGetExtData()</code>.</p><p>The goal of an extension element being usually to enrich the
+generatedoutput, it is expected that they will grow the currently generated
+outputtree. This can be done by grabbing ctxt-&gt;insert which is the
+currentlibxml node being generated (Note this can also be the intermediate
+valuetree being built for example to initialize a variable, the processing
+shouldbe similar). The functions for libxml tree manipulation from <a href="http://xmlsoft.org/html/libxml-tree.html">&lt;libxml/tree.h&gt;</a>canbe
+employed to extend or modify the tree, but it is required to preserve
+theinsertion node and its ancestors since there are existing pointers to
+thoseelements still in use in the XSLT template execution stack.</p><h3><a name="Example" id="Example">Example for extension elements</a></h3><p>The module libxslt/transform.c contains the sources of the XSLT
+built-inelements, including xsl:element, xsl:attribute, xsl:if, etc. There is
+a smallbut full example in functions.c providing the implementation for
+thelibxslt:test element, it will output a comment in the result tree:</p><pre>/**
  * xsltExtElementTest:
  * @ctxt:  an XSLT processing context
  * @node:  The current node
@@ -253,10 +253,10 @@
         xmlNewComment((const xmlChar *)
                       "libxslt:test element test worked");
     xmlAddChild(ctxt-&gt;insert, comment);
-}</pre><h3><a name="shutdown" id="shutdown">The shutdown of a module</a></h3><p>When the XSLT processor ends a transformation, the shutdown function (if
-it exists) for each of the modules initialized is called.  The
-xsltExtShutdownFunction type defines the interface for a shutdown
-function:</p><pre>/**
+}</pre><h3><a name="shutdown" id="shutdown">The shutdown of a module</a></h3><p>When the XSLT processor ends a transformation, the shutdown function (ifit
+exists) for each of the modules initialized is called. 
+ThexsltExtShutdownFunction type defines the interface for a
+shutdownfunction:</p><pre>/**
  * xsltExtShutdownFunction:
  * @ctxt:  an XSLT transformation context
  * @URI:  the namespace URI for the extension
@@ -266,14 +266,15 @@
  */
 typedef void (*xsltExtShutdownFunction) (xsltTransformContextPtr ctxt,
                                          const xmlChar *URI,
-                                         void *data);</pre><p>This is really similar to a module initialization function except a third
-argument is passed, it's the value that was returned by the initialization
-function. This allows the routine to deallocate resources from the module for
-example close the connection to the database to keep the same example.</p><h3><a name="Future" id="Future">Future work</a></h3><p>Well, some of the pieces missing:</p><ul><li>a way to load shared libraries to instantiate new modules</li>
-  <li>a better detection of extension functions usage and their registration
-    without having to use the extension prefix which ought to be reserved to
-    element extensions.</li>
+                                         void *data);</pre><p>This is really similar to a module initialization function except a
+thirdargument is passed, it's the value that was returned by the
+initializationfunction. This allows the routine to deallocate resources from
+the module forexample close the connection to the database to keep the same
+example.</p><h3><a name="Future" id="Future">Future work</a></h3><p>Well, some of the pieces missing:</p><ul><li>a way to load shared libraries to instantiate new modules</li>
+  <li>a better detection of extension functions usage and their
+    registrationwithout having to use the extension prefix which ought to be
+    reserved toelement extensions.</li>
   <li>more examples</li>
-  <li>implementations of the <a href="http://www.exslt.org/">EXSLT</a> common
-    extension libraries, Thomas Broyer nearly finished implementing them.</li>
+  <li>implementations of the <a href="http://www.exslt.org/">EXSLT</a>commonextension libraries, Thomas
+    Broyer nearly finished implementing them.</li>
 </ul><p></p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/help.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/help.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/help.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,18 +8,18 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>How to help</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>How to help</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>You can help the project in various ways, the best thing to do first is to
-subscribe to the mailing-list as explained before, check the <a href="http://mail.gnome.org/archives/xslt/">archives </a>and the <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Gnome bug
-database:</a>:</p><ol><li>provide patches when you find problems</li>
-  <li>provide the diffs when you port libxslt to a new platform. They may not
-    be integrated in all cases but help pinpointing portability problems
-  and</li>
-  <li>provide documentation fixes (either as patches to the code comments or
-    as HTML diffs).</li>
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>You can help the project in various ways, the best thing to do first is
+tosubscribe to the mailing-list as explained before, check the <a href="http://mail.gnome.org/archives/xslt/">archives </a>and the <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Gnome
+bugdatabase:</a>:</p><ol><li>provide patches when you find problems</li>
+  <li>provide the diffs when you port libxslt to a new platform. They may
+    notbe integrated in all cases but help pinpointing portability
+  problemsand</li>
+  <li>provide documentation fixes (either as patches to the code comments
+    oras HTML diffs).</li>
   <li>provide new documentations pieces (translations, examples, etc ...)</li>
   <li>Check the TODO file and try to close one of the items</li>
-  <li>take one of the points raised in the archive or the bug database and
-    provide a fix. <a href="mailto:daniel at veillard.com">Get in touch with me
-    </a>before to avoid synchronization problems and check that the suggested
-    fix will fit in nicely :-)</li>
+  <li>take one of the points raised in the archive or the bug database
+    andprovide a fix. <a href="mailto:daniel at veillard.com">Get in touch with
+    me</a>before to avoid synchronization problems and check that the
+    suggestedfix will fit in nicely :-)</li>
 </ol><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/index.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/index.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/index.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,14 +8,15 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>libxslt</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>libxslt</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>Libxslt is the <a href="http://www.w3.org/TR/xslt">XSLT</a> C library
-developed for the Gnome project. XSLT itself is a an XML language to define
-transformation for XML. Libxslt is based on <a href="http://xmlsoft.org/">libxml2</a> the XML C library developed for the
-Gnome project. It also implements most of the <a href="http://www.exslt.org/">EXSLT</a> set of processor-portable extensions
-functions and some of Saxon's evaluate and expressions extensions.</p><p>People can either embed the library in their application or use xsltproc
-the command line processing tool. This library is free software and can be
-reused in commercial applications (see the <a href="intro.html">intro</a>)</p><p>External documents:</p><ul><li>John Fleck wrote <a href="tutorial/libxslttutorial.html">a tutorial for
-    libxslt</a></li>
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>Libxslt is the <a href="http://www.w3.org/TR/xslt">XSLT</a>C
+librarydeveloped for the Gnome project. XSLT itself is a an XML language to
+definetransformation for XML. Libxslt is based on <a href="http://xmlsoft.org/">libxml2</a>the XML C library developed for
+theGnome project. It also implements most of the <a href="http://www.exslt.org/">EXSLT</a>set of processor-portable
+extensionsfunctions and some of Saxon's evaluate and expressions
+extensions.</p><p>People can either embed the library in their application or use
+xsltprocthe command line processing tool. This library is free software and
+can bereused in commercial applications (see the <a href="intro.html">intro</a>)</p><p>External documents:</p><ul><li>John Fleck wrote <a href="tutorial/libxslttutorial.html">a tutorial
+    forlibxslt</a></li>
   <li><a href="xsltproc.html">xsltproc user manual</a></li>
   <li><a href="http://xmlsoft.org/">the libxml documentation</a></li>
 </ul><p></p><p>Logo designed by <a href="mailto:liyanage at access.ch">Marc Liyanage</a>.</p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/internals.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/internals.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/internals.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -18,152 +18,152 @@
   <li><a href="internals.html#processing">The processing itself</a></li>
   <li><a href="internals.html#XPath">XPath expressions compilation</a></li>
   <li><a href="internals.html#XPath1">XPath interpretation</a></li>
-  <li><a href="internals.html#Descriptio">Description of XPath
-  Objects</a></li>
+  <li><a href="internals.html#Descriptio">Description of XPathObjects</a></li>
   <li><a href="internals.html#XPath3">XPath functions</a></li>
   <li><a href="internals.html#stack">The variables stack frame</a></li>
   <li><a href="internals.html#Extension">Extension support</a></li>
   <li><a href="internals.html#Futher">Further reading</a></li>
   <li><a href="internals.html#TODOs">TODOs</a></li>
-</ul><h3><a name="Introducti2" id="Introducti2">Introduction</a></h3><p>This document describes the processing of <a href="http://xmlsoft.org/XSLT/">libxslt</a>, the <a href="http://www.w3.org/TR/xslt">XSLT</a> C library developed for the <a href="http://www.gnome.org/">Gnome</a> project.</p><p>Note: this documentation is by definition incomplete and I am not good at
-spelling, grammar, so patches and suggestions are <a href="mailto:veillard at redhat.com">really welcome</a>.</p><h3><a name="Basics1" id="Basics1">Basics</a></h3><p>XSLT is a transformation language. It takes an input document and a
-stylesheet document and generates an output document:</p><p align="center"><img src="processing.gif" alt="the XSLT processing model" /></p><p>Libxslt is written in C. It relies on <a href="http://www.xmlsoft.org/">libxml</a>, the XML C library for Gnome, for
-the following operations:</p><ul><li>parsing files</li>
-  <li>building the in-memory DOM structure associated with the documents
-    handled</li>
+</ul><h3><a name="Introducti2" id="Introducti2">Introduction</a></h3><p>This document describes the processing of <a href="http://xmlsoft.org/XSLT/">libxslt</a>, the <a href="http://www.w3.org/TR/xslt">XSLT</a>C library developed for the <a href="http://www.gnome.org/">Gnome</a>project.</p><p>Note: this documentation is by definition incomplete and I am not good
+atspelling, grammar, so patches and suggestions are <a href="mailto:veillard at redhat.com">really welcome</a>.</p><h3><a name="Basics1" id="Basics1">Basics</a></h3><p>XSLT is a transformation language. It takes an input document and
+astylesheet document and generates an output document:</p><p align="center"><img src="processing.gif" alt="the XSLT processing model" /></p><p>Libxslt is written in C. It relies on <a href="http://www.xmlsoft.org/">libxml</a>, the XML C library for Gnome,
+forthe following operations:</p><ul><li>parsing files</li>
+  <li>building the in-memory DOM structure associated with the
+    documentshandled</li>
   <li>the XPath implementation</li>
-  <li>serializing back the result document to XML and HTML. (Text is handled
-    directly.)</li>
-</ul><h3><a name="Keep1" id="Keep1">Keep it simple stupid</a></h3><p>Libxslt is not very specialized. It is built under the assumption that all
-nodes from the source and output document can fit in the virtual memory of
-the system. There is a big trade-off there. It is fine for reasonably sized
-documents but may not be suitable for large sets of data. The gain is that it
-can be used in a relatively versatile way. The input or output may never be
-serialized, but the size of documents it can handle are limited by the size
-of the memory available.</p><p>More specialized memory handling approaches are possible, like building
-the input tree from a serialization progressively as it is consumed,
-factoring repetitive patterns, or even on-the-fly generation of the output as
-the input is parsed but it is possible only for a limited subset of the
-stylesheets. In general the implementation of libxslt follows the following
-pattern:</p><ul><li>KISS (keep it simple stupid)</li>
-  <li>when there is a clear bottleneck optimize on top of this simple
-    framework and refine only as much as is needed to reach the expected
-    result</li>
-</ul><p>The result is not that bad, clearly one can do a better job but more
-specialized too. Most optimization like building the tree on-demand would
-need serious changes to the libxml XPath framework. An easy step would be to
-serialize the output directly (or call a set of SAX-like output handler to
-keep this a flexible interface) and hence avoid the memory consumption of the
-result.</p><h3><a name="libxml" id="libxml">The libxml nodes</a></h3><p>DOM-like trees, as used and generated by libxml and libxslt, are
-relatively complex. Most node types follow the given structure except a few
-variations depending on the node type:</p><p align="center"><img src="node.gif" alt="description of a libxml node" /></p><p>Nodes carry a <strong>name</strong> and the node <strong>type</strong>
-indicates the kind of node it represents, the most common ones are:</p><ul><li>document nodes</li>
+  <li>serializing back the result document to XML and HTML. (Text is
+    handleddirectly.)</li>
+</ul><h3><a name="Keep1" id="Keep1">Keep it simple stupid</a></h3><p>Libxslt is not very specialized. It is built under the assumption that
+allnodes from the source and output document can fit in the virtual memory
+ofthe system. There is a big trade-off there. It is fine for reasonably
+sizeddocuments but may not be suitable for large sets of data. The gain is
+that itcan be used in a relatively versatile way. The input or output may
+never beserialized, but the size of documents it can handle are limited by
+the sizeof the memory available.</p><p>More specialized memory handling approaches are possible, like buildingthe
+input tree from a serialization progressively as it is consumed,factoring
+repetitive patterns, or even on-the-fly generation of the output asthe input
+is parsed but it is possible only for a limited subset of thestylesheets. In
+general the implementation of libxslt follows the followingpattern:</p><ul><li>KISS (keep it simple stupid)</li>
+  <li>when there is a clear bottleneck optimize on top of this
+    simpleframework and refine only as much as is needed to reach the
+    expectedresult</li>
+</ul><p>The result is not that bad, clearly one can do a better job but
+morespecialized too. Most optimization like building the tree on-demand
+wouldneed serious changes to the libxml XPath framework. An easy step would
+be toserialize the output directly (or call a set of SAX-like output handler
+tokeep this a flexible interface) and hence avoid the memory consumption of
+theresult.</p><h3><a name="libxml" id="libxml">The libxml nodes</a></h3><p>DOM-like trees, as used and generated by libxml and libxslt, arerelatively
+complex. Most node types follow the given structure except a fewvariations
+depending on the node type:</p><p align="center"><img src="node.gif" alt="description of a libxml node" /></p><p>Nodes carry a <strong>name</strong>and the node
+<strong>type</strong>indicates the kind of node it represents, the most
+common ones are:</p><ul><li>document nodes</li>
   <li>element nodes</li>
   <li>text nodes</li>
-</ul><p>For the XSLT processing, entity nodes should not be generated (i.e. they
-should be replaced by their content). Most nodes also contains the following
-"navigation" informations:</p><ul><li>the containing <strong>doc</strong>ument</li>
-  <li>the <strong>parent</strong> node</li>
-  <li>the first <strong>children</strong> node</li>
-  <li>the <strong>last</strong> children node</li>
+</ul><p>For the XSLT processing, entity nodes should not be generated (i.e.
+theyshould be replaced by their content). Most nodes also contains the
+following"navigation" informations:</p><ul><li>the containing <strong>doc</strong>ument</li>
+  <li>the <strong>parent</strong>node</li>
+  <li>the first <strong>children</strong>node</li>
+  <li>the <strong>last</strong>children node</li>
   <li>the <strong>prev</strong>ious sibling</li>
   <li>the following sibling (<strong>next</strong>)</li>
-</ul><p>Elements nodes carries the list of attributes in the properties, an
-attribute itself holds the navigation pointers and the children list (the
-attribute value is not represented as a simple string to allow usage of
-entities references).</p><p>The <strong>ns</strong> points to the namespace declaration for the
-namespace associated to the node, <strong>nsDef</strong> is the linked list
-of namespace declaration present on element nodes.</p><p>Most nodes also carry an <strong>_private</strong> pointer which can be
-used by the application to hold specific data on this node.</p><h3><a name="XSLT" id="XSLT">The XSLT processing steps</a></h3><p>There are a few steps which are clearly decoupled at the interface
-level:</p><ol><li>parse the stylesheet and generate a DOM tree</li>
-  <li>take the stylesheet tree and build a compiled version of it (the
-    compilation phase)</li>
+</ul><p>Elements nodes carries the list of attributes in the properties,
+anattribute itself holds the navigation pointers and the children list
+(theattribute value is not represented as a simple string to allow usage
+ofentities references).</p><p>The <strong>ns</strong>points to the namespace declaration for
+thenamespace associated to the node, <strong>nsDef</strong>is the linked
+listof namespace declaration present on element nodes.</p><p>Most nodes also carry an <strong>_private</strong>pointer which can beused
+by the application to hold specific data on this node.</p><h3><a name="XSLT" id="XSLT">The XSLT processing steps</a></h3><p>There are a few steps which are clearly decoupled at the
+interfacelevel:</p><ol><li>parse the stylesheet and generate a DOM tree</li>
+  <li>take the stylesheet tree and build a compiled version of it
+    (thecompilation phase)</li>
   <li>take the input and generate a DOM tree</li>
-  <li>process the stylesheet against the input tree and generate an output
-    tree</li>
+  <li>process the stylesheet against the input tree and generate an
+  outputtree</li>
   <li>serialize the output tree</li>
 </ol><p>A few things should be noted here:</p><ul><li>the steps 1/ 3/ and 5/ are optional</li>
-  <li>the stylesheet obtained at 2/ can be reused by multiple processing 4/
-    (and this should also work in threaded programs)</li>
-  <li>the tree provided in 2/ should never be freed using xmlFreeDoc, but by
-    freeing the stylesheet.</li>
-  <li>the input tree 4/ is not modified except the _private field which may
-    be used for labelling keys if used by the stylesheet</li>
-</ul><h3><a name="XSLT1" id="XSLT1">The XSLT stylesheet compilation</a></h3><p>This is the second step described. It takes a stylesheet tree, and
-"compiles" it. This associates to each node a structure stored in the
-_private field and containing information computed in the stylesheet:</p><p align="center"><img src="stylesheet.gif" alt="a compiled XSLT stylesheet" /></p><p>One xsltStylesheet structure is generated per document parsed for the
-stylesheet. XSLT documents allow includes and imports of other documents,
-imports are stored in the <strong>imports</strong> list (hence keeping the
-tree hierarchy of includes which is very important for a proper XSLT
-processing model) and includes are stored in the <strong>doclist</strong>
-list. An imported stylesheet has a parent link to allow browsing of the
-tree.</p><p>The DOM tree associated to the document is stored in <strong>doc</strong>.
-It is preprocessed to remove ignorable empty nodes and all the nodes in the
-XSLT namespace are subject to precomputing. This usually consist of
-extracting all the context information from the context tree (attributes,
-namespaces, XPath expressions), and storing them in an xsltStylePreComp
-structure associated to the <strong>_private</strong> field of the node.</p><p>A couple of notable exceptions to this are XSLT template nodes (more on
-this later) and attribute value templates. If they are actually templates,
-the value cannot be computed at compilation time. (Some preprocessing could
-be done like isolation and preparsing of the XPath subexpressions but it's
-not done, yet.)</p><p>The xsltStylePreComp structure also allows storing of the precompiled form
-of an XPath expression that can be associated to an XSLT element (more on
-this later).</p><h3><a name="XSLT2" id="XSLT2">The XSLT template compilation</a></h3><p>A proper handling of templates lookup is one of the keys of fast XSLT
-processing. (Given a node in the source document this is the process of
-finding which templates should be applied to this node.) Libxslt follows the
-hint suggested in the <a href="http://www.w3.org/TR/xslt#patterns">5.2
-Patterns</a> section of the XSLT Recommendation, i.e. it doesn't evaluate it
-as an XPath expression but tokenizes it and compiles it as a set of rules to
-be evaluated on a candidate node. There usually is an indication of the node
-name in the last step of this evaluation and this is used as a key check for
-the match. As a result libxslt builds a relatively more complex set of
-structures for the templates:</p><p align="center"><img src="templates.gif" alt="The templates related structure" /></p><p>Let's describe a bit more closely what is built. First the xsltStylesheet
-structure holds a pointer to the template hash table. All the XSLT patterns
-compiled in this stylesheet are indexed by the value of the the target
-element (or attribute, pi ...) name, so when a element or an attribute "foo"
-needs to be processed the lookup is done using the name as a key.</p><p>Each of the patterns is compiled into an xsltCompMatch structure. It holds
-the set of rules based on the tokenization of the pattern stored in reverse
-order (matching is easier this way). It also holds some information about the
-previous matches used to speed up the process when one iterates over a set of
-siblings. (This optimization may be defeated by trashing when running
-threaded computation, it's unclear that this is a big deal in practice.)
-Predicate expressions are not compiled at this stage, they may be at run-time
-if needed, but in this case they are compiled as full XPath expressions (the
-use of some fixed predicate can probably be optimized, they are not yet).</p><p>The xsltCompMatch are then stored in the hash table, the clash list is
-itself sorted by priority of the template to implement "naturally" the XSLT
-priority rules.</p><p>Associated to the compiled pattern is the xsltTemplate itself containing
-the information required for the processing of the pattern including, of
-course, a pointer to the list of elements used for building the pattern
-result.</p><p>Last but not least a number of patterns do not fit in the hash table
-because they are not associated to a name, this is the case for patterns
-applying to the root, any element, any attributes, text nodes, pi nodes, keys
-etc. Those are stored independently in the stylesheet structure as separate
-linked lists of xsltCompMatch.</p><h3><a name="processing" id="processing">The processing itself</a></h3><p>The processing is defined by the XSLT specification (the basis of the
-algorithm is explained in <a href="http://www.w3.org/TR/xslt#section-Introduction">the Introduction</a>
-section). Basically it works by taking the root of the input document and
-applying the following algorithm:</p><ol><li>Finding the template applying to it. This is a lookup in the template
-    hash table, walking the hash list until the node satisfies all the steps
-    of the pattern, then checking the appropriate(s) global templates to see
-    if there isn't a higher priority rule to apply</li>
-  <li>If there is no template, apply the default rule (recurse on the
-    children)</li>
+  <li>the stylesheet obtained at 2/ can be reused by multiple processing
+    4/(and this should also work in threaded programs)</li>
+  <li>the tree provided in 2/ should never be freed using xmlFreeDoc, but
+    byfreeing the stylesheet.</li>
+  <li>the input tree 4/ is not modified except the _private field which maybe
+    used for labelling keys if used by the stylesheet</li>
+</ul><h3><a name="XSLT1" id="XSLT1">The XSLT stylesheet compilation</a></h3><p>This is the second step described. It takes a stylesheet tree,
+and"compiles" it. This associates to each node a structure stored in
+the_private field and containing information computed in the stylesheet:</p><p align="center"><img src="stylesheet.gif" alt="a compiled XSLT stylesheet" /></p><p>One xsltStylesheet structure is generated per document parsed for
+thestylesheet. XSLT documents allow includes and imports of other
+documents,imports are stored in the <strong>imports</strong>list (hence
+keeping thetree hierarchy of includes which is very important for a proper
+XSLTprocessing model) and includes are stored in the
+<strong>doclist</strong>list. An imported stylesheet has a parent link to
+allow browsing of thetree.</p><p>The DOM tree associated to the document is stored in
+<strong>doc</strong>.It is preprocessed to remove ignorable empty nodes and
+all the nodes in theXSLT namespace are subject to precomputing. This usually
+consist ofextracting all the context information from the context tree
+(attributes,namespaces, XPath expressions), and storing them in an
+xsltStylePreCompstructure associated to the <strong>_private</strong>field of
+the node.</p><p>A couple of notable exceptions to this are XSLT template nodes (more
+onthis later) and attribute value templates. If they are actually
+templates,the value cannot be computed at compilation time. (Some
+preprocessing couldbe done like isolation and preparsing of the XPath
+subexpressions but it'snot done, yet.)</p><p>The xsltStylePreComp structure also allows storing of the precompiled
+formof an XPath expression that can be associated to an XSLT element (more
+onthis later).</p><h3><a name="XSLT2" id="XSLT2">The XSLT template compilation</a></h3><p>A proper handling of templates lookup is one of the keys of fast
+XSLTprocessing. (Given a node in the source document this is the process
+offinding which templates should be applied to this node.) Libxslt follows
+thehint suggested in the <a href="http://www.w3.org/TR/xslt#patterns">5.2Patterns</a>section of the XSLT
+Recommendation, i.e. it doesn't evaluate itas an XPath expression but
+tokenizes it and compiles it as a set of rules tobe evaluated on a candidate
+node. There usually is an indication of the nodename in the last step of this
+evaluation and this is used as a key check forthe match. As a result libxslt
+builds a relatively more complex set ofstructures for the templates:</p><p align="center"><img src="templates.gif" alt="The templates related structure" /></p><p>Let's describe a bit more closely what is built. First the
+xsltStylesheetstructure holds a pointer to the template hash table. All the
+XSLT patternscompiled in this stylesheet are indexed by the value of the the
+targetelement (or attribute, pi ...) name, so when a element or an attribute
+"foo"needs to be processed the lookup is done using the name as a key.</p><p>Each of the patterns is compiled into an xsltCompMatch structure. It
+holdsthe set of rules based on the tokenization of the pattern stored in
+reverseorder (matching is easier this way). It also holds some information
+about theprevious matches used to speed up the process when one iterates over
+a set ofsiblings. (This optimization may be defeated by trashing when
+runningthreaded computation, it's unclear that this is a big deal in
+practice.)Predicate expressions are not compiled at this stage, they may be
+at run-timeif needed, but in this case they are compiled as full XPath
+expressions (theuse of some fixed predicate can probably be optimized, they
+are not yet).</p><p>The xsltCompMatch are then stored in the hash table, the clash list
+isitself sorted by priority of the template to implement "naturally" the
+XSLTpriority rules.</p><p>Associated to the compiled pattern is the xsltTemplate itself
+containingthe information required for the processing of the pattern
+including, ofcourse, a pointer to the list of elements used for building the
+patternresult.</p><p>Last but not least a number of patterns do not fit in the hash
+tablebecause they are not associated to a name, this is the case for
+patternsapplying to the root, any element, any attributes, text nodes, pi
+nodes, keysetc. Those are stored independently in the stylesheet structure as
+separatelinked lists of xsltCompMatch.</p><h3><a name="processing" id="processing">The processing itself</a></h3><p>The processing is defined by the XSLT specification (the basis of
+thealgorithm is explained in <a href="http://www.w3.org/TR/xslt#section-Introduction">the
+Introduction</a>section). Basically it works by taking the root of the input
+document andapplying the following algorithm:</p><ol><li>Finding the template applying to it. This is a lookup in the
+    templatehash table, walking the hash list until the node satisfies all
+    the stepsof the pattern, then checking the appropriate(s) global
+    templates to seeif there isn't a higher priority rule to apply</li>
+  <li>If there is no template, apply the default rule (recurse on
+  thechildren)</li>
   <li>else walk the content list of the selected templates, for each of them:
-    <ul><li>if the node is in the XSLT namespace then the node has a _private
-        field pointing to the preprocessed values, jump to the specific
-      code</li>
-      <li>if the node is in an extension namespace, look up the associated
-        behavior</li>
+    <ul><li>if the node is in the XSLT namespace then the node has a
+        _privatefield pointing to the preprocessed values, jump to the
+        specificcode</li>
+      <li>if the node is in an extension namespace, look up the
+        associatedbehavior</li>
       <li>otherwise copy the node.</li>
-    </ul><p>The closure is usually done through the XSLT
-    <strong>apply-templates</strong> construct recursing by applying the
-    adequate template on the input node children or on the result of an
-    associated XPath selection lookup.</p>
+    </ul><p>The closure is usually done through the
+    XSLT<strong>apply-templates</strong>construct recursing by applying
+    theadequate template on the input node children or on the result of
+    anassociated XPath selection lookup.</p>
   </li>
-</ol><p>Note that large parts of the input tree may not be processed by a given
-stylesheet and that on the opposite some may be processed multiple times.
-(This often is the case when a Table of Contents is built).</p><p>The module <code>transform.c</code> is the one implementing most of this
-logic. <strong>xsltApplyStylesheet()</strong> is the entry point, it
-allocates an xsltTransformContext containing the following:</p><ul><li>a pointer to the stylesheet being processed</li>
+</ol><p>Note that large parts of the input tree may not be processed by a
+givenstylesheet and that on the opposite some may be processed multiple
+times.(This often is the case when a Table of Contents is built).</p><p>The module <code>transform.c</code>is the one implementing most of
+thislogic. <strong>xsltApplyStylesheet()</strong>is the entry point,
+itallocates an xsltTransformContext containing the following:</p><ul><li>a pointer to the stylesheet being processed</li>
   <li>a stack of templates</li>
   <li>a stack of variables and parameters</li>
   <li>an XPath context</li>
@@ -173,18 +173,18 @@
   <li>current selected node list</li>
   <li>the current insertion points in the output document</li>
   <li>a couple of hash tables for extension elements and functions</li>
-</ul><p>Then a new document gets allocated (HTML or XML depending on the type of
-output), the user parameters and global variables and parameters are
-evaluated. Then <strong>xsltProcessOneNode()</strong> which implements the
-1-2-3 algorithm is called on the root element of the input. Step 1/ is
-implemented by calling <strong>xsltGetTemplate()</strong>, step 2/ is
-implemented by <strong>xsltDefaultProcessOneNode()</strong> and step 3/ is
-implemented by <strong>xsltApplyOneTemplate()</strong>.</p><h3><a name="XPath" id="XPath">XPath expression compilation</a></h3><p>The XPath support is actually implemented in the libxml module (where it
-is reused by the XPointer implementation). XPath is a relatively classic
-expression language. The only uncommon feature is that it is working on XML
-trees and hence has specific syntax and types to handle them.</p><p>XPath expressions are compiled using <strong>xmlXPathCompile()</strong>.
-It will take an expression string in input and generate a structure
-containing the parsed expression tree, for example the expression:</p><pre>/doc/chapter[title='Introduction']</pre><p>will be compiled as</p><pre>Compiled Expression : 10 elements
+</ul><p>Then a new document gets allocated (HTML or XML depending on the type
+ofoutput), the user parameters and global variables and parameters
+areevaluated. Then <strong>xsltProcessOneNode()</strong>which implements
+the1-2-3 algorithm is called on the root element of the input. Step 1/
+isimplemented by calling <strong>xsltGetTemplate()</strong>, step 2/
+isimplemented by <strong>xsltDefaultProcessOneNode()</strong>and step 3/
+isimplemented by <strong>xsltApplyOneTemplate()</strong>.</p><h3><a name="XPath" id="XPath">XPath expression compilation</a></h3><p>The XPath support is actually implemented in the libxml module (where itis
+reused by the XPointer implementation). XPath is a relatively
+classicexpression language. The only uncommon feature is that it is working
+on XMLtrees and hence has specific syntax and types to handle them.</p><p>XPath expressions are compiled using <strong>xmlXPathCompile()</strong>.It
+will take an expression string in input and generate a structurecontaining
+the parsed expression tree, for example the expression:</p><pre>/doc/chapter[title='Introduction']</pre><p>will be compiled as</p><pre>Compiled Expression : 10 elements
   SORT
     COLLECT  'child' 'name' 'node' chapter
       COLLECT  'child' 'name' 'node' doc
@@ -196,97 +196,96 @@
               NODE
             ELEM Object is a string : Introduction
               COLLECT  'child' 'name' 'node' title
-                NODE</pre><p>This can be tested using the  <code>testXPath</code>  command (in the
-libxml codebase) using the <code>--tree</code> option.</p><p>Again, the KISS approach is used. No optimization is done. This could be
-an interesting thing to add. <a href="http://www-106.ibm.com/developerworks/library/x-xslt2/?dwzone=x?open&amp;l=132%2ct=gr%2c+p=saxon">Michael
-Kay describes</a> a lot of possible and interesting optimizations done in
-Saxon which would be possible at this level. I'm unsure they would provide
-much gain since the expressions tends to be relatively simple in general and
-stylesheets are still hand generated. Optimizations at the interpretation
-sounds likely to be more efficient.</p><h3><a name="XPath1" id="XPath1">XPath interpretation</a></h3><p>The interpreter is implemented by <strong>xmlXPathCompiledEval()</strong>
-which is the front-end to <strong>xmlXPathCompOpEval()</strong> the function
-implementing the evaluation of the expression tree. This evaluation follows
-the KISS approach again. It's recursive and calls
-<strong>xmlXPathNodeCollectAndTest()</strong> to collect nodes set when
-evaluating a <code>COLLECT</code> node.</p><p>An evaluation is done within the framework of an XPath context stored in
-an <strong>xmlXPathContext</strong> structure, in the framework of a
-transformation the context is maintained within the XSLT context. Its content
-follows the requirements from the XPath specification:</p><ul><li>the current document</li>
+                NODE</pre><p>This can be tested using the  <code>testXPath</code>command (in thelibxml
+codebase) using the <code>--tree</code>option.</p><p>Again, the KISS approach is used. No optimization is done. This could bean
+interesting thing to add. <a href="http://www-106.ibm.com/developerworks/library/x-xslt2/?dwzone=x?open&amp;l=132%2ct=gr%2c+p=saxon">MichaelKay
+describes</a>a lot of possible and interesting optimizations done inSaxon
+which would be possible at this level. I'm unsure they would providemuch gain
+since the expressions tends to be relatively simple in general andstylesheets
+are still hand generated. Optimizations at the interpretationsounds likely to
+be more efficient.</p><h3><a name="XPath1" id="XPath1">XPath interpretation</a></h3><p>The interpreter is implemented by
+<strong>xmlXPathCompiledEval()</strong>which is the front-end to
+<strong>xmlXPathCompOpEval()</strong>the functionimplementing the evaluation
+of the expression tree. This evaluation followsthe KISS approach again. It's
+recursive and calls<strong>xmlXPathNodeCollectAndTest()</strong>to collect
+nodes set whenevaluating a <code>COLLECT</code>node.</p><p>An evaluation is done within the framework of an XPath context stored inan
+<strong>xmlXPathContext</strong>structure, in the framework of
+atransformation the context is maintained within the XSLT context. Its
+contentfollows the requirements from the XPath specification:</p><ul><li>the current document</li>
   <li>the current node</li>
   <li>a hash table of defined variables (but not used by XSLT)</li>
   <li>a hash table of defined functions</li>
-  <li>the proximity position (the place of the node in the current node
-  list)</li>
+  <li>the proximity position (the place of the node in the current
+  nodelist)</li>
   <li>the context size (the size of the current node list)</li>
-  <li>the array of namespace declarations in scope (there also is a namespace
-    hash table but it is not used in the XSLT transformation).</li>
-</ul><p>For the purpose of XSLT an <strong>extra</strong> pointer has been added
-allowing to retrieve the XSLT transformation context. When an XPath
-evaluation is about to be performed, an XPath parser context is allocated
-containing and XPath object stack (this is actually an XPath evaluation
-context, this is a remain of the time where there was no separate parsing and
-evaluation phase in the XPath implementation). Here is an overview of the set
-of contexts associated to an XPath evaluation within an XSLT
-transformation:</p><p align="center"><img src="contexts.gif" alt="The set of contexts associated " /></p><p>Clearly this is a bit too complex and confusing and should be refactored
-at the next set of binary incompatible releases of libxml. For example the
-xmlXPathCtxt has a lot of unused parts and should probably be merged with
-xmlXPathParserCtxt.</p><h3><a name="Descriptio" id="Descriptio">Description of XPath Objects</a></h3><p>An XPath expression manipulates XPath objects. XPath defines the default
-types boolean, numbers, strings and node sets. XSLT adds the result tree
-fragment type which is basically an unmodifiable node set.</p><p>Implementation-wise, libxml follows again a KISS approach, the
-xmlXPathObject is a structure containing a type description and the various
-possibilities. (Using an enum could have gained some bytes.) In the case of
-node sets (or result tree fragments), it points to a separate xmlNodeSet
-object which contains the list of pointers to the document nodes:</p><p align="center"><img src="object.gif" alt="An Node set object pointing to " /></p><p>The <a href="http://xmlsoft.org/html/libxml-xpath.html">XPath API</a> (and
-its <a href="http://xmlsoft.org/html/libxml-xpathinternals.html">'internal'
-part</a>) includes a number of functions to create, copy, compare, convert or
-free XPath objects.</p><h3><a name="XPath3" id="XPath3">XPath functions</a></h3><p>All the XPath functions available to the interpreter are registered in the
-function hash table linked from the XPath context. They all share the same
-signature:</p><pre>void xmlXPathFunc (xmlXPathParserContextPtr ctxt, int nargs);</pre><p>The first argument is the XPath interpretation context, holding the
-interpretation stack. The second argument defines the number of objects
-passed on the stack for the function to consume (last argument is on top of
-the stack).</p><p>Basically an XPath function does the following:</p><ul><li>check <code>nargs</code> for proper handling of errors or functions
-    with variable numbers of parameters</li>
-  <li>pop the parameters from the stack using <code>obj =
-    valuePop(ctxt);</code></li>
+  <li>the array of namespace declarations in scope (there also is a
+    namespacehash table but it is not used in the XSLT transformation).</li>
+</ul><p>For the purpose of XSLT an <strong>extra</strong>pointer has been
+addedallowing to retrieve the XSLT transformation context. When an
+XPathevaluation is about to be performed, an XPath parser context is
+allocatedcontaining and XPath object stack (this is actually an XPath
+evaluationcontext, this is a remain of the time where there was no separate
+parsing andevaluation phase in the XPath implementation). Here is an overview
+of the setof contexts associated to an XPath evaluation within an
+XSLTtransformation:</p><p align="center"><img src="contexts.gif" alt="The set of contexts associated " /></p><p>Clearly this is a bit too complex and confusing and should be refactoredat
+the next set of binary incompatible releases of libxml. For example
+thexmlXPathCtxt has a lot of unused parts and should probably be merged
+withxmlXPathParserCtxt.</p><h3><a name="Descriptio" id="Descriptio">Description of XPath Objects</a></h3><p>An XPath expression manipulates XPath objects. XPath defines the
+defaulttypes boolean, numbers, strings and node sets. XSLT adds the result
+treefragment type which is basically an unmodifiable node set.</p><p>Implementation-wise, libxml follows again a KISS approach,
+thexmlXPathObject is a structure containing a type description and the
+variouspossibilities. (Using an enum could have gained some bytes.) In the
+case ofnode sets (or result tree fragments), it points to a separate
+xmlNodeSetobject which contains the list of pointers to the document
+nodes:</p><p align="center"><img src="object.gif" alt="An Node set object pointing to " /></p><p>The <a href="http://xmlsoft.org/html/libxml-xpath.html">XPath
+API</a>(andits <a href="http://xmlsoft.org/html/libxml-xpathinternals.html">'internal'part</a>)
+includes a number of functions to create, copy, compare, convert orfree XPath
+objects.</p><h3><a name="XPath3" id="XPath3">XPath functions</a></h3><p>All the XPath functions available to the interpreter are registered in
+thefunction hash table linked from the XPath context. They all share the
+samesignature:</p><pre>void xmlXPathFunc (xmlXPathParserContextPtr ctxt, int nargs);</pre><p>The first argument is the XPath interpretation context, holding
+theinterpretation stack. The second argument defines the number of
+objectspassed on the stack for the function to consume (last argument is on
+top ofthe stack).</p><p>Basically an XPath function does the following:</p><ul><li>check <code>nargs</code>for proper handling of errors or functionswith
+    variable numbers of parameters</li>
+  <li>pop the parameters from the stack using <code>obj
+    =valuePop(ctxt);</code></li>
   <li>do the function specific computation</li>
-  <li>push the result parameter on the stack using <code>valuePush(ctxt,
-    res);</code></li>
-  <li>free up the input parameters with
-  <code>xmlXPathFreeObject(obj);</code></li>
+  <li>push the result parameter on the stack using
+    <code>valuePush(ctxt,res);</code></li>
+  <li>free up the input parameters
+  with<code>xmlXPathFreeObject(obj);</code></li>
   <li>return</li>
-</ul><p>Sometime the work can be done directly by modifying in-situ the top object
-on the stack <code>ctxt-&gt;value</code>.</p><h3><a name="stack" id="stack">The XSLT variables stack frame</a></h3><p>Not to be confused with XPath object stack, this stack holds the XSLT
-variables and parameters as they are defined through the recursive calls of
-call-template, apply-templates and default templates. This is used to define
-the scope of variables being called.</p><p>This part seems to be the most urgent attention right now, first it is
-done in a very inefficient way since the location of the variables and
-parameters within the stylesheet tree is still done at run time (it really
-should be done statically at compile time), and I am still unsure that my
-understanding of the template variables and parameter scope is actually
-right.</p><p>This part of the documentation is still to be written once this part of
-the code will be stable. <span style="background-color: #FF0000">TODO</span></p><h3><a name="Extension" id="Extension">Extension support</a></h3><p>There is a separate document explaining <a href="extensions.html">how the
-extension support works</a>.</p><h3><a name="Futher" id="Futher">Further reading</a></h3><p>Michael Kay wrote <a href="http://www-106.ibm.com/developerworks/library/x-xslt2/?dwzone=x?open&amp;l=132%2ct=gr%2c+p=saxon">a
-really interesting article on Saxon internals</a> and the work he did on
-performance issues. I wishes I had read it before starting libxslt design (I
-would probably have avoided a few mistakes and progressed faster). A lot of
-the ideas in his papers should be implemented or at least tried in
-libxslt.</p><p>The <a href="http://xmlsoft.org/">libxml documentation</a>, especially <a href="http://xmlsoft.org/xmlio.html">the I/O interfaces</a> and the <a href="http://xmlsoft.org/xmlmem.html">memory management</a>.</p><h3><a name="TODOs" id="TODOs">TODOs</a></h3><p>redesign the XSLT stack frame handling. Far too much work is done at
-execution time. Similarly for the attribute value templates handling, at
-least the embedded subexpressions ought to be precompiled.</p><p>Allow output to be saved to a SAX like output (this notion of SAX like API
-for output should be added directly to libxml).</p><p>Implement and test some of the optimization explained by Michael Kay
-especially:</p><ul><li>static slot allocation on the stack frame</li>
+</ul><p>Sometime the work can be done directly by modifying in-situ the top
+objecton the stack <code>ctxt-&gt;value</code>.</p><h3><a name="stack" id="stack">The XSLT variables stack frame</a></h3><p>Not to be confused with XPath object stack, this stack holds the
+XSLTvariables and parameters as they are defined through the recursive calls
+ofcall-template, apply-templates and default templates. This is used to
+definethe scope of variables being called.</p><p>This part seems to be the most urgent attention right now, first it isdone
+in a very inefficient way since the location of the variables andparameters
+within the stylesheet tree is still done at run time (it reallyshould be done
+statically at compile time), and I am still unsure that myunderstanding of
+the template variables and parameter scope is actuallyright.</p><p>This part of the documentation is still to be written once this part ofthe
+code will be stable. <span style="background-color: #FF0000">TODO</span></p><h3><a name="Extension" id="Extension">Extension support</a></h3><p>There is a separate document explaining <a href="extensions.html">how
+theextension support works</a>.</p><h3><a name="Futher" id="Futher">Further reading</a></h3><p>Michael Kay wrote <a href="http://www-106.ibm.com/developerworks/library/x-xslt2/?dwzone=x?open&amp;l=132%2ct=gr%2c+p=saxon">areally
+interesting article on Saxon internals</a>and the work he did onperformance
+issues. I wishes I had read it before starting libxslt design (Iwould
+probably have avoided a few mistakes and progressed faster). A lot ofthe
+ideas in his papers should be implemented or at least tried inlibxslt.</p><p>The <a href="http://xmlsoft.org/">libxml documentation</a>, especially <a href="http://xmlsoft.org/xmlio.html">the I/O interfaces</a>and the <a href="http://xmlsoft.org/xmlmem.html">memory management</a>.</p><h3><a name="TODOs" id="TODOs">TODOs</a></h3><p>redesign the XSLT stack frame handling. Far too much work is done
+atexecution time. Similarly for the attribute value templates handling,
+atleast the embedded subexpressions ought to be precompiled.</p><p>Allow output to be saved to a SAX like output (this notion of SAX like
+APIfor output should be added directly to libxml).</p><p>Implement and test some of the optimization explained by Michael
+Kayespecially:</p><ul><li>static slot allocation on the stack frame</li>
   <li>specific boolean interpretation of an XPath expression</li>
   <li>some of the sorting optimization</li>
-  <li>Lazy evaluation of location path. (this may require more changes but
-    sounds really interesting. XT does this too.)</li>
-  <li>Optimization of an expression tree (This could be done as a completely
-    independent module.)</li>
-</ul><p></p><p>Error reporting, there is a lot of case where the XSLT specification
-specify that a given construct is an error are not checked adequately by
-libxslt. Basically one should do a complete pass on the XSLT spec again and
-add all tests to the stylesheet compilation. Using the DTD provided in the
-appendix and making direct checks using the libxml validation API sounds a
-good idea too (though one should take care of not raising errors for
-elements/attributes in different namespaces).</p><p>Double check all the places where the stylesheet compiled form might be
-modified at run time (extra removal of blanks nodes, hint on the
-xsltCompMatch).</p><p></p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>
+  <li>Lazy evaluation of location path. (this may require more changes
+    butsounds really interesting. XT does this too.)</li>
+  <li>Optimization of an expression tree (This could be done as a
+    completelyindependent module.)</li>
+</ul><p></p><p>Error reporting, there is a lot of case where the XSLT
+specificationspecify that a given construct is an error are not checked
+adequately bylibxslt. Basically one should do a complete pass on the XSLT
+spec again andadd all tests to the stylesheet compilation. Using the DTD
+provided in theappendix and making direct checks using the libxml validation
+API sounds agood idea too (though one should take care of not raising errors
+forelements/attributes in different namespaces).</p><p>Double check all the places where the stylesheet compiled form might
+bemodified at run time (extra removal of blanks nodes, hint on
+thexsltCompMatch).</p><p></p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/intro.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/intro.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/intro.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,16 +8,14 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>Introduction</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>Introduction</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>This document describes <a href="http://xmlsoft.org/XSLT/">libxslt</a>,
-the <a href="http://www.w3.org/TR/xslt">XSLT</a> C library developed for the
-<a href="http://www.gnome.org/">Gnome</a> project.</p><p>Here are some key points about libxslt:</p><ul><li>Libxslt is a C implementation</li>
-  <li>Libxslt is based on libxml for XML parsing, tree manipulation and XPath
-    support</li>
-  <li>It is written in plain C, making as few assumptions as possible, and
-    sticking closely to ANSI C/POSIX for easy embedding. Should works on
-    Linux/Unix/Windows.</li>
-  <li>This library is released under the <a href="http://www.opensource.org/licenses/mit-license.html">MIT
-  Licence</a></li>
-  <li>Though not designed primarily with performances in mind, libxslt seems
-    to be a relatively fast processor.</li>
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>This document describes <a href="http://xmlsoft.org/XSLT/">libxslt</a>,the
+<a href="http://www.w3.org/TR/xslt">XSLT</a>C library developed for the<a href="http://www.gnome.org/">Gnome</a>project.</p><p>Here are some key points about libxslt:</p><ul><li>Libxslt is a C implementation</li>
+  <li>Libxslt is based on libxml for XML parsing, tree manipulation and
+    XPathsupport</li>
+  <li>It is written in plain C, making as few assumptions as possible,
+    andsticking closely to ANSI C/POSIX for easy embedding. Should works
+    onLinux/Unix/Windows.</li>
+  <li>This library is released under the <a href="http://www.opensource.org/licenses/mit-license.html">MITLicence</a></li>
+  <li>Though not designed primarily with performances in mind, libxslt
+    seemsto be a relatively fast processor.</li>
 </ul><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/libxslt.xsa
===================================================================
--- packages/libxslt/branches/upstream/current/doc/libxslt.xsa	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/libxslt.xsa	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,19 +8,22 @@
   </vendor>
   <product id="libxslt">
     <name>libxslt</name>
-    <version>1.1.15</version>
-    <last-release> Sep 04 2005</last-release>
+    <version>1.1.16</version>
+    <last-release> May 01 2006</last-release>
     <info-url>http://xmlsoft.org/XSLT/</info-url>
-    <changes>   - build fixes: Windows build cleanups and updates (Igor Zlatkovic),
-    remove jhbuild warnings
-   - bug fixes: negative number formatting (William Brack), number
-    formatting per mille definition (William Brack), XInclude default values
-    (William), text copy bugs (William), bug related to xmlXPathContext size,
-    reuse libxml2 memory management for text nodes, dictionnary text bug,
-    forbid variables in match (needs libxml2-2.6.21)
-   - improvements: EXSLT dyn:map (Mark Vakoc),
-   - documentation: EXSLT date and time functions namespace in man (Jonathan
-    Wakely)
+    <changes>   - portability fixes: EXSLT date/time on Solaris and IRIX (Albert
+    Chin),HP-UX  build (Albert Chin),
+   - build fixes: Python detection(Joseph Sacco), plugin configurei(Joel
+    Reed)
+   - bug fixes: pattern compilation fix(William Brack), EXSLT date/timefix
+    (Thomas Broyer), EXSLT function bug, potential loop on variableeval,
+    startup race (Christopher Palmer), debug statement left in python(Nic
+    Ferrier), various cleanup based on Coverity reports), error onOut of
+    memory condition (Charles Hardin), various namespace prefixesfixes
+    (Kasimier Buchcik),
+   - improvement: speed up sortingi, start of internals refactoring
+    (KasimierBuchcik)
+   - documentation: man page fixes and updates (Daniel Leidert)
 
 </changes>
   </product>

Modified: packages/libxslt/branches/upstream/current/doc/news.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/news.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/news.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,155 +8,162 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>News</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>News</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>The <a href="ChangeLog.html">change log</a> describes the recents commits
-to the <a href="http://cvs.gnome.org/viewcvs/libxslt/">CVS</a> code base.</p><p>Those are the public releases made:</p><h3>1.1.16: May 01 2006</h3><ul><li>portability fixes: EXSLT date/time on Solaris and IRIX (Albert Chin),
-      HP-UX  build (Albert Chin), 
-  </li><li>build fixes: Python detection(Joseph Sacco), plugin configurei
-      (Joel Reed)</li>
-  <li>bug fixes: pattern compilation fix(William Brack), EXSLT date/time
-      fix (Thomas Broyer), EXSLT function bug, potential loop on variable
-      eval, startup race (Christopher Palmer), debug statement left in python
-      (Nic Ferrier), various cleanup based on Coverity reports), error on
-      Out of memory condition (Charles Hardin), various namespace prefixes
-      fixes (Kasimier Buchcik), </li>
-  <li>improvement: speed up sortingi, start of internals refactoring (Kasimier
-      Buchcik)</li>
-  <li>documentation: man page fixes and updates (Daniel Leidert)
-</li></ul><h3>1.1.15: Sep 04 2005</h3><ul><li>build fixes: Windows build cleanups and updates (Igor Zlatkovic),
-    remove jhbuild warnings</li>
-  <li>bug fixes: negative number formatting (William Brack), number
-    formatting per mille definition (William Brack), XInclude default values
-    (William), text copy bugs (William), bug related to xmlXPathContext size,
-    reuse libxml2 memory management for text nodes, dictionnary text bug,
-    forbid variables in match (needs libxml2-2.6.21)</li>
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>The <a href="ChangeLog.html">change log</a>describes the recents commitsto
+the <a href="http://cvs.gnome.org/viewcvs/libxslt/">CVS</a>code base.</p><p>Those are the public releases made:</p><h3>1.1.17: Jun 6 2006</h3><ul><li>portability fixes: python detection</li>
+  <li>bug fixes: some regression tests, attribute/namespaces output (Kasimier
+    Buchcik), problem in mixed xsl:value-of and xsl:text uses (Kasimier)</li>
+  <li>improvements: internal refactoring (Kasimier Buchcik), use of the XPath
+    object cache in libxml2-2.6.25 (Kasimier)</li>
+</ul><h3>1.1.16: May 01 2006</h3><ul><li>portability fixes: EXSLT date/time on Solaris and IRIX (Albert
+    Chin),HP-UX  build (Albert Chin),</li>
+  <li>build fixes: Python detection(Joseph Sacco), plugin configurei(Joel
+    Reed)</li>
+  <li>bug fixes: pattern compilation fix(William Brack), EXSLT date/timefix
+    (Thomas Broyer), EXSLT function bug, potential loop on variableeval,
+    startup race (Christopher Palmer), debug statement left in python(Nic
+    Ferrier), various cleanup based on Coverity reports), error onOut of
+    memory condition (Charles Hardin), various namespace prefixesfixes
+    (Kasimier Buchcik),</li>
+  <li>improvement: speed up sortingi, start of internals refactoring
+    (KasimierBuchcik)</li>
+  <li>documentation: man page fixes and updates (Daniel Leidert)</li>
+</ul><h3>1.1.15: Sep 04 2005</h3><ul><li>build fixes: Windows build cleanups and updates (Igor Zlatkovic),remove
+    jhbuild warnings</li>
+  <li>bug fixes: negative number formatting (William Brack), numberformatting
+    per mille definition (William Brack), XInclude default values(William),
+    text copy bugs (William), bug related to xmlXPathContext size,reuse
+    libxml2 memory management for text nodes, dictionnary text bug,forbid
+    variables in match (needs libxml2-2.6.21)</li>
   <li>improvements: EXSLT dyn:map (Mark Vakoc),</li>
-  <li>documentation: EXSLT date and time functions namespace in man (Jonathan
-    Wakely)</li>
-</ul><h3>1.1.14: Apr 02 2005</h3><ul><li>bug fixes: text node on stylesheet document without a dictionary
-    (William Brack), more checking of XSLT syntax, calling xsltInit()
-    multiple times, mode values interning raised by Mark Vakoc, bug in
-    pattern matching with ancestors, bug in patterna matching with cascading
-    select, xinclude and document() problem, build outside of source tree
-    (Mike Castle)</li>
-  <li>improvement: added a --nodict mode to xsltproc to check problems for
-    docuemtns without dictionnaries</li>
-</ul><h3>1.1.13: Mar 13 2005</h3><ul><li>build fixes: 64bits cleanup (William Brack), python 2.4 test (William),
-    LIBXSLT_VERSION_EXTRA on Windows (William), Windows makefiles fixes (Joel
-    Reed), libgcrypt-devel requires for RPM spec.</li>
-  <li>bug fixes: exslt day-of-week-in-month (Sal Paradise), xsl:call-template
-    should not change the current template rule (William Brack), evaluation
-    of global variables (William Brack), RVT's in XPath predicates (William),
-    namespace URI on template names (Mark Vakoc), stat() for Windows patch
-    (Aleksey Gurtovoy), pattern expression fixes (William Brack), out of
-    memory detection misses (William), parserOptions propagation (William),
-    exclude-result-prefixes fix (William), // patten fix (William).</li>
-  <li>extensions: module support (Joel Reed), dictionnary based speedups
-    trying to get rid of xmlStrEqual as much as possible.</li>
+  <li>documentation: EXSLT date and time functions namespace in man
+    (JonathanWakely)</li>
+</ul><h3>1.1.14: Apr 02 2005</h3><ul><li>bug fixes: text node on stylesheet document without a
+    dictionary(William Brack), more checking of XSLT syntax, calling
+    xsltInit()multiple times, mode values interning raised by Mark Vakoc, bug
+    inpattern matching with ancestors, bug in patterna matching with
+    cascadingselect, xinclude and document() problem, build outside of source
+    tree(Mike Castle)</li>
+  <li>improvement: added a --nodict mode to xsltproc to check problems
+    fordocuemtns without dictionnaries</li>
+</ul><h3>1.1.13: Mar 13 2005</h3><ul><li>build fixes: 64bits cleanup (William Brack), python 2.4 test
+    (William),LIBXSLT_VERSION_EXTRA on Windows (William), Windows makefiles
+    fixes (JoelReed), libgcrypt-devel requires for RPM spec.</li>
+  <li>bug fixes: exslt day-of-week-in-month (Sal Paradise),
+    xsl:call-templateshould not change the current template rule (William
+    Brack), evaluationof global variables (William Brack), RVT's in XPath
+    predicates (William),namespace URI on template names (Mark Vakoc), stat()
+    for Windows patch(Aleksey Gurtovoy), pattern expression fixes (William
+    Brack), out ofmemory detection misses (William), parserOptions
+    propagation (William),exclude-result-prefixes fix (William), // patten
+    fix (William).</li>
+  <li>extensions: module support (Joel Reed), dictionnary based
+    speedupstrying to get rid of xmlStrEqual as much as possible.</li>
   <li>documentation: added Wiki (Joel Reed)</li>
 </ul><h3>1.1.12: Oct 29 2004</h3><ul><li>build fixes: warnings removal (William).</li>
-  <li>bug fixes: attribute document pointer fix (Mark Vakoc), exslt date
-    negative periods (William Brack), generated tree structure fixes,
-    namespace lookup fix, use reentrant gmtime_r (William Brack),
-    exslt:funtion namespace fix (William), potential NULL pointer reference
-    (Dennis Dams, William), force string interning on generated
-  documents.</li>
-  <li>documentation: update of the second tutorial (Panagiotis Louridas), add
-    exslt doc in rpm packages, fix the xsltproc man page.</li>
-</ul><h3>1.1.11: Sep 29 2004</h3><ul><li>bug fixes: xsl:include problems (William Brack), UTF8 number pattern
-    (William), date-time validation (William), namespace fix (William),
-    various Exslt date fixes (William), error callback fixes, leak with
-    namespaced global variable, attempt to fix a weird problem #153137</li>
+  <li>bug fixes: attribute document pointer fix (Mark Vakoc), exslt
+    datenegative periods (William Brack), generated tree structure
+    fixes,namespace lookup fix, use reentrant gmtime_r (William
+    Brack),exslt:funtion namespace fix (William), potential NULL pointer
+    reference(Dennis Dams, William), force string interning on
+    generateddocuments.</li>
+  <li>documentation: update of the second tutorial (Panagiotis Louridas),
+    addexslt doc in rpm packages, fix the xsltproc man page.</li>
+</ul><h3>1.1.11: Sep 29 2004</h3><ul><li>bug fixes: xsl:include problems (William Brack), UTF8 number
+    pattern(William), date-time validation (William), namespace fix
+    (William),various Exslt date fixes (William), error callback fixes, leak
+    withnamespaced global variable, attempt to fix a weird problem
+  #153137</li>
   <li>improvements: exslt:date-sum tests (Derek Poon)</li>
   <li>documentation: second tutorial by Panagiotis Lourida</li>
-</ul><h3>1.1.10: Aug 31 2004</h3><ul><li>build fix: NUL in c file blocking compilation on Solaris, Windows build
-    (Igor Zlatkovic)</li>
+</ul><h3>1.1.10: Aug 31 2004</h3><ul><li>build fix: NUL in c file blocking compilation on Solaris, Windows
+    build(Igor Zlatkovic)</li>
   <li>fix: key initialization problem (William Brack)</li>
   <li>documentation: fixed missing man page description for --path</li>
-</ul><h3>1.1.9: Aug 22 2004</h3><ul><li>build fixes: missing tests (William Brack), Python dependancies, Python
-    on 64bits boxes, --with-crypto flag (Rob Richards),</li>
-  <li>fixes: RVT key handling (William), Python binding (William and Sitsofe
-    Wheeler), key and XPath troubles (William), template priority on imports
-    (William), str:tokenize with empty strings (William), #default namespace
-    alias behaviour (William), doc ordering missing for main document
-    (William), 64bit bug (Andreas Schwab)</li>
-  <li>improvements: EXSLT date:sum added (Joel Reed), hook for document
-    loading for David Hyatt, xsltproc --nodtdattr to avoid defaulting DTD
-    attributes, extend xsltproc --version with CVS stamp (William).</li>
+</ul><h3>1.1.9: Aug 22 2004</h3><ul><li>build fixes: missing tests (William Brack), Python dependancies,
+    Pythonon 64bits boxes, --with-crypto flag (Rob Richards),</li>
+  <li>fixes: RVT key handling (William), Python binding (William and
+    SitsofeWheeler), key and XPath troubles (William), template priority on
+    imports(William), str:tokenize with empty strings (William), #default
+    namespacealias behaviour (William), doc ordering missing for main
+    document(William), 64bit bug (Andreas Schwab)</li>
+  <li>improvements: EXSLT date:sum added (Joel Reed), hook for
+    documentloading for David Hyatt, xsltproc --nodtdattr to avoid defaulting
+    DTDattributes, extend xsltproc --version with CVS stamp (William).</li>
   <li>Documentation: web page problem reported by Oliver Stoeneberg</li>
-</ul><h3>1.1.8: July 5 2004</h3><ul><li>build fixes: Windows runtime options (Oliver Stoeneberg), Windows
-    binary package layout (Igor Zlatkovic), libgcrypt version test and link
-    (William)</li>
+</ul><h3>1.1.8: July 5 2004</h3><ul><li>build fixes: Windows runtime options (Oliver Stoeneberg), Windowsbinary
+    package layout (Igor Zlatkovic), libgcrypt version test and
+  link(William)</li>
   <li>documentation: fix libxslt namespace name in doc (William)</li>
-  <li>bug fixes: undefined namespace message (William Brack), search engine
-    (William), multiple namespace fixups (William), namespace fix for key
-    evaluation (William), Python memory debug bindings,</li>
+  <li>bug fixes: undefined namespace message (William Brack), search
+    engine(William), multiple namespace fixups (William), namespace fix for
+    keyevaluation (William), Python memory debug bindings,</li>
   <li>improvements: crypto extensions for exslt (Joel Reed, William)</li>
 </ul><h3>1.1.7: May 17 2004</h3><ul><li>build fix: warning about localtime_r on Solaris</li>
-  <li>bug fix: UTF8 string tokenize (William Brack), subtle memory
-    corruption, linefeed after comment at document level (William),
-    disable-output-escaping problem (William), pattern compilation in deep
-    imported stylesheets (William), namespace extension prefix bug,
-    libxslt.m4 bug (Edward Rudd), namespace lookup for attribute, namespaced
-    DOCTYPE name</li>
+  <li>bug fix: UTF8 string tokenize (William Brack), subtle memorycorruption,
+    linefeed after comment at document level
+    (William),disable-output-escaping problem (William), pattern compilation
+    in deepimported stylesheets (William), namespace extension prefix
+    bug,libxslt.m4 bug (Edward Rudd), namespace lookup for attribute,
+    namespacedDOCTYPE name</li>
 </ul><h3>1.1.6: Apr 18 2004</h3><ul><li>2 bug fixes about keys fixed one by Mark Vakoc</li>
 </ul><h3>1.1.5: Mar 23 2004</h3><ul><li>performance: use dictionnary lookup for variables</li>
   <li>remove use of _private from source documents</li>
   <li>cleanup of "make tests" output</li>
-  <li>bugfixes: AVT in local variables, use localtime_r to avoid thread
-    troubles (William), dictionary handling bug (William), limited number of
-    stubstitutions in AVT (William), tokenize fix for UTF-8 (William),
-    superfluous namespace (William), xsltproc error code on
-    &lt;xsl:message&gt; halt, OpenVMS fix, dictionnary reference counting
-    change.</li>
-</ul><h3>1.1.4: Feb 23 2004</h3><ul><li>bugfixes: attributes without doc (Mariano Suárez-Alvarez), problem with
-    Yelp, extension problem</li>
+  <li>bugfixes: AVT in local variables, use localtime_r to avoid
+    threadtroubles (William), dictionary handling bug (William), limited
+    number ofstubstitutions in AVT (William), tokenize fix for UTF-8
+    (William),superfluous namespace (William), xsltproc error code
+    on&lt;xsl:message&gt; halt, OpenVMS fix, dictionnary reference
+    countingchange.</li>
+</ul><h3>1.1.4: Feb 23 2004</h3><ul><li>bugfixes: attributes without doc (Mariano Suárez-Alvarez), problem
+    withYelp, extension problem</li>
   <li>display extension modules (Steve Little)</li>
   <li>Windows compilation patch (Mark Vadoc), Mingw (Mikhail Grushinskiy)</li>
-</ul><h3>1.1.3: Feb 16 2004</h3><ul><li>Rewrote the Attribute Value Template code, new XPath compilation
-    interfaces, dictionnary reuses for XSLT with potential for serious
-    performance improvements.</li>
-  <li>bug fixes: portability (William Brack), key() in node-set() results
-    (William), comment before doctype (William), math and node-set() problems
-    (William), cdata element and default namespace (William), behaviour on
-    unknown XSLT elements (Stefan Kost), priority of "//foo" patterns
-    (William), xsl:element and xsl:attribute QName check (William), comments
-    with -- (William), attribute namespace (William), check for ?&gt; in PI
-    (William)</li>
+</ul><h3>1.1.3: Feb 16 2004</h3><ul><li>Rewrote the Attribute Value Template code, new XPath
+    compilationinterfaces, dictionnary reuses for XSLT with potential for
+    seriousperformance improvements.</li>
+  <li>bug fixes: portability (William Brack), key() in node-set()
+    results(William), comment before doctype (William), math and node-set()
+    problems(William), cdata element and default namespace (William),
+    behaviour onunknown XSLT elements (Stefan Kost), priority of "//foo"
+    patterns(William), xsl:element and xsl:attribute QName check (William),
+    commentswith -- (William), attribute namespace (William), check for ?&gt;
+    in PI(William)</li>
   <li>Documentations: cleanup (John Fleck and William)</li>
-  <li>Python: patch for OS-X (Gianni Ceccarelli), enums export (Stephane
-    bidoul)</li>
-</ul><h3>1.1.2: Dec 24 2003</h3><ul><li>Documentation fixes (John Fleck, William Brack), EXSLT documentation
-    (William Brack)</li>
+  <li>Python: patch for OS-X (Gianni Ceccarelli), enums export
+    (Stephanebidoul)</li>
+</ul><h3>1.1.2: Dec 24 2003</h3><ul><li>Documentation fixes (John Fleck, William Brack), EXSLT
+    documentation(William Brack)</li>
   <li>Windows compilation fixes for MSVC and Mingw (Igor Zlatkovic)</li>
-  <li>Bug fixes: exslt:date returning NULL strings (William Brack),
-    namespaces output (William Brack),  key and namespace definition problem,
-    passing options down to the document() parser, xsl:number fixes (William
-    Brack)</li>
+  <li>Bug fixes: exslt:date returning NULL strings (William Brack),namespaces
+    output (William Brack),  key and namespace definition problem,passing
+    options down to the document() parser, xsl:number fixes
+  (WilliamBrack)</li>
 </ul><h3>1.1.1: Dec 10 2003</h3><ul><li>code cleanup (William Brack)</li>
   <li>Windows: Makefile improvements (Igor Zlatkovic)</li>
-  <li>documentation improvements: William Brack, libexslt man page (Jonathan
-    Wakely)</li>
+  <li>documentation improvements: William Brack, libexslt man page
+    (JonathanWakely)</li>
   <li>param in EXSLT functions (Shaun McCance)</li>
   <li>XSLT debugging improvements (Mark Vakoc)</li>
-  <li>bug fixes: number formatting (Bjorn Reese), exslt:tokenize (William
-    Brack), key selector parsing with | reported by Oleg Paraschenko,
-    xsl:element with computed namespaces (William Brack), xslt:import/include
-    recursion detection (William Brack), exslt:function used in keys (William
-    Brack), bug when CDATA_SECTION are foun in the tree (William Brack),
-    entities handling when using XInclude.</li>
+  <li>bug fixes: number formatting (Bjorn Reese), exslt:tokenize
+    (WilliamBrack), key selector parsing with | reported by Oleg
+    Paraschenko,xsl:element with computed namespaces (William Brack),
+    xslt:import/includerecursion detection (William Brack), exslt:function
+    used in keys (WilliamBrack), bug when CDATA_SECTION are foun in the tree
+    (William Brack),entities handling when using XInclude.</li>
 </ul><h3>1.1.0: Nov 4 2003</h3><ul><li>Removed DocBook SGML broken support</li>
   <li>fix xsl:key to work with PIs</li>
-  <li>Makefile and build improvement (Graham Wilson), build cleanup (William
-    Brack), macro fix (Justin Fletcher), build outside of source tree (Roumen
-    Petrov)</li>
-  <li>xsltproc option display fix (Alexey Efimov), --load-trace (Crutcher
-    Dunnavant)</li>
+  <li>Makefile and build improvement (Graham Wilson), build cleanup
+    (WilliamBrack), macro fix (Justin Fletcher), build outside of source tree
+    (RoumenPetrov)</li>
+  <li>xsltproc option display fix (Alexey Efimov), --load-trace
+    (CrutcherDunnavant)</li>
   <li>Python: never use stdout for error</li>
   <li>extension memory error fix (Karl Eichwalder)</li>
   <li>header path fixes (Steve Ball)</li>
   <li>added saxon:line-number() to libexslt (Brett Kail)</li>
-  <li>Fix some tortuous template problems when using predicates (William
-    Brack)</li>
+  <li>Fix some tortuous template problems when using predicates
+  (WilliamBrack)</li>
   <li>Debugger status patch (Kasimier Buchcik)</li>
   <li>Use new libxml2-2.6.x APIs for faster processing</li>
   <li>Make sure xsl:sort is empty</li>
@@ -175,66 +182,67 @@
   <li>apply-templates crash (William Brack)</li>
   <li>bug with imported templates (William Brack)</li>
   <li>imported attribute-sets merging bug (DocBook) (William Brack)</li>
-</ul><h3>1.0.32: Aug 9 2003</h3><ul><li>bugfixes: xsltSaveResultToFile() python binding (Chris Jaeger), EXSLT
-    function (William Brack), RVT for globals (William Brack), EXSLT date
-    (William Brack),
-    <p>speed of large text output, xsl:copy with attributes, strip-space and
-    namespaces prefix, fix for --path xsltproc option, EXST:tokenize (Shaun
-    McCance), EXSLT:seconds (William Brack), sort with multiple keys (William
-    Brack), checking of { and } for attribute value templates (William
-    Brack)</p>
+</ul><h3>1.0.32: Aug 9 2003</h3><ul><li>bugfixes: xsltSaveResultToFile() python binding (Chris Jaeger),
+    EXSLTfunction (William Brack), RVT for globals (William Brack), EXSLT
+    date(William Brack),
+    <p>speed of large text output, xsl:copy with attributes, strip-space
+    andnamespaces prefix, fix for --path xsltproc option, EXST:tokenize
+    (ShaunMcCance), EXSLT:seconds (William Brack), sort with multiple keys
+    (WilliamBrack), checking of { and } for attribute value templates
+    (WilliamBrack)</p>
   </li>
   <li>Python bindings for extension elements (Sean Treadway)</li>
   <li>EXSLT:split added (Shaun McCance)</li>
   <li>portability fixes for HP-UX/Solaris/IRIX (William Brack)</li>
   <li>doc cleanup</li>
-</ul><h3>1.0.31: Jul 6 2003</h3><ul><li>bugfixes: xsl:copy on namespace nodes, AVT for xsl:sort order, fix for
-    the debugger (Keith Isdale), output filename limitation, trio.h and
-    triodef.h added (Albert Chin), EXSLT node-set (Peter Breitenlohner),
-    xsltChoose and whitespace (Igor Zlatkovic),
-    <p>stylesheet compilation (Igor Zlatkovic), NaN and sort (William Brack),
-    RVT bug introduced in 1.0.30</p>
+</ul><h3>1.0.31: Jul 6 2003</h3><ul><li>bugfixes: xsl:copy on namespace nodes, AVT for xsl:sort order, fix
+    forthe debugger (Keith Isdale), output filename limitation, trio.h
+    andtriodef.h added (Albert Chin), EXSLT node-set (Peter
+    Breitenlohner),xsltChoose and whitespace (Igor Zlatkovic),
+    <p>stylesheet compilation (Igor Zlatkovic), NaN and sort (William
+    Brack),RVT bug introduced in 1.0.30</p>
   </li>
   <li>avoid generating &amp;quot; (fix in libxml2-2.5.8)</li>
-  <li>fix 64bit cleaness problem and compilation troubles introduced in
-  1.0.30</li>
+  <li>fix 64bit cleaness problem and compilation troubles introduced
+  in1.0.30</li>
   <li>Windows makefile generation (Igor Zlatkovic)</li>
   <li>HP-UX portability fix</li>
 </ul><h3>1.0.30: May 4 2003</h3><ul><li>Fixes and new APIs to handle Result Value Trees and avoid leaks</li>
-  <li>Fixes for: EXSLT math pow() function (Charles Bozeman), global
-    parameter and global variables mismatch, a segfault on pattern
-    compilation errors, namespace copy in xsl:copy-of, python generator
-    problem, OpenVMS trio update, premature call to xsltFreeStackElem (Igor),
-    current node when templates applies to attributes</li>
+  <li>Fixes for: EXSLT math pow() function (Charles Bozeman), globalparameter
+    and global variables mismatch, a segfault on patterncompilation errors,
+    namespace copy in xsl:copy-of, python generatorproblem, OpenVMS trio
+    update, premature call to xsltFreeStackElem (Igor),current node when
+    templates applies to attributes</li>
 </ul><h3>1.0.29: Apr 1 2003</h3><ul><li>performance improvements especially for large flat documents</li>
-  <li>bug fixes: Result Value Tree handling, XML IDs, keys(), extra namespace
-    declarations with xsl:elements.</li>
-  <li>portability: python and trio fixes (Albert Chin), python on Solaris
-    (Ben Phillips)</li>
+  <li>bug fixes: Result Value Tree handling, XML IDs, keys(), extra
+    namespacedeclarations with xsl:elements.</li>
+  <li>portability: python and trio fixes (Albert Chin), python on Solaris(Ben
+    Phillips)</li>
 </ul><h3>1.0.28: Mar 24 2003</h3><ul><li>fixed node() in patterns semantic.</li>
   <li>fixed a memory access problem in format-number()</li>
   <li>fixed stack overflow in recursive global variable or params</li>
-  <li>cleaned up Result Value Tree handling, and fixed a couple of old bugs
-    in the process</li>
-</ul><h3>1.0.27: Feb 24 2003</h3><ul><li>bug fixes: spurious xmlns:nsX="" generation, serialization bug (in
-    libxml2), a namespace copy problem, errors in the RPM spec prereqs</li>
+  <li>cleaned up Result Value Tree handling, and fixed a couple of old bugsin
+    the process</li>
+</ul><h3>1.0.27: Feb 24 2003</h3><ul><li>bug fixes: spurious xmlns:nsX="" generation, serialization bug
+    (inlibxml2), a namespace copy problem, errors in the RPM spec prereqs</li>
   <li>Windows path canonicalization and document cache fix (Igor)</li>
-</ul><h3>1.0.26: Feb 10 2003</h3><ul><li>Fixed 3 serious bugs in document() and stylesheet compilation which
-    could lead to a crash</li>
-</ul><h3>1.0.25: Feb 5 2003</h3><ul><li>Bug fix: double-free for standalone stylesheets introduced in 1.0.24, C
-    syntax pbm, 3 bugs reported by Eric van der Vlist</li>
-  <li>Some XPath and XInclude related problems were actually fixed in
-    libxml2-2.5.2</li>
+</ul><h3>1.0.26: Feb 10 2003</h3><ul><li>Fixed 3 serious bugs in document() and stylesheet compilation
+    whichcould lead to a crash</li>
+</ul><h3>1.0.25: Feb 5 2003</h3><ul><li>Bug fix: double-free for standalone stylesheets introduced in 1.0.24,
+    Csyntax pbm, 3 bugs reported by Eric van der Vlist</li>
+  <li>Some XPath and XInclude related problems were actually fixed
+    inlibxml2-2.5.2</li>
   <li>Documentation: emphasize taht --docbook is not for XML docs.</li>
-</ul><h3>1.0.24: Jan 14 2003</h3><ul><li>bug fixes: imported global varables, python bindings (Stéphane Bidoul),
-    EXSLT memory leak (Charles Bozeman), namespace generation on
-    xsl:attribute, space handling with imports (Daniel Stodden),
-    extension-element-prefixes (Josh Parsons), comments within xsl:text (Matt
-    Sergeant), superfluous xmlns generation, XInclude related bug for
-    numbering, EXSLT strings (Alexey Efimov), attribute-sets computation on
-    imports, extension module init and shutdown callbacks not called</li>
-  <li>HP-UX portability (Alexey Efimov), Windows makefiles (Igor and Stephane
-    Bidoul), VMS makefile updates (Craig A. Berry)</li>
+</ul><h3>1.0.24: Jan 14 2003</h3><ul><li>bug fixes: imported global varables, python bindings (Stéphane
+    Bidoul),EXSLT memory leak (Charles Bozeman), namespace generation
+    onxsl:attribute, space handling with imports (Daniel
+    Stodden),extension-element-prefixes (Josh Parsons), comments within
+    xsl:text (MattSergeant), superfluous xmlns generation, XInclude related
+    bug fornumbering, EXSLT strings (Alexey Efimov), attribute-sets
+    computation onimports, extension module init and shutdown callbacks not
+    called</li>
+  <li>HP-UX portability (Alexey Efimov), Windows makefiles (Igor and
+    StephaneBidoul), VMS makefile updates (Craig A. Berry)</li>
   <li>adds xsltGetProfileInformation() (Michael Rothwell)</li>
   <li>fix the API generation scripts</li>
   <li>API to provide the sorting routines (Richard Jinks)</li>
@@ -244,31 +252,31 @@
   <li>document() now support fragment identifiers in URIs</li>
 </ul><h3>1.0.23: Nov 17 2002</h3><ul><li>Windows build cleanup (Igor)</li>
   <li>Unix build and RPM packaging cleanup</li>
-  <li>Improvement of the python bindings: extension functions and activating
-    EXSLT</li>
-  <li>various bug fixes: number formatting, portability for bounded string
-    functions, CData nodes, key(), @*[...] patterns</li>
+  <li>Improvement of the python bindings: extension functions and
+    activatingEXSLT</li>
+  <li>various bug fixes: number formatting, portability for bounded
+    stringfunctions, CData nodes, key(), @*[...] patterns</li>
   <li>Documentation improvements (John Fleck)</li>
   <li>added libxslt.m4 (Thomas Schraitle)</li>
 </ul><h3>1.0.22: Oct 18 2002</h3><ul><li>Updates on the Windows Makefiles</li>
-  <li>Added a security module, and a related set of new options to
-  xsltproc</li>
+  <li>Added a security module, and a related set of new options
+  toxsltproc</li>
   <li>Allowed per transformation error handler.</li>
-  <li>Fixed a few bugs: node() semantic, URI escaping, media-type, attribute
-    lists</li>
-</ul><h3>1.0.21: Sep 26 2002</h3><ul><li>Bug fixes: match="node()", date:difference() (Igor and Charlie
-    Bozeman), disable-output-escaping</li>
+  <li>Fixed a few bugs: node() semantic, URI escaping, media-type,
+    attributelists</li>
+</ul><h3>1.0.21: Sep 26 2002</h3><ul><li>Bug fixes: match="node()", date:difference() (Igor and CharlieBozeman),
+    disable-output-escaping</li>
   <li>Python bindings: style.saveResultToString() from Ralf Mattes</li>
   <li>Logos from Marc Liyanage</li>
   <li>Mem leak fix from Nathan Myers</li>
-  <li>Makefile: DESTDIR fix from Christophe Merlet, AMD x86_64 (Mandrake),
-    Windows (Igor), Python detection</li>
+  <li>Makefile: DESTDIR fix from Christophe Merlet, AMD x86_64
+    (Mandrake),Windows (Igor), Python detection</li>
   <li>Documentation improvements: John Fleck</li>
 </ul><h3>1.0.20: Aug 23 2002</h3><ul><li>Windows makefile updates (Igor) and x86-64 (Frederic Crozat)</li>
   <li>fixed HTML meta tag saving for Mac/IE users</li>
   <li>possible leak patches from Nathan Myers</li>
-  <li>try to handle document('') as best as possible depending in the
-  cases</li>
+  <li>try to handle document('') as best as possible depending in
+  thecases</li>
   <li>Fixed the DocBook stylesheets handling problem</li>
   <li>Fixed a few XSLT reported errors</li>
 </ul><h3>1.0.19:  July 6 2002</h3><ul><li>EXSLT: dynamic functions and date support bug fixes (Mark Vakoc)</li>
@@ -277,89 +285,84 @@
   <li>document('') fix: bug pointed by Eric van der Vlist</li>
   <li>xsl:message with terminate="yes" fixes: William Brack</li>
   <li>xsl:sort order support added: Ken Neighbors</li>
-  <li>a few other bug fixes, some of them requiring the latest version of
-    libxml2</li>
-</ul><h3>1.0.18: May 27 2002</h3><ul><li>a number of bug fixes: attributes, extra namespace declarations
-    (DocBook), xsl:include crash (Igor), documentation (Christian Cornelssen,
-    Charles Bozeman and Geert Kloosterman),  element-available (Richard
-  Jinks)</li>
-  <li>xsltproc can now list teh registered extensions thanks to Mark
-  Vakoc</li>
-  <li>there is a new API to save directly to a string
-    xsltSaveResultToString() by Morus Walter</li>
+  <li>a few other bug fixes, some of them requiring the latest version
+    oflibxml2</li>
+</ul><h3>1.0.18: May 27 2002</h3><ul><li>a number of bug fixes: attributes, extra namespace
+    declarations(DocBook), xsl:include crash (Igor), documentation (Christian
+    Cornelssen,Charles Bozeman and Geert Kloosterman),  element-available
+    (RichardJinks)</li>
+  <li>xsltproc can now list teh registered extensions thanks to MarkVakoc</li>
+  <li>there is a new API to save directly to a stringxsltSaveResultToString()
+    by Morus Walter</li>
   <li>specific error registration function for the python API</li>
-</ul><h3>1.0.17: April 29 2002</h3><ul><li>cleanup in code, XSLT debugger support and Makefiles for Windows by
-  Igor</li>
+</ul><h3>1.0.17: April 29 2002</h3><ul><li>cleanup in code, XSLT debugger support and Makefiles for Windows
+  byIgor</li>
   <li>a C++ portability fix by Mark Vakoc</li>
   <li>EXSLT date improvement and regression tests by Charles Bozeman</li>
   <li>attempt to fix a bug in xsltProcessUserParamInternal</li>
-</ul><h3>1.0.16: April 15 2002</h3><ul><li>Bug fixes: strip-space, URL in HTML output, error when xsltproc can't
-    save</li>
+</ul><h3>1.0.16: April 15 2002</h3><ul><li>Bug fixes: strip-space, URL in HTML output, error when xsltproc
+    can'tsave</li>
   <li>portability fixes: OSF/1, IEEE on alphas, Windows, Python bindings</li>
-</ul><h3>1.0.15: Mar 25 2002</h3><ul><li>Bugfixes: XPath, python Makefile, recursive attribute sets, @foo[..]
-    templates</li>
+</ul><h3>1.0.15: Mar 25 2002</h3><ul><li>Bugfixes: XPath, python Makefile, recursive attribute sets,
+    @foo[..]templates</li>
   <li>Debug of memory alocation with valgind</li>
-  <li>serious profiling leading to significant improvement for DocBook
-    processing</li>
+  <li>serious profiling leading to significant improvement for
+    DocBookprocessing</li>
   <li>revamp of the Windows build</li>
 </ul><h3>1.0.14: Mar 18 2002</h3><ul><li>Improvement in the XPath engine (libxml2-2.4.18)</li>
   <li>Nasty bug fix related to exslt:node-set</li>
-  <li>Fixed the python Makefiles, cleanup of doc comments, Windows
-    portability fixes</li>
+  <li>Fixed the python Makefiles, cleanup of doc comments, Windowsportability
+    fixes</li>
 </ul><h3>1.0.13: Mar 8 2002</h3><ul><li>a number of bug fixes including "namespace node have no parents"</li>
   <li>Improvement of the Python bindings</li>
-  <li>Charles Bozeman provided fixes and regression tests for exslt date
-    functions.</li>
+  <li>Charles Bozeman provided fixes and regression tests for exslt
+    datefunctions.</li>
 </ul><h3>1.0.12: Feb 11 2002</h3><ul><li>Fixed the makefiles especially the python module ones</li>
   <li>half a dozen bugs fixes including 2 old ones</li>
-</ul><h3>1.0.11: Feb 8 2002</h3><ul><li>Change of Licence to the <a href="http://www.opensource.org/licenses/mit-license.html">MIT
-  Licence</a></li>
-  <li>Added a beta version of the Python bindings, including support to
-    extend the engine with functions written in Python</li>
+</ul><h3>1.0.11: Feb 8 2002</h3><ul><li>Change of Licence to the <a href="http://www.opensource.org/licenses/mit-license.html">MITLicence</a></li>
+  <li>Added a beta version of the Python bindings, including support toextend
+    the engine with functions written in Python</li>
   <li>A number of bug fixes</li>
   <li>Charlie Bozeman provided more EXSLT functions</li>
   <li>Portability fixes</li>
 </ul><h3>1.0.10: Jan 14 2002</h3><ul><li>Windows fixes for Win32 from Igor</li>
   <li>Fixed the Solaris compilation trouble (Albert)</li>
   <li>Documentation changes and updates: John Fleck</li>
-  <li>Added a stringparam option to avoid escaping hell at the shell
-  level</li>
+  <li>Added a stringparam option to avoid escaping hell at the shelllevel</li>
   <li>A few bug fixes</li>
 </ul><h3>1.0.9: Dec 7 2001</h3><ul><li>Makefile patches from Peter Williams</li>
   <li>attempt to fix the compilation problem associated to prelinking</li>
   <li>obsoleted libxsltbreakpoint now deprecated and frozen to 1.0.8 API</li>
-  <li>xsltproc return codes are now significant, John Fleck updated the
-    documentation</li>
-  <li>patch to allow as much as 40 steps in patterns (Marc Tardif), should be
-    made dynamic really</li>
-  <li>fixed a bug raised by Nik Clayton when using doctypes with HTML
-  output</li>
+  <li>xsltproc return codes are now significant, John Fleck updated
+    thedocumentation</li>
+  <li>patch to allow as much as 40 steps in patterns (Marc Tardif), should
+    bemade dynamic really</li>
+  <li>fixed a bug raised by Nik Clayton when using doctypes with
+  HTMLoutput</li>
   <li>patches from Keith Isdale to interface with xsltdebugger</li>
-</ul><h3>1.0.8: Nov 26 2001</h3><ul><li>fixed an annoying header problem, removed a few bugs and some code
-    cleanup</li>
+</ul><h3>1.0.8: Nov 26 2001</h3><ul><li>fixed an annoying header problem, removed a few bugs and some
+    codecleanup</li>
   <li>patches for Windows and update of Windows Makefiles by Igor</li>
   <li>OpenVMS port instructions from John A Fotheringham</li>
-  <li>fixed some Makefiles annoyance and libraries prelinking
-  informations</li>
+  <li>fixed some Makefiles annoyance and libraries prelinkinginformations</li>
 </ul><h3>1.0.7: Nov 10 2001</h3><ul><li>remove a compilation problem with LIBXSLT_PUBLIC</li>
   <li>Finishing the integration steps for Keith Isdale debugger</li>
   <li>fixes the handling of indent="no" on HTML output</li>
   <li>fixes on the configure script and RPM spec file</li>
-</ul><h3>1.0.6: Oct 30 2001</h3><ul><li>bug fixes on number formatting (Thomas), date/time functions (Bruce
-    Miller)</li>
+</ul><h3>1.0.6: Oct 30 2001</h3><ul><li>bug fixes on number formatting (Thomas), date/time functions
+    (BruceMiller)</li>
   <li>update of the Windows Makefiles (Igor)</li>
   <li>fixed DOCTYPE generation rules for HTML output (me)</li>
-</ul><h3>1.0.5: Oct 10 2001</h3><ul><li>some portability fixes, including Windows makefile updates from
-  Igor</li>
+</ul><h3>1.0.5: Oct 10 2001</h3><ul><li>some portability fixes, including Windows makefile updates fromIgor</li>
   <li>fixed a dozen bugs on XSLT and EXSLT (me and Thomas Broyer)</li>
-  <li>support for Saxon's evaluate and expressions extensions added (initial
-    contribution from Darren Graves)</li>
+  <li>support for Saxon's evaluate and expressions extensions added
+    (initialcontribution from Darren Graves)</li>
   <li>better handling of XPath evaluation errors</li>
 </ul><h3>1.0.4: Sep 12 2001</h3><ul><li>Documentation updates from John fleck</li>
-  <li>bug fixes (DocBook  FO generation should be fixed)  and portability
-    improvements</li>
-  <li>Thomas Broyer improved the existing EXSLT support and added String,
-    Time and Date core functions support</li>
+  <li>bug fixes (DocBook  FO generation should be fixed)  and
+    portabilityimprovements</li>
+  <li>Thomas Broyer improved the existing EXSLT support and added String,Time
+    and Date core functions support</li>
 </ul><h3>1.0.3:  Aug 23 2001</h3><ul><li>XML Catalog support see the doc</li>
   <li>New NaN/Infinity floating point code</li>
   <li>A few bug fixes</li>
@@ -374,45 +377,44 @@
   <li>fixed the profiler on Windows</li>
   <li>bug fixes</li>
 </ul><h3>1.0.0: July 10 2001</h3><ul><li>a lot of cleanup, a lot of regression tests added or fixed</li>
-  <li>added a documentation for <a href="extensions.html">writing
-    extensions</a></li>
+  <li>added a documentation for <a href="extensions.html">writingextensions</a></li>
   <li>fixed some variable evaluation problems (with William)</li>
-  <li>added profiling of stylesheet execution accessible as the xsltproc
-    --profile option</li>
-  <li>fixed element-available() and the implementation of the various
-    chunking methods present, Norm Walsh provided a lot of feedback</li>
-  <li>exclude-result-prefixes and namespaces output should now work as
-    expected</li>
-  <li>added support of embedded stylesheet as described in section 2.7 of the
-    spec</li>
+  <li>added profiling of stylesheet execution accessible as the
+    xsltproc--profile option</li>
+  <li>fixed element-available() and the implementation of the variouschunking
+    methods present, Norm Walsh provided a lot of feedback</li>
+  <li>exclude-result-prefixes and namespaces output should now work
+  asexpected</li>
+  <li>added support of embedded stylesheet as described in section 2.7 of
+    thespec</li>
 </ul><h3>0.14.0: July 5 2001</h3><ul><li>lot of bug fixes, and code cleanup</li>
   <li>completion of the little XSLT-1.0 features left unimplemented</li>
   <li>Added and implemented the extension API suggested by Thomas Broyer</li>
   <li>the Windows MSC environment should be complete</li>
-  <li>tested and optimized with a really large document (DocBook Definitive
-    Guide) libxml/libxslt should really be faster on serious workloads</li>
+  <li>tested and optimized with a really large document (DocBook
+    DefinitiveGuide) libxml/libxslt should really be faster on serious
+    workloads</li>
 </ul><h3>0.13.0: June 26 2001</h3><ul><li>lots of cleanups</li>
   <li>fixed a C++ compilation problem</li>
   <li>couple of fixes to xsltSaveTo()</li>
-  <li>try to fix Docbook-xslt-1.4 and chunking, updated the regression test
-    with them</li>
+  <li>try to fix Docbook-xslt-1.4 and chunking, updated the regression
+    testwith them</li>
   <li>fixed pattern compilation and priorities problems</li>
   <li>Patches for Windows and MSC project mostly contributed by Yon Derek</li>
   <li>update to the Tutorial by John Fleck</li>
   <li>William fixed bugs in templates and for-each functions</li>
-  <li>added a new interface xsltRunStylesheet() for a more flexible output
-    (incomplete), added -o option to xsltproc</li>
+  <li>added a new interface xsltRunStylesheet() for a more flexible
+    output(incomplete), added -o option to xsltproc</li>
 </ul><h3>0.12.0: June 18 2001</h3><ul><li>fixed a dozen of bugs reported</li>
-  <li>HTML generation should be quite better (requires libxml-2.3.11 upgrade
-    too)</li>
+  <li>HTML generation should be quite better (requires libxml-2.3.11
+    upgradetoo)</li>
   <li>William fixed some problems with document()</li>
-  <li>Fix namespace nodes selection and copy (requires libxml-2.3.11 upgrade
-    too)</li>
-  <li>John Fleck added a<a href="tutorial/libxslttutorial.html">
-  tutorial</a></li>
+  <li>Fix namespace nodes selection and copy (requires libxml-2.3.11
+    upgradetoo)</li>
+  <li>John Fleck added a<a href="tutorial/libxslttutorial.html">tutorial</a></li>
   <li>Fixes for namespace handling when evaluating variables</li>
-  <li>XInclude global flag added to process XInclude on document() if
-    requested</li>
+  <li>XInclude global flag added to process XInclude on document()
+  ifrequested</li>
   <li>made xsltproc --version more detailed</li>
 </ul><h3>0.11.0: June 1 2001</h3><p>Mostly a bug fix release.</p><ul><li>integration of catalogs from xsltproc</li>
   <li>added --version to xsltproc for bug reporting</li>
@@ -422,8 +424,8 @@
   <li>William fixed the XPath string functions when using unicode</li>
 </ul><h3>0.10.0: May 19 2001</h3><ul><li>cleanups to make stylesheet read-only (not 100% complete)</li>
   <li>fixed URI resolution in document()</li>
-  <li>force all XPath expression to be compiled at stylesheet parsing time,
-    even if unused ...</li>
+  <li>force all XPath expression to be compiled at stylesheet parsing
+    time,even if unused ...</li>
   <li>Fixed HTML default output detection</li>
   <li>Fixed double attribute generation #54446</li>
   <li>Fixed {{ handling in attributes #54451</li>
@@ -433,25 +435,25 @@
   <li>William Brack and Bjorn Reese improved format-number()</li>
   <li>Fixed multiple sort, it should really work now</li>
   <li>added a --docbook option for SGML DocBook input (hackish)</li>
-  <li>a number of other bug fixes and regression test added as people were
-    submitting them</li>
+  <li>a number of other bug fixes and regression test added as people
+    weresubmitting them</li>
 </ul><h3>0.9.0: May 3 2001</h3><ul><li>lot of various bugfixes, extended the regression suite</li>
   <li>xsltproc should work with multiple params</li>
   <li>added an option to use xsltproc with HTML input</li>
-  <li>improved the stylesheet compilation, processing of complex stylesheets
-    should be faster</li>
-  <li>using the same stylesheet for concurrent processing on multithreaded
-    programs should work now</li>
+  <li>improved the stylesheet compilation, processing of complex
+    stylesheetsshould be faster</li>
+  <li>using the same stylesheet for concurrent processing on
+    multithreadedprograms should work now</li>
   <li>fixed another batch of namespace handling problems</li>
   <li>Implemented multiple level of sorting</li>
 </ul><h3>0.8.0: Apr 22 2001</h3><ul><li>fixed ansidecl.h problem</li>
   <li>fixed unparsed-entity-uri() and generate-id()</li>
   <li>sort semantic fixes and priority prob from William M. Brack</li>
-  <li>fixed namespace handling problems in XPath expression computations
-    (requires libxml-2.3.7)</li>
+  <li>fixed namespace handling problems in XPath expression
+    computations(requires libxml-2.3.7)</li>
   <li>fixes to current() and key()</li>
-  <li>other, smaller fixes, lots of testing with N Walsh DocBook HTML
-    stylesheets</li>
+  <li>other, smaller fixes, lots of testing with N Walsh DocBook
+    HTMLstylesheets</li>
 </ul><h3>0.7.0: Apr 10 2001</h3><ul><li>cleanup using stricter compiler flags</li>
   <li>command line parameter passing</li>
   <li>fix to xsltApplyTemplates from William M. Brack</li>
@@ -461,13 +463,13 @@
   <li>document() extension should function properly</li>
   <li>fixed a number or reported bugs</li>
 </ul><h3>0.5.0: Mar 10 2001</h3><ul><li>fifth beta</li>
-  <li>some optimization work, for the moment 2 XSLT transform cannot use the
-    same stylesheet at the same time (to be fixed)</li>
+  <li>some optimization work, for the moment 2 XSLT transform cannot use
+    thesame stylesheet at the same time (to be fixed)</li>
   <li>fixed problems with handling of tree results</li>
   <li>fixed a reported strip-spaces problem</li>
   <li>added more reported/fixed bugs to the test suite</li>
-  <li>incorporated William M. Brack fix for imports and global variables as
-    well as patch for with-param support in apply-templates</li>
+  <li>incorporated William M. Brack fix for imports and global variables
+    aswell as patch for with-param support in apply-templates</li>
   <li>a bug fix on for-each</li>
 </ul><h3>0.4.0: Mar 1 2001</h3><ul><li>fourth beta test, released at the same time of libxml2-2.3.3</li>
   <li>bug fixes</li>
@@ -479,17 +481,17 @@
   <li>some optimization</li>
   <li>added DocBook XSL based testsuite</li>
 </ul><h3>0.2.0: Feb 15 2001</h3><ul><li>second beta version, released at the same time as libxml2-2.3.1</li>
-  <li>getting close to feature completion, lot of bug fixes, some in the HTML
-    and XPath support of libxml</li>
-  <li>start becoming usable for real work. This version can now regenerate
-    the XML 2e HTML from the original XML sources and the associated
-    stylesheets (in <a href="http://www.w3.org/TR/REC-xml#b4d250b6c21">section I of the XML
-    REC</a>)</li>
-  <li>Still misses extension element/function/prefixes support. Support of
-    key() and document() is not complete</li>
+  <li>getting close to feature completion, lot of bug fixes, some in the
+    HTMLand XPath support of libxml</li>
+  <li>start becoming usable for real work. This version can now regeneratethe
+    XML 2e HTML from the original XML sources and the associatedstylesheets
+    (in <a href="http://www.w3.org/TR/REC-xml#b4d250b6c21">section I of the
+    XMLREC</a>)</li>
+  <li>Still misses extension element/function/prefixes support. Support
+    ofkey() and document() is not complete</li>
 </ul><h3>0.1.0: Feb 8 2001</h3><ul><li>first beta version, released at the same time as libxml2-2.3.0</li>
   <li>lots of bug fixes, first "testing" version, but incomplete</li>
 </ul><h3>0.0.1: Jan 25 2001</h3><ul><li>first alpha version released at the same time as libxml2-2.2.12</li>
-  <li>Framework in place, should work on simple examples, but far from being
-    feature complete</li>
+  <li>Framework in place, should work on simple examples, but far from
+    beingfeature complete</li>
 </ul><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/python.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/python.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/python.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,56 +8,52 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>Python and bindings</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>Python and bindings</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>There is a number of language bindings and wrappers available for libxml2,
-the list below is not exhaustive. Please contact the <a href="http://mail.gnome.org/mailman/listinfo/xml-bindings">xml-bindings at gnome.org</a>
-(<a href="http://mail.gnome.org/archives/xml-bindings/">archives</a>) in
-order to get updates to this list or to discuss the specific topic of libxml2
-or libxslt wrappers or bindings:</p><ul><li><a href="http://mail.gnome.org/archives/xml/2001-March/msg00014.html">Matt
-    Sergeant</a> developped <a href="http://axkit.org/download/">XML::LibXML
-    and XML::LibXSLT</a>, Perl wrappers for libxml2/libxslt as part of the <a href="http://axkit.com/">AxKit XML application server</a></li>
-  <li><a href="mailto:dkuhlman at cutter.rexx.com">Dave Kuhlman</a> provides and
-    earlier version of the libxml/libxslt <a href="http://www.rexx.com/~dkuhlman">wrappers for Python</a></li>
-  <li>Petr Kozelka provides <a href="http://sourceforge.net/projects/libxml2-pas">Pascal units to glue
-    libxml2</a> with Kylix, Delphi and other Pascal compilers</li>
-  <li>Wai-Sun "Squidster" Chia provides <a href="http://www.rubycolor.org/arc/redist/">bindings for Ruby</a>  and
-    libxml2 bindings are also available in Ruby through the <a href="http://libgdome-ruby.berlios.de/">libgdome-ruby</a> module
-    maintained by Tobias Peters.</li>
-  <li>Steve Ball and contributors maintains <a href="http://tclxml.sourceforge.net/">libxml2 and libxslt bindings for
-    Tcl</a></li>
-  <li><a href="mailto:xmlwrapp at pmade.org">Peter Jones</a> maintains C++
-    bindings for libxslt within <a href="http://pmade.org/pjones/software/xmlwrapp/">xmlwrapp</a></li>
-  <li><a href="phillim2 at comcast.net">Mike Phillips</a> provides a module
-    using <a href="http://siasl.dyndns.org/projects/projects.html">libxslt
-    for PHP</a>.</li>
-  <li><a href="http://savannah.gnu.org/projects/classpathx/">LibxmlJ</a> is
-    an effort to create a 100% JAXP-compatible Java wrapper for libxml2 and
-    libxslt as part of GNU ClasspathX project.</li>
-  <li>Patrick McPhee provides Rexx bindings fof libxml2 and libxslt, look for
-    <a href="http://www.interlog.com/~ptjm/software.html">RexxXML</a>.</li>
-  <li><a href="http://www.satimage.fr/software/en/xml_suite.html">Satimage</a>
-    provides <a href="http://www.satimage.fr/software/en/downloads_osaxen.html">XMLLib
-    osax</a>. This is an osax for Mac OS X with a set of commands to
-    implement in AppleScript the XML DOM, XPATH and XSLT.</li>
-</ul><p>The libxslt Python module depends on the <a href="http://xmlsoft.org/python.html">libxml2 Python</a> module.</p><p>The distribution includes a set of Python bindings, which are garanteed to
-be maintained as part of the library in the future, though the Python
-interface have not yet reached the completeness of the C API.</p><p><a href="mailto:stephane.bidoul at softwareag.com">Stéphane Bidoul</a>
-maintains <a href="http://users.skynet.be/sbi/libxml-python/">a Windows port
-of the Python bindings</a>.</p><p>Note to people interested in building bindings, the API is formalized as
-<a href="libxslt-api.xml">an XML API description file</a> which allows to
-automate a large part of the Python bindings, this includes function
-descriptions, enums, structures, typedefs, etc... The Python script used to
-build the bindings is python/generator.py in the source distribution.</p><p>To install the Python bindings there are 2 options:</p><ul><li>If you use an RPM based distribution, simply install the <a href="http://rpmfind.net/linux/rpm2html/search.php?query=libxml2-python">libxml2-python
-    RPM</a> and the <a href="http://rpmfind.net/linux/rpm2html/search.php?query=libxslt-python">libxslt-python
-    RPM</a>.</li>
-  <li>Otherwise use the <a href="ftp://xmlsoft.org/libxml2/python/">libxml2-python
-    module distribution</a> corresponding to your installed version of
-    libxml2 and libxslt. Note that to install it you will need both libxml2
-    and libxslt installed and run "python setup.py build install" in the
-    module tree.</li>
-</ul><p>The distribution includes a set of examples and regression tests for the
-python bindings in the <code>python/tests</code> directory. Here are some
-excepts from those tests:</p><h3>basic.py:</h3><p>This is a basic test of XSLT interfaces: loading a stylesheet and a
-document, transforming the document and saving the result.</p><pre>import libxml2
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>There is a number of language bindings and wrappers available for
+libxml2,the list below is not exhaustive. Please contact the <a href="http://mail.gnome.org/mailman/listinfo/xml-bindings">xml-bindings at gnome.org</a>(<a href="http://mail.gnome.org/archives/xml-bindings/">archives</a>) inorder to
+get updates to this list or to discuss the specific topic of libxml2or
+libxslt wrappers or bindings:</p><ul><li><a href="http://mail.gnome.org/archives/xml/2001-March/msg00014.html">MattSergeant</a>developped
+    <a href="http://axkit.org/download/">XML::LibXMLand XML::LibXSLT</a>,
+    Perl wrappers for libxml2/libxslt as part of the <a href="http://axkit.com/">AxKit XML application server</a></li>
+  <li><a href="mailto:dkuhlman at cutter.rexx.com">Dave Kuhlman</a>provides
+    andearlier version of the libxml/libxslt <a href="http://www.rexx.com/~dkuhlman">wrappers for Python</a></li>
+  <li>Petr Kozelka provides <a href="http://sourceforge.net/projects/libxml2-pas">Pascal units to
+    gluelibxml2</a>with Kylix, Delphi and other Pascal compilers</li>
+  <li>Wai-Sun "Squidster" Chia provides <a href="http://www.rubycolor.org/arc/redist/">bindings for
+    Ruby</a>andlibxml2 bindings are also available in Ruby through the <a href="http://libgdome-ruby.berlios.de/">libgdome-ruby</a>modulemaintained
+    by Tobias Peters.</li>
+  <li>Steve Ball and contributors maintains <a href="http://tclxml.sourceforge.net/">libxml2 and libxslt bindings
+    forTcl</a></li>
+  <li><a href="mailto:xmlwrapp at pmade.org">Peter Jones</a>maintains
+    C++bindings for libxslt within <a href="http://pmade.org/pjones/software/xmlwrapp/">xmlwrapp</a></li>
+  <li><a href="phillim2 at comcast.net">Mike Phillips</a>provides a moduleusing
+    <a href="http://siasl.dyndns.org/projects/projects.html">libxsltfor
+    PHP</a>.</li>
+  <li><a href="http://savannah.gnu.org/projects/classpathx/">LibxmlJ</a>isan
+    effort to create a 100% JAXP-compatible Java wrapper for libxml2
+    andlibxslt as part of GNU ClasspathX project.</li>
+  <li>Patrick McPhee provides Rexx bindings fof libxml2 and libxslt, look
+    for<a href="http://www.interlog.com/~ptjm/software.html">RexxXML</a>.</li>
+  <li><a href="http://www.satimage.fr/software/en/xml_suite.html">Satimage</a>provides
+    <a href="http://www.satimage.fr/software/en/downloads_osaxen.html">XMLLibosax</a>.
+    This is an osax for Mac OS X with a set of commands toimplement in
+    AppleScript the XML DOM, XPATH and XSLT.</li>
+</ul><p>The libxslt Python module depends on the <a href="http://xmlsoft.org/python.html">libxml2 Python</a>module.</p><p>The distribution includes a set of Python bindings, which are garanteed
+tobe maintained as part of the library in the future, though the
+Pythoninterface have not yet reached the completeness of the C API.</p><p><a href="mailto:stephane.bidoul at softwareag.com">Stéphane
+Bidoul</a>maintains <a href="http://users.skynet.be/sbi/libxml-python/">a
+Windows portof the Python bindings</a>.</p><p>Note to people interested in building bindings, the API is formalized as<a href="libxslt-api.xml">an XML API description file</a>which allows toautomate
+a large part of the Python bindings, this includes functiondescriptions,
+enums, structures, typedefs, etc... The Python script used tobuild the
+bindings is python/generator.py in the source distribution.</p><p>To install the Python bindings there are 2 options:</p><ul><li>If you use an RPM based distribution, simply install the <a href="http://rpmfind.net/linux/rpm2html/search.php?query=libxml2-python">libxml2-pythonRPM</a>and
+    the <a href="http://rpmfind.net/linux/rpm2html/search.php?query=libxslt-python">libxslt-pythonRPM</a>.</li>
+  <li>Otherwise use the <a href="ftp://xmlsoft.org/libxml2/python/">libxml2-pythonmodule
+    distribution</a>corresponding to your installed version oflibxml2 and
+    libxslt. Note that to install it you will need both libxml2and libxslt
+    installed and run "python setup.py build install" in themodule tree.</li>
+</ul><p>The distribution includes a set of examples and regression tests for
+thepython bindings in the <code>python/tests</code>directory. Here are
+someexcepts from those tests:</p><h3>basic.py:</h3><p>This is a basic test of XSLT interfaces: loading a stylesheet and
+adocument, transforming the document and saving the result.</p><pre>import libxml2
 import libxslt
 
 styledoc = libxml2.parseFile("test.xsl")
@@ -67,28 +63,28 @@
 style.saveResultToFilename("foo", result, 0)
 style.freeStylesheet()
 doc.freeDoc()
-result.freeDoc()</pre><p>The Python module is called libxslt, you will also need the libxml2 module
-for the operations on XML trees. Let's have a look at the objects manipulated
-in that example and how is the processing done:</p><ul><li><code>styledoc</code> : is a libxml2 document tree. It is obtained by
-    parsing the XML file "test.xsl" containing the stylesheet.</li>
-  <li><code>style</code> : this is a precompiled stylesheet ready to be used
-    by the following transformations (note the plural form, multiple
-    transformations can resuse the same stylesheet).</li>
-  <li><code>doc</code> : this is the document to apply the transformation to.
-    In this case it is simply generated by parsing it from a file but any
-    other processing is possible as long as one get a libxml2 Doc. Note that
-    HTML tree are suitable for XSLT processing in libxslt. This is actually
-    how this page is generated !</li>
-  <li><code>result</code> : this is a document generated by applying the
-    stylesheet to the document. Note that some of the stylesheet informations
-    may be related to the serialization of that document and as in this
-    example a specific saveResultToFilename() method of the stylesheet should
-    be used to save it to a file (in that case to "foo").</li>
-</ul><p>Also note the need to explicitely deallocate documents with freeDoc()
-except for the stylesheet document which is freed when its compiled form is
-garbage collected.</p><h3>extfunc.py:</h3><p>This one is a far more complex test. It shows how to modify the behaviour
-of an XSLT transformation by passing parameters and how to extend the XSLT
-engine with functions defined in python:</p><pre>import libxml2
+result.freeDoc()</pre><p>The Python module is called libxslt, you will also need the libxml2
+modulefor the operations on XML trees. Let's have a look at the objects
+manipulatedin that example and how is the processing done:</p><ul><li><code>styledoc</code>: is a libxml2 document tree. It is obtained
+    byparsing the XML file "test.xsl" containing the stylesheet.</li>
+  <li><code>style</code>: this is a precompiled stylesheet ready to be usedby
+    the following transformations (note the plural form,
+    multipletransformations can resuse the same stylesheet).</li>
+  <li><code>doc</code>: this is the document to apply the transformation
+    to.In this case it is simply generated by parsing it from a file but
+    anyother processing is possible as long as one get a libxml2 Doc. Note
+    thatHTML tree are suitable for XSLT processing in libxslt. This is
+    actuallyhow this page is generated !</li>
+  <li><code>result</code>: this is a document generated by applying
+    thestylesheet to the document. Note that some of the stylesheet
+    informationsmay be related to the serialization of that document and as
+    in thisexample a specific saveResultToFilename() method of the stylesheet
+    shouldbe used to save it to a file (in that case to "foo").</li>
+</ul><p>Also note the need to explicitely deallocate documents with
+freeDoc()except for the stylesheet document which is freed when its compiled
+form isgarbage collected.</p><h3>extfunc.py:</h3><p>This one is a far more complex test. It shows how to modify the
+behaviourof an XSLT transformation by passing parameters and how to extend
+the XSLTengine with functions defined in python:</p><pre>import libxml2
 import libxslt
 import string
 
@@ -109,20 +105,20 @@
 
     return string.upper(str)
 
-libxslt.registerExtModuleFunction("foo", "http://example.com/foo", f)</pre><p>This code defines and register an extension function. Note that the
-function can be bound to any name (foo) and how the binding is also
-associated to a namespace name "http://example.com/foo". From an XSLT point
-of view the function just returns an upper case version of the string passed
-as a parameter. But the first part of the function also read some contextual
-information from the current XSLT processing environement, in that case it
-looks for the current insertion node in the resulting output (either the
-resulting document or the Result Value Tree being generated), and saves it to
-a global variable for checking that the access actually worked.</p><p>For more informations on the xpathParserContext and transformContext
-objects check the <a href="internals.html">libray internals description</a>.
-The pctxt is actually an object from a class derived from the
-libxml2.xpathParserContext() with just a couple more properties including the
-possibility to look up the XSLT transformation context from the XPath
-context.</p><pre>styledoc = libxml2.parseDoc("""
+libxslt.registerExtModuleFunction("foo", "http://example.com/foo", f)</pre><p>This code defines and register an extension function. Note that
+thefunction can be bound to any name (foo) and how the binding is
+alsoassociated to a namespace name "http://example.com/foo". From an XSLT
+pointof view the function just returns an upper case version of the string
+passedas a parameter. But the first part of the function also read some
+contextualinformation from the current XSLT processing environement, in that
+case itlooks for the current insertion node in the resulting output (either
+theresulting document or the Result Value Tree being generated), and saves it
+toa global variable for checking that the access actually worked.</p><p>For more informations on the xpathParserContext and
+transformContextobjects check the <a href="internals.html">libray internals
+description</a>.The pctxt is actually an object from a class derived from
+thelibxml2.xpathParserContext() with just a couple more properties including
+thepossibility to look up the XSLT transformation context from the
+XPathcontext.</p><pre>styledoc = libxml2.parseDoc("""
 &lt;xsl:stylesheet version='1.0'
   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
   xmlns:foo='http://example.com/foo'
@@ -133,21 +129,21 @@
     &lt;article&gt;&lt;xsl:value-of select='foo:foo($bar)'/&gt;&lt;/article&gt;
   &lt;/xsl:template&gt;
 &lt;/xsl:stylesheet&gt;
-""")</pre><p>Here is a simple example of how to read an XML document from a python
-string with libxml2. Note how this stylesheet:</p><ul><li>Uses a global parameter <code>bar</code></li>
+""")</pre><p>Here is a simple example of how to read an XML document from a
+pythonstring with libxml2. Note how this stylesheet:</p><ul><li>Uses a global parameter <code>bar</code></li>
   <li>Reference the extension function f</li>
-  <li>how the Namespace name "http://example.com/foo" has to be bound to a
-    prefix</li>
+  <li>how the Namespace name "http://example.com/foo" has to be bound to
+    aprefix</li>
   <li>how that prefix is excluded from the output</li>
   <li>how the function is called from the select</li>
 </ul><pre>style = libxslt.parseStylesheetDoc(styledoc)
 doc = libxml2.parseDoc("&lt;doc/&gt;")
 result = style.applyStylesheet(doc, { "bar": "'success'" })
 style.freeStylesheet()
-doc.freeDoc()</pre><p>that part is identical, to the basic example except that the
-transformation is passed a dictionnary of parameters. Note that the string
-passed "success" had to be quoted, otherwise it is interpreted as an XPath
-query for the childs of root named "success".</p><pre>root = result.children
+doc.freeDoc()</pre><p>that part is identical, to the basic example except that thetransformation
+is passed a dictionnary of parameters. Note that the stringpassed "success"
+had to be quoted, otherwise it is interpreted as an XPathquery for the childs
+of root named "success".</p><pre>root = result.children
 if root.name != "article":
     print "Unexpected root node name"
     sys.exit(1)
@@ -158,12 +154,14 @@
     print "The function callback failed to access its context"
     sys.exit(1)
 
-result.freeDoc()</pre><p>That part just verifies that the transformation worked, that the parameter
-got properly passed to the engine, that the function f() got called and that
-it properly accessed the context to find the name of the insertion node.</p><h3>pyxsltproc.py:</h3><p>this module is a bit too long to be described there but it is basically a
-rewrite of the xsltproc command line interface of libxslt in Python. It
-provides nearly all the functionalities of xsltproc and can be used as a base
-module to write Python customized XSLT processors. One of the thing to notice
-are:</p><pre>libxml2.lineNumbersDefault(1)
-libxml2.substituteEntitiesDefault(1)</pre><p>those two calls in the main() function are needed to force the libxml2
-processor to generate DOM trees compliant with the XPath data model.</p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>
+result.freeDoc()</pre><p>That part just verifies that the transformation worked, that the
+parametergot properly passed to the engine, that the function f() got called
+and thatit properly accessed the context to find the name of the insertion
+node.</p><h3>pyxsltproc.py:</h3><p>this module is a bit too long to be described there but it is basically
+arewrite of the xsltproc command line interface of libxslt in Python.
+Itprovides nearly all the functionalities of xsltproc and can be used as a
+basemodule to write Python customized XSLT processors. One of the thing to
+noticeare:</p><pre>libxml2.lineNumbersDefault(1)
+libxml2.substituteEntitiesDefault(1)</pre><p>those two calls in the main() function are needed to force the
+libxml2processor to generate DOM trees compliant with the XPath data
+model.</p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

Modified: packages/libxslt/branches/upstream/current/doc/xslt.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/xslt.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/xslt.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -3,8 +3,8 @@
 <html>
 <head>
   <title>The XSLT C library for Gnome</title>
-  <meta name="GENERATOR" content="amaya 8.5, see http://www.w3.org/Amaya/">
-  <meta http-equiv="Content-Type" content="text/html">
+  <meta name="GENERATOR" content="amaya 8.8.5, see http://www.w3.org/Amaya/">
+  <meta http-equiv="content-type" content="text/html">
 </head>
 
 <body bgcolor="#ffffff">
@@ -12,22 +12,24 @@
 
 <h1 style="text-align: center">libxslt</h1>
 
-<p>Libxslt is the <a href="http://www.w3.org/TR/xslt">XSLT</a> C library
-developed for the Gnome project. XSLT itself is a an XML language to define
-transformation for XML. Libxslt is based on <a
-href="http://xmlsoft.org/">libxml2</a> the XML C library developed for the
-Gnome project. It also implements most of the <a
-href="http://www.exslt.org/">EXSLT</a> set of processor-portable extensions
-functions and some of Saxon's evaluate and expressions extensions.</p>
+<p>Libxslt is the <a href="http://www.w3.org/TR/xslt">XSLT</a>C
+librarydeveloped for the Gnome project. XSLT itself is a an XML language to
+definetransformation for XML. Libxslt is based on <a
+href="http://xmlsoft.org/">libxml2</a>the XML C library developed for
+theGnome project. It also implements most of the <a
+href="http://www.exslt.org/">EXSLT</a>set of processor-portable
+extensionsfunctions and some of Saxon's evaluate and expressions
+extensions.</p>
 
-<p>People can either embed the library in their application or use xsltproc
-the command line processing tool. This library is free software and can be
-reused in commercial applications (see the <a href="intro.html">intro</a>)</p>
+<p>People can either embed the library in their application or use
+xsltprocthe command line processing tool. This library is free software and
+can bereused in commercial applications (see the <a
+href="intro.html">intro</a>)</p>
 
 <p>External documents:</p>
 <ul>
-  <li>John Fleck wrote <a href="tutorial/libxslttutorial.html">a tutorial for
-    libxslt</a></li>
+  <li>John Fleck wrote <a href="tutorial/libxslttutorial.html">a tutorial
+    forlibxslt</a></li>
   <li><a href="xsltproc.html">xsltproc user manual</a></li>
   <li><a href="http://xmlsoft.org/">the libxml documentation</a></li>
 </ul>
@@ -38,399 +40,410 @@
 
 <h2><a name="Introducti">Introduction</a></h2>
 
-<p>This document describes <a href="http://xmlsoft.org/XSLT/">libxslt</a>,
-the <a href="http://www.w3.org/TR/xslt">XSLT</a> C library developed for the
-<a href="http://www.gnome.org/">Gnome</a> project.</p>
+<p>This document describes <a href="http://xmlsoft.org/XSLT/">libxslt</a>,the
+<a href="http://www.w3.org/TR/xslt">XSLT</a>C library developed for the<a
+href="http://www.gnome.org/">Gnome</a>project.</p>
 
 <p>Here are some key points about libxslt:</p>
 <ul>
   <li>Libxslt is a C implementation</li>
-  <li>Libxslt is based on libxml for XML parsing, tree manipulation and XPath
-    support</li>
-  <li>It is written in plain C, making as few assumptions as possible, and
-    sticking closely to ANSI C/POSIX for easy embedding. Should works on
-    Linux/Unix/Windows.</li>
+  <li>Libxslt is based on libxml for XML parsing, tree manipulation and
+    XPathsupport</li>
+  <li>It is written in plain C, making as few assumptions as possible,
+    andsticking closely to ANSI C/POSIX for easy embedding. Should works
+    onLinux/Unix/Windows.</li>
   <li>This library is released under the <a
-    href="http://www.opensource.org/licenses/mit-license.html">MIT
-  Licence</a></li>
-  <li>Though not designed primarily with performances in mind, libxslt seems
-    to be a relatively fast processor.</li>
+    href="http://www.opensource.org/licenses/mit-license.html">MITLicence</a></li>
+  <li>Though not designed primarily with performances in mind, libxslt
+    seemsto be a relatively fast processor.</li>
 </ul>
 
 <h2><a name="Documentat">Documentation</a></h2>
 
 <p>There are some on-line resources about using libxslt:</p>
 <ol>
-  <li>Check the <a href="html/libxslt-lib.html#LIBXSLT-LIB">API
-    documentation</a> automatically extracted from code comments (using the
-    program apibuild.py, developed for libxml, together with the xsl script
-    'newapi.xsl' and the libxslt xsltproc program).</li>
-  <li>Look at the <a href="http://mail.gnome.org/archives/xslt/">mailing-list
-    archive</a>.</li>
-  <li>Of course since libxslt is based on libxml, it's a good idea to at
-    least read <a href="http://xmlsoft.org/">libxml description</a></li>
+  <li>Check the <a
+    href="html/libxslt-lib.html#LIBXSLT-LIB">APIdocumentation</a>automatically
+    extracted from code comments (using theprogram apibuild.py, developed for
+    libxml, together with the xsl script'newapi.xsl' and the libxslt xsltproc
+    program).</li>
+  <li>Look at the <a
+    href="http://mail.gnome.org/archives/xslt/">mailing-listarchive</a>.</li>
+  <li>Of course since libxslt is based on libxml, it's a good idea to atleast
+    read <a href="http://xmlsoft.org/">libxml description</a></li>
 </ol>
 
 <h2><a name="Reporting">Reporting bugs and getting help</a></h2>
 
-<p>If you need help with the XSLT language itself, here are a number of
-useful resources:</p>
+<p>If you need help with the XSLT language itself, here are a number ofuseful
+resources:</p>
 <ul>
   <li>I strongly suggest to subscribe to <a
     href="http://www.mulberrytech.com/xsl/xsl-list">XSL-list</a>, check <a
-    href="http://www.biglist.com/lists/xsl-list/archives/">the XSL-list
-    archives</a></li>
+    href="http://www.biglist.com/lists/xsl-list/archives/">the
+    XSL-listarchives</a></li>
   <li>The <a href="http://www.dpawson.co.uk/xsl/xslfaq.html">XSL FAQ</a>.</li>
   <li>The <a
-    href="http://www.nwalsh.com/docs/tutorials/xsl/xsl/slides.html">tutorial</a>
-    written by Paul Grosso and Norman Walsh is a very good on-line
-    introdution to the language.</li>
+    href="http://www.nwalsh.com/docs/tutorials/xsl/xsl/slides.html">tutorial</a>written
+    by Paul Grosso and Norman Walsh is a very good on-lineintrodution to the
+    language.</li>
   <li>The <a
-    href="http://www.zvon.org/xxl/XSLTutorial/Books/Book1/index.html">only
-    Zvon XSLT tutorial</a> details a lot of constructs with examples.</li>
-  <li><a href="http://www.jenitennison.com/xslt/index.html">Jeni Tennison's
-    XSLT</a> pages provide links to a lot of answers</li>
-  <li>the <a href="http://incrementaldevelopment.com/xsltrick/">Gallery of
-    XSLT Tricks</a> provides non-standard use case of XSLT</li>
-  <li>And I suggest to buy Michael Kay "XSLT Programmer's Reference" book
-    published by <a href="http://www.wrox.com/">Wrox</a> if you plan to work
-    seriously with XSLT in the future.</li>
+    href="http://www.zvon.org/xxl/XSLTutorial/Books/Book1/index.html">onlyZvon
+    XSLT tutorial</a>details a lot of constructs with examples.</li>
+  <li><a href="http://www.jenitennison.com/xslt/index.html">Jeni
+    Tennison'sXSLT</a>pages provide links to a lot of answers</li>
+  <li>the <a href="http://incrementaldevelopment.com/xsltrick/">Gallery
+    ofXSLT Tricks</a>provides non-standard use case of XSLT</li>
+  <li>And I suggest to buy Michael Kay "XSLT Programmer's Reference"
+    bookpublished by <a href="http://www.wrox.com/">Wrox</a>if you plan to
+    workseriously with XSLT in the future.</li>
 </ul>
 
-<p>Well, bugs or missing features are always possible, and I will make a
-point of fixing them in a timely fashion. The best way to report a bug is to
-use the <a
-href="http://bugzilla.gnome.org/enter_bug.cgi?product=libxslt">Gnome bug
-tracking database</a> (make sure to use the "libxslt" module name). Before
-filing a bug, check the <a
-href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">list of existing
-libxslt bugs</a> to make sure it hasn't already been filed. I look at reports
-there regularly and it's good to have a reminder when a bug is still open. Be
-sure to specify that the bug is for the package libxslt.</p>
+<p>Well, bugs or missing features are always possible, and I will make apoint
+of fixing them in a timely fashion. The best way to report a bug is touse the
+<a href="http://bugzilla.gnome.org/enter_bug.cgi?product=libxslt">Gnome
+bugtracking database</a>(make sure to use the "libxslt" module name).
+Beforefiling a bug, check the <a
+href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">list of
+existinglibxslt bugs</a>to make sure it hasn't already been filed. I look at
+reportsthere regularly and it's good to have a reminder when a bug is still
+open. Besure to specify that the bug is for the package libxslt.</p>
 
-<p>For small problems you can try to get help on IRC, the #xml channel on
-irc.gnome.org (port 6667) usually have a few person subscribed which may help
-(but there is no garantee and if a real issue is raised it should go on the
-mailing-list for archival).</p>
+<p>For small problems you can try to get help on IRC, the #xml channel
+onirc.gnome.org (port 6667) usually have a few person subscribed which may
+help(but there is no garantee and if a real issue is raised it should go on
+themailing-list for archival).</p>
 
 <p>There is also a mailing-list <a
-href="mailto:xslt at gnome.org">xslt at gnome.org</a> for libxslt, with an <a
-href="http://mail.gnome.org/archives/xslt/">on-line archive</a>. To subscribe
-to this list, please visit the <a
-href="http://mail.gnome.org/mailman/listinfo/xslt">associated Web</a> page
-and follow the instructions.</p>
+href="mailto:xslt at gnome.org">xslt at gnome.org</a>for libxslt, with an <a
+href="http://mail.gnome.org/archives/xslt/">on-line archive</a>. To
+subscribeto this list, please visit the <a
+href="http://mail.gnome.org/mailman/listinfo/xslt">associated Web</a>pageand
+follow the instructions.</p>
 
 <p>Alternatively, you can just send the bug to the <a
-href="mailto:xslt at gnome.org">xslt at gnome.org</a> list, if it's really libxslt
-related I will approve it.. Please do not send me mail directly especially
-for portability problem, it makes things really harder to track and in some
-cases I'm not the best person to answer a given question, ask the list
-instead. <strong>Do not send code, I won't debug it</strong> (but patches are
-really appreciated!).</p>
+href="mailto:xslt at gnome.org">xslt at gnome.org</a>list, if it's really
+libxsltrelated I will approve it.. Please do not send me mail directly
+especiallyfor portability problem, it makes things really harder to track and
+in somecases I'm not the best person to answer a given question, ask the
+listinstead. <strong>Do not send code, I won't debug it</strong>(but patches
+arereally appreciated!).</p>
 
-<p>Please note that with the current amount of virus and SPAM, sending mail
-to the list without being subscribed won't work. There is *far too many
-bounces* (in the order of a thousand a day !) I cannot approve them manually
-anymore. If your mail to the list bounced waiting for administrator approval,
-it is LOST ! Repost it and fix the problem triggering the error. Also please
-note that <span style="color: #FF0000; background-color: #FFFFFF">emails with
-a legal warning asking to not copy or redistribute freely the informations
-they contain</span> are <strong>NOT</strong> acceptable for the mailing-list,
-such mail will as much as possible be discarded automatically, and are less
-likely to be answered if they made it to the list, <strong>DO NOT</strong>
-post to the list from an email address where such legal requirements are
-automatically added, get private paying support if you can't share
-informations.</p>
+<p>Please note that with the current amount of virus and SPAM, sending mailto
+the list without being subscribed won't work. There is *far too manybounces*
+(in the order of a thousand a day !) I cannot approve them manuallyanymore.
+If your mail to the list bounced waiting for administrator approval,it is
+LOST ! Repost it and fix the problem triggering the error. Also pleasenote
+that <span style="color: #FF0000; background-color: #FFFFFF">emails witha
+legal warning asking to not copy or redistribute freely the informationsthey
+contain</span>are <strong>NOT</strong>acceptable for the mailing-list,such
+mail will as much as possible be discarded automatically, and are lesslikely
+to be answered if they made it to the list, <strong>DO NOT</strong>post to
+the list from an email address where such legal requirements areautomatically
+added, get private paying support if you can't shareinformations.</p>
 
-<p>Check the following too <span style="color: #E50000">before
-posting</span>:</p>
+<p>Check the following too <span
+style="color: #E50000">beforeposting</span>:</p>
 <ul>
-  <li><a href="search.php">use the search engine</a> to get informations
-    related to your problem.</li>
-  <li>make sure you are <a href="ftp://xmlsoft.org/libxslt/">using a recent
-    version</a>, and that the problem still shows up in those</li>
-  <li>check the <a href="http://mail.gnome.org/archives/xslt/">list
-    archives</a> to see if the problem was reported already, in this case
-    there is probably a fix available, similarly check the <a
-    href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">registered
-    open bugs</a></li>
-  <li>make sure you can reproduce the bug with xsltproc, a very useful thing
-    to do is run the transformation with -v argument and redirect the
-    standard error to a file, then search in this file for the transformation
-    logs just preceding the possible problem</li>
-  <li>Please send the command showing the error as well as the input and
-    stylesheet (as an attachment)</li>
+  <li><a href="search.php">use the search engine</a>to get
+    informationsrelated to your problem.</li>
+  <li>make sure you are <a href="ftp://xmlsoft.org/libxslt/">using a
+    recentversion</a>, and that the problem still shows up in those</li>
+  <li>check the <a
+    href="http://mail.gnome.org/archives/xslt/">listarchives</a>to see if the
+    problem was reported already, in this casethere is probably a fix
+    available, similarly check the <a
+    href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">registeredopen
+    bugs</a></li>
+  <li>make sure you can reproduce the bug with xsltproc, a very useful
+    thingto do is run the transformation with -v argument and redirect
+    thestandard error to a file, then search in this file for the
+    transformationlogs just preceding the possible problem</li>
+  <li>Please send the command showing the error as well as the input
+    andstylesheet (as an attachment)</li>
 </ul>
 
 <p>Then send the bug with associated informations to reproduce it to the <a
-href="mailto:xslt at gnome.org">xslt at gnome.org</a> list; if it's really libxslt
-related I will approve it. Please do not send mail to me directly, it makes
-things really hard to track and in some cases I am not the best person to
-answer a given question, ask on the list.</p>
+href="mailto:xslt at gnome.org">xslt at gnome.org</a>list; if it's really
+libxsltrelated I will approve it. Please do not send mail to me directly, it
+makesthings really hard to track and in some cases I am not the best person
+toanswer a given question, ask on the list.</p>
 
 <p>To <span style="color: #E50000">be really clear about support</span>:</p>
 <ul>
-  <li>Support or help <span style="color: #E50000">request MUST be sent to
-    the list or on bugzilla</span> in case of problems, so that the Question
-    and Answers can be shared publicly. Failing to do so carries the implicit
-    message "I want free support but I don't want to share the benefits with
-    others" and is not welcome. I will automatically Carbon-Copy the
-    xslt at gnome.org mailing list for any technical reply made about libxml2 or
-    libxslt.</li>
-  <li>There is <span style="color: #E50000">no garantee for support</span>,
-    if your question remains unanswered after a week, repost it, making sure
-    you gave all the detail needed and the informations requested.</li>
-  <li>Failing to provide informations as requested or double checking first
-    for prior feedback also carries the implicit message "the time of the
-    library maintainers is less valuable than my time" and might not be
-    welcome.</li>
+  <li>Support or help <span style="color: #E50000">request MUST be sent tothe
+    list or on bugzilla</span>in case of problems, so that the Questionand
+    Answers can be shared publicly. Failing to do so carries the
+    implicitmessage "I want free support but I don't want to share the
+    benefits withothers" and is not welcome. I will automatically Carbon-Copy
+    thexslt at gnome.org mailing list for any technical reply made about libxml2
+    orlibxslt.</li>
+  <li>There is <span style="color: #E50000">no garantee for support</span>,if
+    your question remains unanswered after a week, repost it, making sureyou
+    gave all the detail needed and the informations requested.</li>
+  <li>Failing to provide informations as requested or double checking
+    firstfor prior feedback also carries the implicit message "the time of
+    thelibrary maintainers is less valuable than my time" and might not
+    bewelcome.</li>
 </ul>
 
-<p>Of course, bugs reports with a suggested patch for fixing them will
-probably be processed faster.</p>
+<p>Of course, bugs reports with a suggested patch for fixing them
+willprobably be processed faster.</p>
 
 <p>If you're looking for help, a quick look at <a
-href="http://mail.gnome.org/archives/xslt/">the list archive</a> may actually
-provide the answer, I usually send source samples when answering libxslt
-usage questions. The <a
-href="html/libxslt-lib.html#LIBXSLT-LIB">auto-generated documentation</a> is
-not as polished as I would like (I need to learn more about Docbook), but
-it's a good starting point.</p>
+href="http://mail.gnome.org/archives/xslt/">the list archive</a>may
+actuallyprovide the answer, I usually send source samples when answering
+libxsltusage questions. The <a
+href="html/libxslt-lib.html#LIBXSLT-LIB">auto-generated
+documentation</a>isnot as polished as I would like (I need to learn more
+about Docbook), butit's a good starting point.</p>
 
 <h2><a name="help">How to help</a></h2>
 
-<p>You can help the project in various ways, the best thing to do first is to
-subscribe to the mailing-list as explained before, check the <a
+<p>You can help the project in various ways, the best thing to do first is
+tosubscribe to the mailing-list as explained before, check the <a
 href="http://mail.gnome.org/archives/xslt/">archives </a>and the <a
-href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Gnome bug
-database:</a>:</p>
+href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Gnome
+bugdatabase:</a>:</p>
 <ol>
   <li>provide patches when you find problems</li>
-  <li>provide the diffs when you port libxslt to a new platform. They may not
-    be integrated in all cases but help pinpointing portability problems
-  and</li>
-  <li>provide documentation fixes (either as patches to the code comments or
-    as HTML diffs).</li>
+  <li>provide the diffs when you port libxslt to a new platform. They may
+    notbe integrated in all cases but help pinpointing portability
+  problemsand</li>
+  <li>provide documentation fixes (either as patches to the code comments
+    oras HTML diffs).</li>
   <li>provide new documentations pieces (translations, examples, etc ...)</li>
   <li>Check the TODO file and try to close one of the items</li>
-  <li>take one of the points raised in the archive or the bug database and
-    provide a fix. <a href="mailto:daniel at veillard.com">Get in touch with me
-    </a>before to avoid synchronization problems and check that the suggested
-    fix will fit in nicely :-)</li>
+  <li>take one of the points raised in the archive or the bug database
+    andprovide a fix. <a href="mailto:daniel at veillard.com">Get in touch with
+    me</a>before to avoid synchronization problems and check that the
+    suggestedfix will fit in nicely :-)</li>
 </ol>
 
 <h2><a name="Downloads">Downloads</a></h2>
 
 <p>The latest versions of libxslt can be found on the <a
-href="ftp://xmlsoft.org/libxslt/">xmlsoft.org</a> server and on mirrors (<a
+href="ftp://xmlsoft.org/libxslt/">xmlsoft.org</a>server and on mirrors (<a
 href="ftp://fr.rpmfind.net/pub/libxml/">France</a>) or on the <a
-href="ftp://ftp.gnome.org/pub/GNOME/MIRRORS.html">Gnome FTP server</a> as a
-<a href="ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/">source
-archive</a>, Antonin Sprinzl also provides <a
-href="ftp://gd.tuwien.ac.at/pub/libxml/">a mirror in Austria</a>. (NOTE that
-you need the <a href="http://rpmfind.net/linux/RPM/libxml2.html">libxml2</a>,
-<a href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml2-devel</a>,
-<a href="http://rpmfind.net/linux/RPM/libxslt.html">libxslt</a> and <a
-href="http://rpmfind.net/linux/RPM/libxslt-devel.html">libxslt-devel</a>
-packages installed to compile applications using libxslt.) <a
-href="mailto:igor at zlatkovic.com">Igor Zlatkovic</a> is now the maintainer of
-the Windows port, <a
-href="http://www.zlatkovic.com/projects/libxml/index.html">he provides
-binaries</a>. <a href="mailto:Gary.Pennington at sun.com">Gary Pennington</a>
-provides <a href="http://garypennington.net/libxml2/">Solaris binaries</a>.
-<a href="mailto:Steve.Ball at explain.com.au">Steve Ball</a> provides <a
-href="http://www.explain.com.au/oss/libxml2xslt.html">Mac Os X
-binaries</a>.</p>
+href="ftp://ftp.gnome.org/pub/GNOME/MIRRORS.html">Gnome FTP server</a>as a<a
+href="ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/">sourcearchive</a>,
+Antonin Sprinzl also provides <a href="ftp://gd.tuwien.ac.at/pub/libxml/">a
+mirror in Austria</a>. (NOTE thatyou need the <a
+href="http://rpmfind.net/linux/RPM/libxml2.html">libxml2</a>,<a
+href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml2-devel</a>,<a
+href="http://rpmfind.net/linux/RPM/libxslt.html">libxslt</a>and <a
+href="http://rpmfind.net/linux/RPM/libxslt-devel.html">libxslt-devel</a>packages
+installed to compile applications using libxslt.) <a
+href="mailto:igor at zlatkovic.com">Igor Zlatkovic</a>is now the maintainer
+ofthe Windows port, <a
+href="http://www.zlatkovic.com/projects/libxml/index.html">he
+providesbinaries</a>. <a href="mailto:Gary.Pennington at sun.com">Gary
+Pennington</a>provides <a href="http://garypennington.net/libxml2/">Solaris
+binaries</a>.<a href="mailto:Steve.Ball at explain.com.au">Steve
+Ball</a>provides <a href="http://www.explain.com.au/oss/libxml2xslt.html">Mac
+Os Xbinaries</a>.</p>
 
 <p><a name="Contribs">Contribs:</a></p>
 
-<p>I do accept external contributions, especially if compiling on another
-platform, get in touch with me to upload the package. I will keep them in the
-<a href="ftp://xmlsoft.org/libxml2/contribs/">contrib directory</a></p>
+<p>I do accept external contributions, especially if compiling on
+anotherplatform, get in touch with me to upload the package. I will keep them
+in the<a href="ftp://xmlsoft.org/libxml2/contribs/">contrib directory</a></p>
 
 <p>Libxslt is also available from CVS:</p>
 <ul>
-  <li><p>The <a href="http://cvs.gnome.org/viewcvs/libxslt/">Gnome CVS
-    base</a>. Check the <a
-    href="http://developer.gnome.org/tools/cvs.html">Gnome CVS Tools</a>
-    page; the CVS module is <b>libxslt</b>.</p>
+  <li><p>The <a href="http://cvs.gnome.org/viewcvs/libxslt/">Gnome
+    CVSbase</a>. Check the <a
+    href="http://developer.gnome.org/tools/cvs.html">Gnome CVS Tools</a>page;
+    the CVS module is <b>libxslt</b>.</p>
   </li>
-  <li><a href="ftp://xmlsoft.org/libxml2/libxslt-cvs-snapshot.tar.gz">snapshots from
-    CVS</a> updated every hour are also provided</li>
+  <li><a
+    href="ftp://xmlsoft.org/libxml2/libxslt-cvs-snapshot.tar.gz">snapshots
+    fromCVS</a>updated every hour are also provided</li>
 </ul>
 
 <h2><a name="FAQ">FAQ</a></h2>
 <ol>
   <li><em>Troubles compiling or linking programs using libxslt</em>
-    <p>Usually the problem comes from the fact that the compiler doesn't get
-    the right compilation or linking flags. There is a small shell script
-    <code>xslt-config</code> which is installed as part of libxslt usual
-    install process which provides those flags. Use</p>
+    <p>Usually the problem comes from the fact that the compiler doesn't
+    getthe right compilation or linking flags. There is a small shell
+    script<code>xslt-config</code>which is installed as part of libxslt
+    usualinstall process which provides those flags. Use</p>
     <p><code>xslt-config --cflags</code></p>
     <p>to get the compilation flags and</p>
     <p><code>xslt-config --libs</code></p>
-    <p>to get the linker flags. Usually this is done directly from the
-    Makefile as:</p>
+    <p>to get the linker flags. Usually this is done directly from
+    theMakefile as:</p>
     <p><code>CFLAGS=`xslt-config --cflags`</code></p>
     <p><code>LIBS=`xslt-config --libs`</code></p>
-    <p>Note also that if you use the EXSLT extensions from the program then
-    you should prepend <code>-lexslt</code> to the LIBS options</p>
+    <p>Note also that if you use the EXSLT extensions from the program
+    thenyou should prepend <code>-lexslt</code>to the LIBS options</p>
   </li>
   <li><em>passing parameters on the xsltproc command line doesn't work</em>
     <p><em>xsltproc --param test alpha foo.xsl foo.xml</em></p>
     <p><em>the param does not get passed and ends up as ""</em></p>
     <p>In a nutshell do a double escaping at the shell prompt:</p>
     <p>xsltproc --param test "'alpha'" foo.xsl foo.xml</p>
-    <p>i.e. the string value is surrounded by " and ' then terminated by '
-    and ". Libxslt interpret the parameter values as XPath expressions, so
-    the string -&gt;<code>alpha</code>&lt;- is intepreted as the node set
-    matching this string. You really want -&gt;<code>'alpha'</code>&lt;- to
-    be passed to the processor. And to allow this you need to escape the
-    quotes at the shell level using -&gt;<code>"'alpha'"</code>&lt;- .</p>
+    <p>i.e. the string value is surrounded by " and ' then terminated by 'and
+    ". Libxslt interpret the parameter values as XPath expressions, sothe
+    string -&gt;<code>alpha</code>&lt;- is intepreted as the node setmatching
+    this string. You really want -&gt;<code>'alpha'</code>&lt;- tobe passed
+    to the processor. And to allow this you need to escape thequotes at the
+    shell level using -&gt;<code>"'alpha'"</code>&lt;- .</p>
     <p>or use</p>
     <p>xsltproc --stringparam test alpha foo.xsl foo.xml</p>
   </li>
   <li><em>Is there C++ bindings ?</em>
     <p>Yes for example <a
-    href="http://pmade.org/pjones/software/xmlwrapp/">xmlwrapp</a> , see <a
+    href="http://pmade.org/pjones/software/xmlwrapp/">xmlwrapp</a>, see <a
     href="python.html">the related pages about bindings</a></p>
   </li>
 </ol>
 
 <h2><a name="News">News</a></h2>
 
-<p>The <a href="ChangeLog.html">change log</a> describes the recents commits
-to the <a href="http://cvs.gnome.org/viewcvs/libxslt/">CVS</a> code base.</p>
+<p>The <a href="ChangeLog.html">change log</a>describes the recents commitsto
+the <a href="http://cvs.gnome.org/viewcvs/libxslt/">CVS</a>code base.</p>
 
 <p>Those are the public releases made:</p>
 
+<h3>1.1.17: Jun 6 2006</h3>
+<ul>
+  <li>portability fixes: python detection</li>
+  <li>bug fixes: some regression tests, attribute/namespaces output (Kasimier
+    Buchcik), problem in mixed xsl:value-of and xsl:text uses (Kasimier)</li>
+  <li>improvements: internal refactoring (Kasimier Buchcik), use of the XPath
+    object cache in libxml2-2.6.25 (Kasimier)</li>
+</ul>
+
 <h3>1.1.16: May 01 2006</h3>
 <ul>
-  <li>portability fixes: EXSLT date/time on Solaris and IRIX (Albert Chin),
-      HP-UX  build (Albert Chin), 
-  <li>build fixes: Python detection(Joseph Sacco), plugin configurei
-      (Joel Reed)</li>
-  <li>bug fixes: pattern compilation fix(William Brack), EXSLT date/time
-      fix (Thomas Broyer), EXSLT function bug, potential loop on variable
-      eval, startup race (Christopher Palmer), debug statement left in python
-      (Nic Ferrier), various cleanup based on Coverity reports), error on
-      Out of memory condition (Charles Hardin), various namespace prefixes
-      fixes (Kasimier Buchcik), </li>
-  <li>improvement: speed up sortingi, start of internals refactoring (Kasimier
-      Buchcik)</li>
-  <li>documentation: man page fixes and updates (Daniel Leidert)
+  <li>portability fixes: EXSLT date/time on Solaris and IRIX (Albert
+    Chin),HP-UX  build (Albert Chin),</li>
+  <li>build fixes: Python detection(Joseph Sacco), plugin configurei(Joel
+    Reed)</li>
+  <li>bug fixes: pattern compilation fix(William Brack), EXSLT date/timefix
+    (Thomas Broyer), EXSLT function bug, potential loop on variableeval,
+    startup race (Christopher Palmer), debug statement left in python(Nic
+    Ferrier), various cleanup based on Coverity reports), error onOut of
+    memory condition (Charles Hardin), various namespace prefixesfixes
+    (Kasimier Buchcik),</li>
+  <li>improvement: speed up sortingi, start of internals refactoring
+    (KasimierBuchcik)</li>
+  <li>documentation: man page fixes and updates (Daniel Leidert)</li>
 </ul>
 
 <h3>1.1.15: Sep 04 2005</h3>
 <ul>
-  <li>build fixes: Windows build cleanups and updates (Igor Zlatkovic),
-    remove jhbuild warnings</li>
-  <li>bug fixes: negative number formatting (William Brack), number
-    formatting per mille definition (William Brack), XInclude default values
-    (William), text copy bugs (William), bug related to xmlXPathContext size,
-    reuse libxml2 memory management for text nodes, dictionnary text bug,
-    forbid variables in match (needs libxml2-2.6.21)</li>
+  <li>build fixes: Windows build cleanups and updates (Igor Zlatkovic),remove
+    jhbuild warnings</li>
+  <li>bug fixes: negative number formatting (William Brack), numberformatting
+    per mille definition (William Brack), XInclude default values(William),
+    text copy bugs (William), bug related to xmlXPathContext size,reuse
+    libxml2 memory management for text nodes, dictionnary text bug,forbid
+    variables in match (needs libxml2-2.6.21)</li>
   <li>improvements: EXSLT dyn:map (Mark Vakoc),</li>
-  <li>documentation: EXSLT date and time functions namespace in man (Jonathan
-    Wakely)</li>
+  <li>documentation: EXSLT date and time functions namespace in man
+    (JonathanWakely)</li>
 </ul>
 
 <h3>1.1.14: Apr 02 2005</h3>
 <ul>
-  <li>bug fixes: text node on stylesheet document without a dictionary
-    (William Brack), more checking of XSLT syntax, calling xsltInit()
-    multiple times, mode values interning raised by Mark Vakoc, bug in
-    pattern matching with ancestors, bug in patterna matching with cascading
-    select, xinclude and document() problem, build outside of source tree
-    (Mike Castle)</li>
-  <li>improvement: added a --nodict mode to xsltproc to check problems for
-    docuemtns without dictionnaries</li>
+  <li>bug fixes: text node on stylesheet document without a
+    dictionary(William Brack), more checking of XSLT syntax, calling
+    xsltInit()multiple times, mode values interning raised by Mark Vakoc, bug
+    inpattern matching with ancestors, bug in patterna matching with
+    cascadingselect, xinclude and document() problem, build outside of source
+    tree(Mike Castle)</li>
+  <li>improvement: added a --nodict mode to xsltproc to check problems
+    fordocuemtns without dictionnaries</li>
 </ul>
 
 <h3>1.1.13: Mar 13 2005</h3>
 <ul>
-  <li>build fixes: 64bits cleanup (William Brack), python 2.4 test (William),
-    LIBXSLT_VERSION_EXTRA on Windows (William), Windows makefiles fixes (Joel
-    Reed), libgcrypt-devel requires for RPM spec.</li>
-  <li>bug fixes: exslt day-of-week-in-month (Sal Paradise), xsl:call-template
-    should not change the current template rule (William Brack), evaluation
-    of global variables (William Brack), RVT's in XPath predicates (William),
-    namespace URI on template names (Mark Vakoc), stat() for Windows patch
-    (Aleksey Gurtovoy), pattern expression fixes (William Brack), out of
-    memory detection misses (William), parserOptions propagation (William),
-    exclude-result-prefixes fix (William), // patten fix (William).</li>
-  <li>extensions: module support (Joel Reed), dictionnary based speedups
-    trying to get rid of xmlStrEqual as much as possible.</li>
+  <li>build fixes: 64bits cleanup (William Brack), python 2.4 test
+    (William),LIBXSLT_VERSION_EXTRA on Windows (William), Windows makefiles
+    fixes (JoelReed), libgcrypt-devel requires for RPM spec.</li>
+  <li>bug fixes: exslt day-of-week-in-month (Sal Paradise),
+    xsl:call-templateshould not change the current template rule (William
+    Brack), evaluationof global variables (William Brack), RVT's in XPath
+    predicates (William),namespace URI on template names (Mark Vakoc), stat()
+    for Windows patch(Aleksey Gurtovoy), pattern expression fixes (William
+    Brack), out ofmemory detection misses (William), parserOptions
+    propagation (William),exclude-result-prefixes fix (William), // patten
+    fix (William).</li>
+  <li>extensions: module support (Joel Reed), dictionnary based
+    speedupstrying to get rid of xmlStrEqual as much as possible.</li>
   <li>documentation: added Wiki (Joel Reed)</li>
 </ul>
 
 <h3>1.1.12: Oct 29 2004</h3>
 <ul>
   <li>build fixes: warnings removal (William).</li>
-  <li>bug fixes: attribute document pointer fix (Mark Vakoc), exslt date
-    negative periods (William Brack), generated tree structure fixes,
-    namespace lookup fix, use reentrant gmtime_r (William Brack),
-    exslt:funtion namespace fix (William), potential NULL pointer reference
-    (Dennis Dams, William), force string interning on generated
-  documents.</li>
-  <li>documentation: update of the second tutorial (Panagiotis Louridas), add
-    exslt doc in rpm packages, fix the xsltproc man page.</li>
+  <li>bug fixes: attribute document pointer fix (Mark Vakoc), exslt
+    datenegative periods (William Brack), generated tree structure
+    fixes,namespace lookup fix, use reentrant gmtime_r (William
+    Brack),exslt:funtion namespace fix (William), potential NULL pointer
+    reference(Dennis Dams, William), force string interning on
+    generateddocuments.</li>
+  <li>documentation: update of the second tutorial (Panagiotis Louridas),
+    addexslt doc in rpm packages, fix the xsltproc man page.</li>
 </ul>
 
 <h3>1.1.11: Sep 29 2004</h3>
 <ul>
-  <li>bug fixes: xsl:include problems (William Brack), UTF8 number pattern
-    (William), date-time validation (William), namespace fix (William),
-    various Exslt date fixes (William), error callback fixes, leak with
-    namespaced global variable, attempt to fix a weird problem #153137</li>
+  <li>bug fixes: xsl:include problems (William Brack), UTF8 number
+    pattern(William), date-time validation (William), namespace fix
+    (William),various Exslt date fixes (William), error callback fixes, leak
+    withnamespaced global variable, attempt to fix a weird problem
+  #153137</li>
   <li>improvements: exslt:date-sum tests (Derek Poon)</li>
   <li>documentation: second tutorial by Panagiotis Lourida</li>
 </ul>
 
 <h3>1.1.10: Aug 31 2004</h3>
 <ul>
-  <li>build fix: NUL in c file blocking compilation on Solaris, Windows build
-    (Igor Zlatkovic)</li>
+  <li>build fix: NUL in c file blocking compilation on Solaris, Windows
+    build(Igor Zlatkovic)</li>
   <li>fix: key initialization problem (William Brack)</li>
   <li>documentation: fixed missing man page description for --path</li>
 </ul>
 
 <h3>1.1.9: Aug 22 2004</h3>
 <ul>
-  <li>build fixes: missing tests (William Brack), Python dependancies, Python
-    on 64bits boxes, --with-crypto flag (Rob Richards),</li>
-  <li>fixes: RVT key handling (William), Python binding (William and Sitsofe
-    Wheeler), key and XPath troubles (William), template priority on imports
-    (William), str:tokenize with empty strings (William), #default namespace
-    alias behaviour (William), doc ordering missing for main document
-    (William), 64bit bug (Andreas Schwab)</li>
-  <li>improvements: EXSLT date:sum added (Joel Reed), hook for document
-    loading for David Hyatt, xsltproc --nodtdattr to avoid defaulting DTD
-    attributes, extend xsltproc --version with CVS stamp (William).</li>
+  <li>build fixes: missing tests (William Brack), Python dependancies,
+    Pythonon 64bits boxes, --with-crypto flag (Rob Richards),</li>
+  <li>fixes: RVT key handling (William), Python binding (William and
+    SitsofeWheeler), key and XPath troubles (William), template priority on
+    imports(William), str:tokenize with empty strings (William), #default
+    namespacealias behaviour (William), doc ordering missing for main
+    document(William), 64bit bug (Andreas Schwab)</li>
+  <li>improvements: EXSLT date:sum added (Joel Reed), hook for
+    documentloading for David Hyatt, xsltproc --nodtdattr to avoid defaulting
+    DTDattributes, extend xsltproc --version with CVS stamp (William).</li>
   <li>Documentation: web page problem reported by Oliver Stoeneberg</li>
 </ul>
 
 <h3>1.1.8: July 5 2004</h3>
 <ul>
-  <li>build fixes: Windows runtime options (Oliver Stoeneberg), Windows
-    binary package layout (Igor Zlatkovic), libgcrypt version test and link
-    (William)</li>
+  <li>build fixes: Windows runtime options (Oliver Stoeneberg), Windowsbinary
+    package layout (Igor Zlatkovic), libgcrypt version test and
+  link(William)</li>
   <li>documentation: fix libxslt namespace name in doc (William)</li>
-  <li>bug fixes: undefined namespace message (William Brack), search engine
-    (William), multiple namespace fixups (William), namespace fix for key
-    evaluation (William), Python memory debug bindings,</li>
+  <li>bug fixes: undefined namespace message (William Brack), search
+    engine(William), multiple namespace fixups (William), namespace fix for
+    keyevaluation (William), Python memory debug bindings,</li>
   <li>improvements: crypto extensions for exslt (Joel Reed, William)</li>
 </ul>
 
 <h3>1.1.7: May 17 2004</h3>
 <ul>
   <li>build fix: warning about localtime_r on Solaris</li>
-  <li>bug fix: UTF8 string tokenize (William Brack), subtle memory
-    corruption, linefeed after comment at document level (William),
-    disable-output-escaping problem (William), pattern compilation in deep
-    imported stylesheets (William), namespace extension prefix bug,
-    libxslt.m4 bug (Edward Rudd), namespace lookup for attribute, namespaced
-    DOCTYPE name</li>
+  <li>bug fix: UTF8 string tokenize (William Brack), subtle memorycorruption,
+    linefeed after comment at document level
+    (William),disable-output-escaping problem (William), pattern compilation
+    in deepimported stylesheets (William), namespace extension prefix
+    bug,libxslt.m4 bug (Edward Rudd), namespace lookup for attribute,
+    namespacedDOCTYPE name</li>
 </ul>
 
 <h3>1.1.6: Apr 18 2004</h3>
@@ -443,81 +456,81 @@
   <li>performance: use dictionnary lookup for variables</li>
   <li>remove use of _private from source documents</li>
   <li>cleanup of "make tests" output</li>
-  <li>bugfixes: AVT in local variables, use localtime_r to avoid thread
-    troubles (William), dictionary handling bug (William), limited number of
-    stubstitutions in AVT (William), tokenize fix for UTF-8 (William),
-    superfluous namespace (William), xsltproc error code on
-    &lt;xsl:message&gt; halt, OpenVMS fix, dictionnary reference counting
-    change.</li>
+  <li>bugfixes: AVT in local variables, use localtime_r to avoid
+    threadtroubles (William), dictionary handling bug (William), limited
+    number ofstubstitutions in AVT (William), tokenize fix for UTF-8
+    (William),superfluous namespace (William), xsltproc error code
+    on&lt;xsl:message&gt; halt, OpenVMS fix, dictionnary reference
+    countingchange.</li>
 </ul>
 
 <h3>1.1.4: Feb 23 2004</h3>
 <ul>
-  <li>bugfixes: attributes without doc (Mariano Suárez-Alvarez), problem with
-    Yelp, extension problem</li>
+  <li>bugfixes: attributes without doc (Mariano Suárez-Alvarez), problem
+    withYelp, extension problem</li>
   <li>display extension modules (Steve Little)</li>
   <li>Windows compilation patch (Mark Vadoc), Mingw (Mikhail Grushinskiy)</li>
 </ul>
 
 <h3>1.1.3: Feb 16 2004</h3>
 <ul>
-  <li>Rewrote the Attribute Value Template code, new XPath compilation
-    interfaces, dictionnary reuses for XSLT with potential for serious
-    performance improvements.</li>
-  <li>bug fixes: portability (William Brack), key() in node-set() results
-    (William), comment before doctype (William), math and node-set() problems
-    (William), cdata element and default namespace (William), behaviour on
-    unknown XSLT elements (Stefan Kost), priority of "//foo" patterns
-    (William), xsl:element and xsl:attribute QName check (William), comments
-    with -- (William), attribute namespace (William), check for ?&gt; in PI
-    (William)</li>
+  <li>Rewrote the Attribute Value Template code, new XPath
+    compilationinterfaces, dictionnary reuses for XSLT with potential for
+    seriousperformance improvements.</li>
+  <li>bug fixes: portability (William Brack), key() in node-set()
+    results(William), comment before doctype (William), math and node-set()
+    problems(William), cdata element and default namespace (William),
+    behaviour onunknown XSLT elements (Stefan Kost), priority of "//foo"
+    patterns(William), xsl:element and xsl:attribute QName check (William),
+    commentswith -- (William), attribute namespace (William), check for ?&gt;
+    in PI(William)</li>
   <li>Documentations: cleanup (John Fleck and William)</li>
-  <li>Python: patch for OS-X (Gianni Ceccarelli), enums export (Stephane
-    bidoul)</li>
+  <li>Python: patch for OS-X (Gianni Ceccarelli), enums export
+    (Stephanebidoul)</li>
 </ul>
 
 <h3>1.1.2: Dec 24 2003</h3>
 <ul>
-  <li>Documentation fixes (John Fleck, William Brack), EXSLT documentation
-    (William Brack)</li>
+  <li>Documentation fixes (John Fleck, William Brack), EXSLT
+    documentation(William Brack)</li>
   <li>Windows compilation fixes for MSVC and Mingw (Igor Zlatkovic)</li>
-  <li>Bug fixes: exslt:date returning NULL strings (William Brack),
-    namespaces output (William Brack),  key and namespace definition problem,
-    passing options down to the document() parser, xsl:number fixes (William
-    Brack)</li>
+  <li>Bug fixes: exslt:date returning NULL strings (William Brack),namespaces
+    output (William Brack),  key and namespace definition problem,passing
+    options down to the document() parser, xsl:number fixes
+  (WilliamBrack)</li>
 </ul>
 
 <h3>1.1.1: Dec 10 2003</h3>
 <ul>
   <li>code cleanup (William Brack)</li>
   <li>Windows: Makefile improvements (Igor Zlatkovic)</li>
-  <li>documentation improvements: William Brack, libexslt man page (Jonathan
-    Wakely)</li>
+  <li>documentation improvements: William Brack, libexslt man page
+    (JonathanWakely)</li>
   <li>param in EXSLT functions (Shaun McCance)</li>
   <li>XSLT debugging improvements (Mark Vakoc)</li>
-  <li>bug fixes: number formatting (Bjorn Reese), exslt:tokenize (William
-    Brack), key selector parsing with | reported by Oleg Paraschenko,
-    xsl:element with computed namespaces (William Brack), xslt:import/include
-    recursion detection (William Brack), exslt:function used in keys (William
-    Brack), bug when CDATA_SECTION are foun in the tree (William Brack),
-    entities handling when using XInclude.</li>
+  <li>bug fixes: number formatting (Bjorn Reese), exslt:tokenize
+    (WilliamBrack), key selector parsing with | reported by Oleg
+    Paraschenko,xsl:element with computed namespaces (William Brack),
+    xslt:import/includerecursion detection (William Brack), exslt:function
+    used in keys (WilliamBrack), bug when CDATA_SECTION are foun in the tree
+    (William Brack),entities handling when using XInclude.</li>
 </ul>
 
 <h3>1.1.0: Nov 4 2003</h3>
 <ul>
   <li>Removed DocBook SGML broken support</li>
   <li>fix xsl:key to work with PIs</li>
-  <li>Makefile and build improvement (Graham Wilson), build cleanup (William
-    Brack), macro fix (Justin Fletcher), build outside of source tree (Roumen
-    Petrov)</li>
-  <li>xsltproc option display fix (Alexey Efimov), --load-trace (Crutcher
-    Dunnavant)</li>
+  <li>Makefile and build improvement (Graham Wilson), build cleanup
+    (WilliamBrack), macro fix (Justin Fletcher), build outside of source tree
+    (RoumenPetrov)</li>
+  <li>xsltproc option display fix (Alexey Efimov), --load-trace
+    (CrutcherDunnavant)</li>
   <li>Python: never use stdout for error</li>
   <li>extension memory error fix (Karl Eichwalder)</li>
   <li>header path fixes (Steve Ball)</li>
   <li>added saxon:line-number() to libexslt (Brett Kail)</li>
-  <li>Fix some tortuous template problems when using predicates (William
-    Brack)</li>
+  <li>Fix some tortuous template problems when using predicates
+  (WilliamBrack)</li>
   <li>Debugger status patch (Kasimier Buchcik)</li>
   <li>Use new libxml2-2.6.x APIs for faster processing</li>
   <li>Make sure xsl:sort is empty</li>
@@ -546,14 +559,14 @@
 
 <h3>1.0.32: Aug 9 2003</h3>
 <ul>
-  <li>bugfixes: xsltSaveResultToFile() python binding (Chris Jaeger), EXSLT
-    function (William Brack), RVT for globals (William Brack), EXSLT date
-    (William Brack),
-    <p>speed of large text output, xsl:copy with attributes, strip-space and
-    namespaces prefix, fix for --path xsltproc option, EXST:tokenize (Shaun
-    McCance), EXSLT:seconds (William Brack), sort with multiple keys (William
-    Brack), checking of { and } for attribute value templates (William
-    Brack)</p>
+  <li>bugfixes: xsltSaveResultToFile() python binding (Chris Jaeger),
+    EXSLTfunction (William Brack), RVT for globals (William Brack), EXSLT
+    date(William Brack),
+    <p>speed of large text output, xsl:copy with attributes, strip-space
+    andnamespaces prefix, fix for --path xsltproc option, EXST:tokenize
+    (ShaunMcCance), EXSLT:seconds (William Brack), sort with multiple keys
+    (WilliamBrack), checking of { and } for attribute value templates
+    (WilliamBrack)</p>
   </li>
   <li>Python bindings for extension elements (Sean Treadway)</li>
   <li>EXSLT:split added (Shaun McCance)</li>
@@ -563,16 +576,16 @@
 
 <h3>1.0.31: Jul 6 2003</h3>
 <ul>
-  <li>bugfixes: xsl:copy on namespace nodes, AVT for xsl:sort order, fix for
-    the debugger (Keith Isdale), output filename limitation, trio.h and
-    triodef.h added (Albert Chin), EXSLT node-set (Peter Breitenlohner),
-    xsltChoose and whitespace (Igor Zlatkovic),
-    <p>stylesheet compilation (Igor Zlatkovic), NaN and sort (William Brack),
-    RVT bug introduced in 1.0.30</p>
+  <li>bugfixes: xsl:copy on namespace nodes, AVT for xsl:sort order, fix
+    forthe debugger (Keith Isdale), output filename limitation, trio.h
+    andtriodef.h added (Albert Chin), EXSLT node-set (Peter
+    Breitenlohner),xsltChoose and whitespace (Igor Zlatkovic),
+    <p>stylesheet compilation (Igor Zlatkovic), NaN and sort (William
+    Brack),RVT bug introduced in 1.0.30</p>
   </li>
   <li>avoid generating &amp;quot; (fix in libxml2-2.5.8)</li>
-  <li>fix 64bit cleaness problem and compilation troubles introduced in
-  1.0.30</li>
+  <li>fix 64bit cleaness problem and compilation troubles introduced
+  in1.0.30</li>
   <li>Windows makefile generation (Igor Zlatkovic)</li>
   <li>HP-UX portability fix</li>
 </ul>
@@ -580,20 +593,20 @@
 <h3>1.0.30: May 4 2003</h3>
 <ul>
   <li>Fixes and new APIs to handle Result Value Trees and avoid leaks</li>
-  <li>Fixes for: EXSLT math pow() function (Charles Bozeman), global
-    parameter and global variables mismatch, a segfault on pattern
-    compilation errors, namespace copy in xsl:copy-of, python generator
-    problem, OpenVMS trio update, premature call to xsltFreeStackElem (Igor),
-    current node when templates applies to attributes</li>
+  <li>Fixes for: EXSLT math pow() function (Charles Bozeman), globalparameter
+    and global variables mismatch, a segfault on patterncompilation errors,
+    namespace copy in xsl:copy-of, python generatorproblem, OpenVMS trio
+    update, premature call to xsltFreeStackElem (Igor),current node when
+    templates applies to attributes</li>
 </ul>
 
 <h3>1.0.29: Apr 1 2003</h3>
 <ul>
   <li>performance improvements especially for large flat documents</li>
-  <li>bug fixes: Result Value Tree handling, XML IDs, keys(), extra namespace
-    declarations with xsl:elements.</li>
-  <li>portability: python and trio fixes (Albert Chin), python on Solaris
-    (Ben Phillips)</li>
+  <li>bug fixes: Result Value Tree handling, XML IDs, keys(), extra
+    namespacedeclarations with xsl:elements.</li>
+  <li>portability: python and trio fixes (Albert Chin), python on Solaris(Ben
+    Phillips)</li>
 </ul>
 
 <h3>1.0.28: Mar 24 2003</h3>
@@ -601,43 +614,44 @@
   <li>fixed node() in patterns semantic.</li>
   <li>fixed a memory access problem in format-number()</li>
   <li>fixed stack overflow in recursive global variable or params</li>
-  <li>cleaned up Result Value Tree handling, and fixed a couple of old bugs
-    in the process</li>
+  <li>cleaned up Result Value Tree handling, and fixed a couple of old bugsin
+    the process</li>
 </ul>
 
 <h3>1.0.27: Feb 24 2003</h3>
 <ul>
-  <li>bug fixes: spurious xmlns:nsX="" generation, serialization bug (in
-    libxml2), a namespace copy problem, errors in the RPM spec prereqs</li>
+  <li>bug fixes: spurious xmlns:nsX="" generation, serialization bug
+    (inlibxml2), a namespace copy problem, errors in the RPM spec prereqs</li>
   <li>Windows path canonicalization and document cache fix (Igor)</li>
 </ul>
 
 <h3>1.0.26: Feb 10 2003</h3>
 <ul>
-  <li>Fixed 3 serious bugs in document() and stylesheet compilation which
-    could lead to a crash</li>
+  <li>Fixed 3 serious bugs in document() and stylesheet compilation
+    whichcould lead to a crash</li>
 </ul>
 
 <h3>1.0.25: Feb 5 2003</h3>
 <ul>
-  <li>Bug fix: double-free for standalone stylesheets introduced in 1.0.24, C
-    syntax pbm, 3 bugs reported by Eric van der Vlist</li>
-  <li>Some XPath and XInclude related problems were actually fixed in
-    libxml2-2.5.2</li>
+  <li>Bug fix: double-free for standalone stylesheets introduced in 1.0.24,
+    Csyntax pbm, 3 bugs reported by Eric van der Vlist</li>
+  <li>Some XPath and XInclude related problems were actually fixed
+    inlibxml2-2.5.2</li>
   <li>Documentation: emphasize taht --docbook is not for XML docs.</li>
 </ul>
 
 <h3>1.0.24: Jan 14 2003</h3>
 <ul>
-  <li>bug fixes: imported global varables, python bindings (Stéphane Bidoul),
-    EXSLT memory leak (Charles Bozeman), namespace generation on
-    xsl:attribute, space handling with imports (Daniel Stodden),
-    extension-element-prefixes (Josh Parsons), comments within xsl:text (Matt
-    Sergeant), superfluous xmlns generation, XInclude related bug for
-    numbering, EXSLT strings (Alexey Efimov), attribute-sets computation on
-    imports, extension module init and shutdown callbacks not called</li>
-  <li>HP-UX portability (Alexey Efimov), Windows makefiles (Igor and Stephane
-    Bidoul), VMS makefile updates (Craig A. Berry)</li>
+  <li>bug fixes: imported global varables, python bindings (Stéphane
+    Bidoul),EXSLT memory leak (Charles Bozeman), namespace generation
+    onxsl:attribute, space handling with imports (Daniel
+    Stodden),extension-element-prefixes (Josh Parsons), comments within
+    xsl:text (MattSergeant), superfluous xmlns generation, XInclude related
+    bug fornumbering, EXSLT strings (Alexey Efimov), attribute-sets
+    computation onimports, extension module init and shutdown callbacks not
+    called</li>
+  <li>HP-UX portability (Alexey Efimov), Windows makefiles (Igor and
+    StephaneBidoul), VMS makefile updates (Craig A. Berry)</li>
   <li>adds xsltGetProfileInformation() (Michael Rothwell)</li>
   <li>fix the API generation scripts</li>
   <li>API to provide the sorting routines (Richard Jinks)</li>
@@ -651,10 +665,10 @@
 <ul>
   <li>Windows build cleanup (Igor)</li>
   <li>Unix build and RPM packaging cleanup</li>
-  <li>Improvement of the python bindings: extension functions and activating
-    EXSLT</li>
-  <li>various bug fixes: number formatting, portability for bounded string
-    functions, CData nodes, key(), @*[...] patterns</li>
+  <li>Improvement of the python bindings: extension functions and
+    activatingEXSLT</li>
+  <li>various bug fixes: number formatting, portability for bounded
+    stringfunctions, CData nodes, key(), @*[...] patterns</li>
   <li>Documentation improvements (John Fleck)</li>
   <li>added libxslt.m4 (Thomas Schraitle)</li>
 </ul>
@@ -662,22 +676,22 @@
 <h3>1.0.22: Oct 18 2002</h3>
 <ul>
   <li>Updates on the Windows Makefiles</li>
-  <li>Added a security module, and a related set of new options to
-  xsltproc</li>
+  <li>Added a security module, and a related set of new options
+  toxsltproc</li>
   <li>Allowed per transformation error handler.</li>
-  <li>Fixed a few bugs: node() semantic, URI escaping, media-type, attribute
-    lists</li>
+  <li>Fixed a few bugs: node() semantic, URI escaping, media-type,
+    attributelists</li>
 </ul>
 
 <h3>1.0.21: Sep 26 2002</h3>
 <ul>
-  <li>Bug fixes: match="node()", date:difference() (Igor and Charlie
-    Bozeman), disable-output-escaping</li>
+  <li>Bug fixes: match="node()", date:difference() (Igor and CharlieBozeman),
+    disable-output-escaping</li>
   <li>Python bindings: style.saveResultToString() from Ralf Mattes</li>
   <li>Logos from Marc Liyanage</li>
   <li>Mem leak fix from Nathan Myers</li>
-  <li>Makefile: DESTDIR fix from Christophe Merlet, AMD x86_64 (Mandrake),
-    Windows (Igor), Python detection</li>
+  <li>Makefile: DESTDIR fix from Christophe Merlet, AMD x86_64
+    (Mandrake),Windows (Igor), Python detection</li>
   <li>Documentation improvements: John Fleck</li>
 </ul>
 
@@ -686,8 +700,8 @@
   <li>Windows makefile updates (Igor) and x86-64 (Frederic Crozat)</li>
   <li>fixed HTML meta tag saving for Mac/IE users</li>
   <li>possible leak patches from Nathan Myers</li>
-  <li>try to handle document('') as best as possible depending in the
-  cases</li>
+  <li>try to handle document('') as best as possible depending in
+  thecases</li>
   <li>Fixed the DocBook stylesheets handling problem</li>
   <li>Fixed a few XSLT reported errors</li>
 </ul>
@@ -700,27 +714,26 @@
   <li>document('') fix: bug pointed by Eric van der Vlist</li>
   <li>xsl:message with terminate="yes" fixes: William Brack</li>
   <li>xsl:sort order support added: Ken Neighbors</li>
-  <li>a few other bug fixes, some of them requiring the latest version of
-    libxml2</li>
+  <li>a few other bug fixes, some of them requiring the latest version
+    oflibxml2</li>
 </ul>
 
 <h3>1.0.18: May 27 2002</h3>
 <ul>
-  <li>a number of bug fixes: attributes, extra namespace declarations
-    (DocBook), xsl:include crash (Igor), documentation (Christian Cornelssen,
-    Charles Bozeman and Geert Kloosterman),  element-available (Richard
-  Jinks)</li>
-  <li>xsltproc can now list teh registered extensions thanks to Mark
-  Vakoc</li>
-  <li>there is a new API to save directly to a string
-    xsltSaveResultToString() by Morus Walter</li>
+  <li>a number of bug fixes: attributes, extra namespace
+    declarations(DocBook), xsl:include crash (Igor), documentation (Christian
+    Cornelssen,Charles Bozeman and Geert Kloosterman),  element-available
+    (RichardJinks)</li>
+  <li>xsltproc can now list teh registered extensions thanks to MarkVakoc</li>
+  <li>there is a new API to save directly to a stringxsltSaveResultToString()
+    by Morus Walter</li>
   <li>specific error registration function for the python API</li>
 </ul>
 
 <h3>1.0.17: April 29 2002</h3>
 <ul>
-  <li>cleanup in code, XSLT debugger support and Makefiles for Windows by
-  Igor</li>
+  <li>cleanup in code, XSLT debugger support and Makefiles for Windows
+  byIgor</li>
   <li>a C++ portability fix by Mark Vakoc</li>
   <li>EXSLT date improvement and regression tests by Charles Bozeman</li>
   <li>attempt to fix a bug in xsltProcessUserParamInternal</li>
@@ -728,18 +741,18 @@
 
 <h3>1.0.16: April 15 2002</h3>
 <ul>
-  <li>Bug fixes: strip-space, URL in HTML output, error when xsltproc can't
-    save</li>
+  <li>Bug fixes: strip-space, URL in HTML output, error when xsltproc
+    can'tsave</li>
   <li>portability fixes: OSF/1, IEEE on alphas, Windows, Python bindings</li>
 </ul>
 
 <h3>1.0.15: Mar 25 2002</h3>
 <ul>
-  <li>Bugfixes: XPath, python Makefile, recursive attribute sets, @foo[..]
-    templates</li>
+  <li>Bugfixes: XPath, python Makefile, recursive attribute sets,
+    @foo[..]templates</li>
   <li>Debug of memory alocation with valgind</li>
-  <li>serious profiling leading to significant improvement for DocBook
-    processing</li>
+  <li>serious profiling leading to significant improvement for
+    DocBookprocessing</li>
   <li>revamp of the Windows build</li>
 </ul>
 
@@ -747,16 +760,16 @@
 <ul>
   <li>Improvement in the XPath engine (libxml2-2.4.18)</li>
   <li>Nasty bug fix related to exslt:node-set</li>
-  <li>Fixed the python Makefiles, cleanup of doc comments, Windows
-    portability fixes</li>
+  <li>Fixed the python Makefiles, cleanup of doc comments, Windowsportability
+    fixes</li>
 </ul>
 
 <h3>1.0.13: Mar 8 2002</h3>
 <ul>
   <li>a number of bug fixes including "namespace node have no parents"</li>
   <li>Improvement of the Python bindings</li>
-  <li>Charles Bozeman provided fixes and regression tests for exslt date
-    functions.</li>
+  <li>Charles Bozeman provided fixes and regression tests for exslt
+    datefunctions.</li>
 </ul>
 
 <h3>1.0.12: Feb 11 2002</h3>
@@ -768,10 +781,9 @@
 <h3>1.0.11: Feb 8 2002</h3>
 <ul>
   <li>Change of Licence to the <a
-    href="http://www.opensource.org/licenses/mit-license.html">MIT
-  Licence</a></li>
-  <li>Added a beta version of the Python bindings, including support to
-    extend the engine with functions written in Python</li>
+    href="http://www.opensource.org/licenses/mit-license.html">MITLicence</a></li>
+  <li>Added a beta version of the Python bindings, including support toextend
+    the engine with functions written in Python</li>
   <li>A number of bug fixes</li>
   <li>Charlie Bozeman provided more EXSLT functions</li>
   <li>Portability fixes</li>
@@ -782,8 +794,7 @@
   <li>Windows fixes for Win32 from Igor</li>
   <li>Fixed the Solaris compilation trouble (Albert)</li>
   <li>Documentation changes and updates: John Fleck</li>
-  <li>Added a stringparam option to avoid escaping hell at the shell
-  level</li>
+  <li>Added a stringparam option to avoid escaping hell at the shelllevel</li>
   <li>A few bug fixes</li>
 </ul>
 
@@ -792,23 +803,22 @@
   <li>Makefile patches from Peter Williams</li>
   <li>attempt to fix the compilation problem associated to prelinking</li>
   <li>obsoleted libxsltbreakpoint now deprecated and frozen to 1.0.8 API</li>
-  <li>xsltproc return codes are now significant, John Fleck updated the
-    documentation</li>
-  <li>patch to allow as much as 40 steps in patterns (Marc Tardif), should be
-    made dynamic really</li>
-  <li>fixed a bug raised by Nik Clayton when using doctypes with HTML
-  output</li>
+  <li>xsltproc return codes are now significant, John Fleck updated
+    thedocumentation</li>
+  <li>patch to allow as much as 40 steps in patterns (Marc Tardif), should
+    bemade dynamic really</li>
+  <li>fixed a bug raised by Nik Clayton when using doctypes with
+  HTMLoutput</li>
   <li>patches from Keith Isdale to interface with xsltdebugger</li>
 </ul>
 
 <h3>1.0.8: Nov 26 2001</h3>
 <ul>
-  <li>fixed an annoying header problem, removed a few bugs and some code
-    cleanup</li>
+  <li>fixed an annoying header problem, removed a few bugs and some
+    codecleanup</li>
   <li>patches for Windows and update of Windows Makefiles by Igor</li>
   <li>OpenVMS port instructions from John A Fotheringham</li>
-  <li>fixed some Makefiles annoyance and libraries prelinking
-  informations</li>
+  <li>fixed some Makefiles annoyance and libraries prelinkinginformations</li>
 </ul>
 
 <h3>1.0.7: Nov 10 2001</h3>
@@ -821,29 +831,28 @@
 
 <h3>1.0.6: Oct 30 2001</h3>
 <ul>
-  <li>bug fixes on number formatting (Thomas), date/time functions (Bruce
-    Miller)</li>
+  <li>bug fixes on number formatting (Thomas), date/time functions
+    (BruceMiller)</li>
   <li>update of the Windows Makefiles (Igor)</li>
   <li>fixed DOCTYPE generation rules for HTML output (me)</li>
 </ul>
 
 <h3>1.0.5: Oct 10 2001</h3>
 <ul>
-  <li>some portability fixes, including Windows makefile updates from
-  Igor</li>
+  <li>some portability fixes, including Windows makefile updates fromIgor</li>
   <li>fixed a dozen bugs on XSLT and EXSLT (me and Thomas Broyer)</li>
-  <li>support for Saxon's evaluate and expressions extensions added (initial
-    contribution from Darren Graves)</li>
+  <li>support for Saxon's evaluate and expressions extensions added
+    (initialcontribution from Darren Graves)</li>
   <li>better handling of XPath evaluation errors</li>
 </ul>
 
 <h3>1.0.4: Sep 12 2001</h3>
 <ul>
   <li>Documentation updates from John fleck</li>
-  <li>bug fixes (DocBook  FO generation should be fixed)  and portability
-    improvements</li>
-  <li>Thomas Broyer improved the existing EXSLT support and added String,
-    Time and Date core functions support</li>
+  <li>bug fixes (DocBook  FO generation should be fixed)  and
+    portabilityimprovements</li>
+  <li>Thomas Broyer improved the existing EXSLT support and added String,Time
+    and Date core functions support</li>
 </ul>
 
 <h3>1.0.3:  Aug 23 2001</h3>
@@ -874,17 +883,17 @@
 <h3>1.0.0: July 10 2001</h3>
 <ul>
   <li>a lot of cleanup, a lot of regression tests added or fixed</li>
-  <li>added a documentation for <a href="extensions.html">writing
-    extensions</a></li>
+  <li>added a documentation for <a
+    href="extensions.html">writingextensions</a></li>
   <li>fixed some variable evaluation problems (with William)</li>
-  <li>added profiling of stylesheet execution accessible as the xsltproc
-    --profile option</li>
-  <li>fixed element-available() and the implementation of the various
-    chunking methods present, Norm Walsh provided a lot of feedback</li>
-  <li>exclude-result-prefixes and namespaces output should now work as
-    expected</li>
-  <li>added support of embedded stylesheet as described in section 2.7 of the
-    spec</li>
+  <li>added profiling of stylesheet execution accessible as the
+    xsltproc--profile option</li>
+  <li>fixed element-available() and the implementation of the variouschunking
+    methods present, Norm Walsh provided a lot of feedback</li>
+  <li>exclude-result-prefixes and namespaces output should now work
+  asexpected</li>
+  <li>added support of embedded stylesheet as described in section 2.7 of
+    thespec</li>
 </ul>
 
 <h3>0.14.0: July 5 2001</h3>
@@ -893,8 +902,9 @@
   <li>completion of the little XSLT-1.0 features left unimplemented</li>
   <li>Added and implemented the extension API suggested by Thomas Broyer</li>
   <li>the Windows MSC environment should be complete</li>
-  <li>tested and optimized with a really large document (DocBook Definitive
-    Guide) libxml/libxslt should really be faster on serious workloads</li>
+  <li>tested and optimized with a really large document (DocBook
+    DefinitiveGuide) libxml/libxslt should really be faster on serious
+    workloads</li>
 </ul>
 
 <h3>0.13.0: June 26 2001</h3>
@@ -902,29 +912,29 @@
   <li>lots of cleanups</li>
   <li>fixed a C++ compilation problem</li>
   <li>couple of fixes to xsltSaveTo()</li>
-  <li>try to fix Docbook-xslt-1.4 and chunking, updated the regression test
-    with them</li>
+  <li>try to fix Docbook-xslt-1.4 and chunking, updated the regression
+    testwith them</li>
   <li>fixed pattern compilation and priorities problems</li>
   <li>Patches for Windows and MSC project mostly contributed by Yon Derek</li>
   <li>update to the Tutorial by John Fleck</li>
   <li>William fixed bugs in templates and for-each functions</li>
-  <li>added a new interface xsltRunStylesheet() for a more flexible output
-    (incomplete), added -o option to xsltproc</li>
+  <li>added a new interface xsltRunStylesheet() for a more flexible
+    output(incomplete), added -o option to xsltproc</li>
 </ul>
 
 <h3>0.12.0: June 18 2001</h3>
 <ul>
   <li>fixed a dozen of bugs reported</li>
-  <li>HTML generation should be quite better (requires libxml-2.3.11 upgrade
-    too)</li>
+  <li>HTML generation should be quite better (requires libxml-2.3.11
+    upgradetoo)</li>
   <li>William fixed some problems with document()</li>
-  <li>Fix namespace nodes selection and copy (requires libxml-2.3.11 upgrade
-    too)</li>
-  <li>John Fleck added a<a href="tutorial/libxslttutorial.html">
-  tutorial</a></li>
+  <li>Fix namespace nodes selection and copy (requires libxml-2.3.11
+    upgradetoo)</li>
+  <li>John Fleck added a<a
+  href="tutorial/libxslttutorial.html">tutorial</a></li>
   <li>Fixes for namespace handling when evaluating variables</li>
-  <li>XInclude global flag added to process XInclude on document() if
-    requested</li>
+  <li>XInclude global flag added to process XInclude on document()
+  ifrequested</li>
   <li>made xsltproc --version more detailed</li>
 </ul>
 
@@ -944,8 +954,8 @@
 <ul>
   <li>cleanups to make stylesheet read-only (not 100% complete)</li>
   <li>fixed URI resolution in document()</li>
-  <li>force all XPath expression to be compiled at stylesheet parsing time,
-    even if unused ...</li>
+  <li>force all XPath expression to be compiled at stylesheet parsing
+    time,even if unused ...</li>
   <li>Fixed HTML default output detection</li>
   <li>Fixed double attribute generation #54446</li>
   <li>Fixed {{ handling in attributes #54451</li>
@@ -955,8 +965,8 @@
   <li>William Brack and Bjorn Reese improved format-number()</li>
   <li>Fixed multiple sort, it should really work now</li>
   <li>added a --docbook option for SGML DocBook input (hackish)</li>
-  <li>a number of other bug fixes and regression test added as people were
-    submitting them</li>
+  <li>a number of other bug fixes and regression test added as people
+    weresubmitting them</li>
 </ul>
 
 <h3>0.9.0: May 3 2001</h3>
@@ -964,10 +974,10 @@
   <li>lot of various bugfixes, extended the regression suite</li>
   <li>xsltproc should work with multiple params</li>
   <li>added an option to use xsltproc with HTML input</li>
-  <li>improved the stylesheet compilation, processing of complex stylesheets
-    should be faster</li>
-  <li>using the same stylesheet for concurrent processing on multithreaded
-    programs should work now</li>
+  <li>improved the stylesheet compilation, processing of complex
+    stylesheetsshould be faster</li>
+  <li>using the same stylesheet for concurrent processing on
+    multithreadedprograms should work now</li>
   <li>fixed another batch of namespace handling problems</li>
   <li>Implemented multiple level of sorting</li>
 </ul>
@@ -977,11 +987,11 @@
   <li>fixed ansidecl.h problem</li>
   <li>fixed unparsed-entity-uri() and generate-id()</li>
   <li>sort semantic fixes and priority prob from William M. Brack</li>
-  <li>fixed namespace handling problems in XPath expression computations
-    (requires libxml-2.3.7)</li>
+  <li>fixed namespace handling problems in XPath expression
+    computations(requires libxml-2.3.7)</li>
   <li>fixes to current() and key()</li>
-  <li>other, smaller fixes, lots of testing with N Walsh DocBook HTML
-    stylesheets</li>
+  <li>other, smaller fixes, lots of testing with N Walsh DocBook
+    HTMLstylesheets</li>
 </ul>
 
 <h3>0.7.0: Apr 10 2001</h3>
@@ -1003,13 +1013,13 @@
 <h3>0.5.0: Mar 10 2001</h3>
 <ul>
   <li>fifth beta</li>
-  <li>some optimization work, for the moment 2 XSLT transform cannot use the
-    same stylesheet at the same time (to be fixed)</li>
+  <li>some optimization work, for the moment 2 XSLT transform cannot use
+    thesame stylesheet at the same time (to be fixed)</li>
   <li>fixed problems with handling of tree results</li>
   <li>fixed a reported strip-spaces problem</li>
   <li>added more reported/fixed bugs to the test suite</li>
-  <li>incorporated William M. Brack fix for imports and global variables as
-    well as patch for with-param support in apply-templates</li>
+  <li>incorporated William M. Brack fix for imports and global variables
+    aswell as patch for with-param support in apply-templates</li>
   <li>a bug fix on for-each</li>
 </ul>
 
@@ -1033,15 +1043,14 @@
 <h3>0.2.0: Feb 15 2001</h3>
 <ul>
   <li>second beta version, released at the same time as libxml2-2.3.1</li>
-  <li>getting close to feature completion, lot of bug fixes, some in the HTML
-    and XPath support of libxml</li>
-  <li>start becoming usable for real work. This version can now regenerate
-    the XML 2e HTML from the original XML sources and the associated
-    stylesheets (in <a
-    href="http://www.w3.org/TR/REC-xml#b4d250b6c21">section I of the XML
-    REC</a>)</li>
-  <li>Still misses extension element/function/prefixes support. Support of
-    key() and document() is not complete</li>
+  <li>getting close to feature completion, lot of bug fixes, some in the
+    HTMLand XPath support of libxml</li>
+  <li>start becoming usable for real work. This version can now regeneratethe
+    XML 2e HTML from the original XML sources and the associatedstylesheets
+    (in <a href="http://www.w3.org/TR/REC-xml#b4d250b6c21">section I of the
+    XMLREC</a>)</li>
+  <li>Still misses extension element/function/prefixes support. Support
+    ofkey() and document() is not complete</li>
 </ul>
 
 <h3>0.1.0: Feb 8 2001</h3>
@@ -1053,19 +1062,19 @@
 <h3>0.0.1: Jan 25 2001</h3>
 <ul>
   <li>first alpha version released at the same time as libxml2-2.2.12</li>
-  <li>Framework in place, should work on simple examples, but far from being
-    feature complete</li>
+  <li>Framework in place, should work on simple examples, but far from
+    beingfeature complete</li>
 </ul>
 
 <h2><a name="xsltproc">The xsltproc tool</a></h2>
 
-<p>This program is the simplest way to use libxslt: from the command line. It
-is also used for doing the regression tests of the library.</p>
+<p>This program is the simplest way to use libxslt: from the command line.
+Itis also used for doing the regression tests of the library.</p>
 
-<p>It takes as first argument the path or URL to an XSLT stylesheet, the next
-arguments are filenames or URIs of the inputs to be processed. The output of
-the processing is redirected on the standard output. There is actually a few
-more options available:</p>
+<p>It takes as first argument the path or URL to an XSLT stylesheet, the
+nextarguments are filenames or URIs of the inputs to be processed. The output
+ofthe processing is redirected on the standard output. There is actually a
+fewmore options available:</p>
 <pre>orchis:~ -&gt; xsltproc
 Usage: xsltproc [options] stylesheet file [file ...]
    Options:
@@ -1092,83 +1101,82 @@
 
 <p><img src="duck.png" align="right" alt="The duck picture"></p>
 
-<p><a href="http://www.oasis-open.org/committees/docbook/">DocBook</a> is an
-XML/SGML vocabulary particularly well suited to books and papers about
-computer hardware and software.</p>
+<p><a href="http://www.oasis-open.org/committees/docbook/">DocBook</a>is
+anXML/SGML vocabulary particularly well suited to books and papers
+aboutcomputer hardware and software.</p>
 
-<p>xsltproc and libxslt are not specifically dependant on DocBook, but since
-a lot of people use xsltproc and libxml2 for DocBook formatting, here are a
-few pointers and informations which may be helpful:</p>
+<p>xsltproc and libxslt are not specifically dependant on DocBook, but sincea
+lot of people use xsltproc and libxml2 for DocBook formatting, here are afew
+pointers and informations which may be helpful:</p>
 <ul>
-  <li>The <a href="http://www.oasis-open.org/committees/docbook/">DocBook
-    homepage at Oasis</a> you should find pointers there on all the lastest
-    versions of the DTDs and XSLT stylesheets</li>
-  <li><a href="http://www.docbook.org/">DocBook: The Definitive Guide</a> is
-    the official reference documentation for DocBook.</li>
+  <li>The <a
+    href="http://www.oasis-open.org/committees/docbook/">DocBookhomepage at
+    Oasis</a>you should find pointers there on all the lastestversions of the
+    DTDs and XSLT stylesheets</li>
+  <li><a href="http://www.docbook.org/">DocBook: The Definitive
+    Guide</a>isthe official reference documentation for DocBook.</li>
   <li><a
-    href="https://sourceforge.net/docman/index.php?group_id=21935">DocBook
-    Open Repository</a> contains a lot of informations about DocBook</li>
-  <li>Bob Stayton provides a <a href="http://www.sagehill.net/">lot of
-    resources</a> and consulting services around DocBook.</li>
-  <li>Here is a <a href="/buildDocBookCatalog">shell script</a> to generate
-    XML Catalogs for DocBook 4.1.2 . If it can write to the /etc/xml/
-    directory, it will set-up /etc/xml/catalog and /etc/xml/docbook based on
-    the resources found on the system. Otherwise it will just create
-    ~/xmlcatalog and ~/dbkxmlcatalog and doing:
+    href="https://sourceforge.net/docman/index.php?group_id=21935">DocBookOpen
+    Repository</a>contains a lot of informations about DocBook</li>
+  <li>Bob Stayton provides a <a href="http://www.sagehill.net/">lot
+    ofresources</a>and consulting services around DocBook.</li>
+  <li>Here is a <a href="/buildDocBookCatalog">shell script</a>to generateXML
+    Catalogs for DocBook 4.1.2 . If it can write to the /etc/xml/directory,
+    it will set-up /etc/xml/catalog and /etc/xml/docbook based onthe
+    resources found on the system. Otherwise it will just create~/xmlcatalog
+    and ~/dbkxmlcatalog and doing:
     <p><code>export XMLCATALOG=$HOME/xmlcatalog</code></p>
-    <p>should allow to process DocBook documentations without requiring
-    network accesses for the DTd or stylesheets</p>
+    <p>should allow to process DocBook documentations without
+    requiringnetwork accesses for the DTd or stylesheets</p>
   </li>
-  <li>I have uploaded <a href="ftp://xmlsoft.org/libxml2/test/dbk412catalog.tar.gz">a
-    small tarball</a> containing XML Catalogs for DocBook 4.1.2 which seems
-    to work fine for me too</li>
+  <li>I have uploaded <a
+    href="ftp://xmlsoft.org/libxml2/test/dbk412catalog.tar.gz">asmall
+    tarball</a>containing XML Catalogs for DocBook 4.1.2 which seemsto work
+    fine for me too</li>
   <li>Informations on installing a <a
-    href="http://ourworld.compuserve.com/homepages/hoenicka_markus/ntsgml.html">Windows
-    DocBook processing setup</a> based on Cygwin (using the binaries from the
-    official Windows port should be possible too)</li>
+    href="http://ourworld.compuserve.com/homepages/hoenicka_markus/ntsgml.html">WindowsDocBook
+    processing setup</a>based on Cygwin (using the binaries from theofficial
+    Windows port should be possible too)</li>
   <li>Alexander Kirillov's page on <a
-    href="http://www.math.sunysb.edu/~kirillov/dbxml/">Using DocBook XML
-    4.1.2</a> (RPM packages)</li>
-  <li>Tim Waugh's <a href="http://cyberelk.net/tim/xmlto/">xmlto front-end
-    conversion script</a></li>
+    href="http://www.math.sunysb.edu/~kirillov/dbxml/">Using DocBook
+    XML4.1.2</a>(RPM packages)</li>
+  <li>Tim Waugh's <a href="http://cyberelk.net/tim/xmlto/">xmlto
+    front-endconversion script</a></li>
   <li>Linux Documentation Project <a
-    href="http://www.linuxdoc.org/HOWTO/mini/DocBook-Install/">
-    DocBook-Install-mini-HOWTO</a></li>
+    href="http://www.linuxdoc.org/HOWTO/mini/DocBook-Install/">DocBook-Install-mini-HOWTO</a></li>
   <li>ScrollKeeper the open documentation cataloging project has a <a
-    href="http://scrollkeeper.sourceforge.net/docbook.shtml">DocBook
-    section</a></li>
+    href="http://scrollkeeper.sourceforge.net/docbook.shtml">DocBooksection</a></li>
   <li>Dan York presentation on <a
-    href="http://www.lodestar2.com/people/dyork/talks/2001/xugo/docbook/index.html">Publishing
-    using DocBook XML</a></li>
+    href="http://www.lodestar2.com/people/dyork/talks/2001/xugo/docbook/index.html">Publishingusing
+    DocBook XML</a></li>
 </ul>
 
-<p>Do not use the --docbook option of xsltproc to process XML DocBook
-documents, this option is only intended to provide some (limited) support of
-the SGML version of DocBook.</p>
+<p>Do not use the --docbook option of xsltproc to process XML
+DocBookdocuments, this option is only intended to provide some (limited)
+support ofthe SGML version of DocBook.</p>
 
-<p>Points which are not DocBook specific but still worth mentionning
-again:</p>
+<p>Points which are not DocBook specific but still worth mentionningagain:</p>
 <ul>
-  <li>if you think DocBook processing time is too slow, make sure you have
-    XML Catalogs pointing to a local installation of the DTD of DocBook.
-    Check the <a href="http://xmlsoft.org/catalog.html">XML Catalog page</a>
-    to understand more on this subject.</li>
+  <li>if you think DocBook processing time is too slow, make sure you haveXML
+    Catalogs pointing to a local installation of the DTD of DocBook.Check the
+    <a href="http://xmlsoft.org/catalog.html">XML Catalog page</a>to
+    understand more on this subject.</li>
   <li>before processing a new document, use the command
     <p><code>xmllint --valid --noout path_to_document</code></p>
-    <p>to make sure that your input is valid DocBook. And fixes the errors
-    before processing further. Note that XSLT processing may work correctly
-    with some forms of validity errors left, but in general it can give
-    troubles on output.</p>
+    <p>to make sure that your input is valid DocBook. And fixes the
+    errorsbefore processing further. Note that XSLT processing may work
+    correctlywith some forms of validity errors left, but in general it can
+    givetroubles on output.</p>
   </li>
 </ul>
 
 <h2><a name="API">The programming API</a></h2>
 
-<p>Okay this section is clearly incomplete. But integrating libxslt into your
-application should be relatively easy. First check the few steps described
-below, then for more detailed informations, look at the<a
-href="html/libxslt-lib.html"> generated pages</a> for the API and the source
-of libxslt/xsltproc.c  and the  <a
+<p>Okay this section is clearly incomplete. But integrating libxslt into
+yourapplication should be relatively easy. First check the few steps
+describedbelow, then for more detailed informations, look at the<a
+href="html/libxslt-lib.html">generated pages</a>for the API and the sourceof
+libxslt/xsltproc.c  and the  <a
 href="tutorial/libxslttutorial.html">tutorial</a>.</p>
 
 <p>Basically doing an XSLT transformation can be done in a few steps:</p>
@@ -1180,101 +1188,100 @@
   <li>parse the stylesheet with xsltParseStylesheetFile()</li>
   <li>parse the document with xmlParseFile()</li>
   <li>apply the stylesheet using xsltApplyStylesheet()</li>
-  <li>save the result using xsltSaveResultToFile() if needed set
-    xmlIndentTreeOutput to 1</li>
+  <li>save the result using xsltSaveResultToFile() if needed
+    setxmlIndentTreeOutput to 1</li>
 </ol>
 
-<p>Steps 2,3, and 5 will probably need to be changed depending on you
-processing needs and environment for example if reading/saving from/to
-memory, or if you want to apply XInclude processing to the stylesheet or
-input documents.</p>
+<p>Steps 2,3, and 5 will probably need to be changed depending on
+youprocessing needs and environment for example if reading/saving
+from/tomemory, or if you want to apply XInclude processing to the stylesheet
+orinput documents.</p>
 
 <h2><a name="Python">Python and bindings</a></h2>
 
-<p>There is a number of language bindings and wrappers available for libxml2,
-the list below is not exhaustive. Please contact the <a
-href="http://mail.gnome.org/mailman/listinfo/xml-bindings">xml-bindings at gnome.org</a>
-(<a href="http://mail.gnome.org/archives/xml-bindings/">archives</a>) in
-order to get updates to this list or to discuss the specific topic of libxml2
-or libxslt wrappers or bindings:</p>
+<p>There is a number of language bindings and wrappers available for
+libxml2,the list below is not exhaustive. Please contact the <a
+href="http://mail.gnome.org/mailman/listinfo/xml-bindings">xml-bindings at gnome.org</a>(<a
+href="http://mail.gnome.org/archives/xml-bindings/">archives</a>) inorder to
+get updates to this list or to discuss the specific topic of libxml2or
+libxslt wrappers or bindings:</p>
 <ul>
   <li><a
-    href="http://mail.gnome.org/archives/xml/2001-March/msg00014.html">Matt
-    Sergeant</a> developped <a href="http://axkit.org/download/">XML::LibXML
-    and XML::LibXSLT</a>, Perl wrappers for libxml2/libxslt as part of the <a
+    href="http://mail.gnome.org/archives/xml/2001-March/msg00014.html">MattSergeant</a>developped
+    <a href="http://axkit.org/download/">XML::LibXMLand XML::LibXSLT</a>,
+    Perl wrappers for libxml2/libxslt as part of the <a
     href="http://axkit.com/">AxKit XML application server</a></li>
-  <li><a href="mailto:dkuhlman at cutter.rexx.com">Dave Kuhlman</a> provides and
-    earlier version of the libxml/libxslt <a
+  <li><a href="mailto:dkuhlman at cutter.rexx.com">Dave Kuhlman</a>provides
+    andearlier version of the libxml/libxslt <a
     href="http://www.rexx.com/~dkuhlman">wrappers for Python</a></li>
   <li>Petr Kozelka provides <a
-    href="http://sourceforge.net/projects/libxml2-pas">Pascal units to glue
-    libxml2</a> with Kylix, Delphi and other Pascal compilers</li>
+    href="http://sourceforge.net/projects/libxml2-pas">Pascal units to
+    gluelibxml2</a>with Kylix, Delphi and other Pascal compilers</li>
   <li>Wai-Sun "Squidster" Chia provides <a
-    href="http://www.rubycolor.org/arc/redist/">bindings for Ruby</a>  and
-    libxml2 bindings are also available in Ruby through the <a
-    href="http://libgdome-ruby.berlios.de/">libgdome-ruby</a> module
-    maintained by Tobias Peters.</li>
+    href="http://www.rubycolor.org/arc/redist/">bindings for
+    Ruby</a>andlibxml2 bindings are also available in Ruby through the <a
+    href="http://libgdome-ruby.berlios.de/">libgdome-ruby</a>modulemaintained
+    by Tobias Peters.</li>
   <li>Steve Ball and contributors maintains <a
-    href="http://tclxml.sourceforge.net/">libxml2 and libxslt bindings for
-    Tcl</a></li>
-  <li><a href="mailto:xmlwrapp at pmade.org">Peter Jones</a> maintains C++
-    bindings for libxslt within <a
+    href="http://tclxml.sourceforge.net/">libxml2 and libxslt bindings
+    forTcl</a></li>
+  <li><a href="mailto:xmlwrapp at pmade.org">Peter Jones</a>maintains
+    C++bindings for libxslt within <a
     href="http://pmade.org/pjones/software/xmlwrapp/">xmlwrapp</a></li>
-  <li><a href="phillim2 at comcast.net">Mike Phillips</a> provides a module
-    using <a href="http://siasl.dyndns.org/projects/projects.html">libxslt
-    for PHP</a>.</li>
-  <li><a href="http://savannah.gnu.org/projects/classpathx/">LibxmlJ</a> is
-    an effort to create a 100% JAXP-compatible Java wrapper for libxml2 and
-    libxslt as part of GNU ClasspathX project.</li>
-  <li>Patrick McPhee provides Rexx bindings fof libxml2 and libxslt, look for
-    <a href="http://www.interlog.com/~ptjm/software.html">RexxXML</a>.</li>
+  <li><a href="phillim2 at comcast.net">Mike Phillips</a>provides a moduleusing
+    <a href="http://siasl.dyndns.org/projects/projects.html">libxsltfor
+    PHP</a>.</li>
+  <li><a href="http://savannah.gnu.org/projects/classpathx/">LibxmlJ</a>isan
+    effort to create a 100% JAXP-compatible Java wrapper for libxml2
+    andlibxslt as part of GNU ClasspathX project.</li>
+  <li>Patrick McPhee provides Rexx bindings fof libxml2 and libxslt, look
+    for<a href="http://www.interlog.com/~ptjm/software.html">RexxXML</a>.</li>
   <li><a
-    href="http://www.satimage.fr/software/en/xml_suite.html">Satimage</a>
-    provides <a
-    href="http://www.satimage.fr/software/en/downloads_osaxen.html">XMLLib
-    osax</a>. This is an osax for Mac OS X with a set of commands to
-    implement in AppleScript the XML DOM, XPATH and XSLT.</li>
+    href="http://www.satimage.fr/software/en/xml_suite.html">Satimage</a>provides
+    <a
+    href="http://www.satimage.fr/software/en/downloads_osaxen.html">XMLLibosax</a>.
+    This is an osax for Mac OS X with a set of commands toimplement in
+    AppleScript the XML DOM, XPATH and XSLT.</li>
 </ul>
 
 <p>The libxslt Python module depends on the <a
-href="http://xmlsoft.org/python.html">libxml2 Python</a> module.</p>
+href="http://xmlsoft.org/python.html">libxml2 Python</a>module.</p>
 
-<p>The distribution includes a set of Python bindings, which are garanteed to
-be maintained as part of the library in the future, though the Python
-interface have not yet reached the completeness of the C API.</p>
+<p>The distribution includes a set of Python bindings, which are garanteed
+tobe maintained as part of the library in the future, though the
+Pythoninterface have not yet reached the completeness of the C API.</p>
 
-<p><a href="mailto:stephane.bidoul at softwareag.com">Stéphane Bidoul</a>
-maintains <a href="http://users.skynet.be/sbi/libxml-python/">a Windows port
-of the Python bindings</a>.</p>
+<p><a href="mailto:stephane.bidoul at softwareag.com">Stéphane
+Bidoul</a>maintains <a href="http://users.skynet.be/sbi/libxml-python/">a
+Windows portof the Python bindings</a>.</p>
 
-<p>Note to people interested in building bindings, the API is formalized as
-<a href="libxslt-api.xml">an XML API description file</a> which allows to
-automate a large part of the Python bindings, this includes function
-descriptions, enums, structures, typedefs, etc... The Python script used to
-build the bindings is python/generator.py in the source distribution.</p>
+<p>Note to people interested in building bindings, the API is formalized as<a
+href="libxslt-api.xml">an XML API description file</a>which allows toautomate
+a large part of the Python bindings, this includes functiondescriptions,
+enums, structures, typedefs, etc... The Python script used tobuild the
+bindings is python/generator.py in the source distribution.</p>
 
 <p>To install the Python bindings there are 2 options:</p>
 <ul>
   <li>If you use an RPM based distribution, simply install the <a
-    href="http://rpmfind.net/linux/rpm2html/search.php?query=libxml2-python">libxml2-python
-    RPM</a> and the <a
-    href="http://rpmfind.net/linux/rpm2html/search.php?query=libxslt-python">libxslt-python
-    RPM</a>.</li>
-  <li>Otherwise use the <a href="ftp://xmlsoft.org/libxml2/python/">libxml2-python
-    module distribution</a> corresponding to your installed version of
-    libxml2 and libxslt. Note that to install it you will need both libxml2
-    and libxslt installed and run "python setup.py build install" in the
-    module tree.</li>
+    href="http://rpmfind.net/linux/rpm2html/search.php?query=libxml2-python">libxml2-pythonRPM</a>and
+    the <a
+    href="http://rpmfind.net/linux/rpm2html/search.php?query=libxslt-python">libxslt-pythonRPM</a>.</li>
+  <li>Otherwise use the <a
+    href="ftp://xmlsoft.org/libxml2/python/">libxml2-pythonmodule
+    distribution</a>corresponding to your installed version oflibxml2 and
+    libxslt. Note that to install it you will need both libxml2and libxslt
+    installed and run "python setup.py build install" in themodule tree.</li>
 </ul>
 
-<p>The distribution includes a set of examples and regression tests for the
-python bindings in the <code>python/tests</code> directory. Here are some
-excepts from those tests:</p>
+<p>The distribution includes a set of examples and regression tests for
+thepython bindings in the <code>python/tests</code>directory. Here are
+someexcepts from those tests:</p>
 
 <h3>basic.py:</h3>
 
-<p>This is a basic test of XSLT interfaces: loading a stylesheet and a
-document, transforming the document and saving the result.</p>
+<p>This is a basic test of XSLT interfaces: loading a stylesheet and
+adocument, transforming the document and saving the result.</p>
 <pre>import libxml2
 import libxslt
 
@@ -1287,36 +1294,36 @@
 doc.freeDoc()
 result.freeDoc()</pre>
 
-<p>The Python module is called libxslt, you will also need the libxml2 module
-for the operations on XML trees. Let's have a look at the objects manipulated
-in that example and how is the processing done:</p>
+<p>The Python module is called libxslt, you will also need the libxml2
+modulefor the operations on XML trees. Let's have a look at the objects
+manipulatedin that example and how is the processing done:</p>
 <ul>
-  <li><code>styledoc</code> : is a libxml2 document tree. It is obtained by
-    parsing the XML file "test.xsl" containing the stylesheet.</li>
-  <li><code>style</code> : this is a precompiled stylesheet ready to be used
-    by the following transformations (note the plural form, multiple
-    transformations can resuse the same stylesheet).</li>
-  <li><code>doc</code> : this is the document to apply the transformation to.
-    In this case it is simply generated by parsing it from a file but any
-    other processing is possible as long as one get a libxml2 Doc. Note that
-    HTML tree are suitable for XSLT processing in libxslt. This is actually
-    how this page is generated !</li>
-  <li><code>result</code> : this is a document generated by applying the
-    stylesheet to the document. Note that some of the stylesheet informations
-    may be related to the serialization of that document and as in this
-    example a specific saveResultToFilename() method of the stylesheet should
-    be used to save it to a file (in that case to "foo").</li>
+  <li><code>styledoc</code>: is a libxml2 document tree. It is obtained
+    byparsing the XML file "test.xsl" containing the stylesheet.</li>
+  <li><code>style</code>: this is a precompiled stylesheet ready to be usedby
+    the following transformations (note the plural form,
+    multipletransformations can resuse the same stylesheet).</li>
+  <li><code>doc</code>: this is the document to apply the transformation
+    to.In this case it is simply generated by parsing it from a file but
+    anyother processing is possible as long as one get a libxml2 Doc. Note
+    thatHTML tree are suitable for XSLT processing in libxslt. This is
+    actuallyhow this page is generated !</li>
+  <li><code>result</code>: this is a document generated by applying
+    thestylesheet to the document. Note that some of the stylesheet
+    informationsmay be related to the serialization of that document and as
+    in thisexample a specific saveResultToFilename() method of the stylesheet
+    shouldbe used to save it to a file (in that case to "foo").</li>
 </ul>
 
-<p>Also note the need to explicitely deallocate documents with freeDoc()
-except for the stylesheet document which is freed when its compiled form is
-garbage collected.</p>
+<p>Also note the need to explicitely deallocate documents with
+freeDoc()except for the stylesheet document which is freed when its compiled
+form isgarbage collected.</p>
 
 <h3>extfunc.py:</h3>
 
-<p>This one is a far more complex test. It shows how to modify the behaviour
-of an XSLT transformation by passing parameters and how to extend the XSLT
-engine with functions defined in python:</p>
+<p>This one is a far more complex test. It shows how to modify the
+behaviourof an XSLT transformation by passing parameters and how to extend
+the XSLTengine with functions defined in python:</p>
 <pre>import libxml2
 import libxslt
 import string
@@ -1340,22 +1347,22 @@
 
 libxslt.registerExtModuleFunction("foo", "http://example.com/foo", f)</pre>
 
-<p>This code defines and register an extension function. Note that the
-function can be bound to any name (foo) and how the binding is also
-associated to a namespace name "http://example.com/foo". From an XSLT point
-of view the function just returns an upper case version of the string passed
-as a parameter. But the first part of the function also read some contextual
-information from the current XSLT processing environement, in that case it
-looks for the current insertion node in the resulting output (either the
-resulting document or the Result Value Tree being generated), and saves it to
-a global variable for checking that the access actually worked.</p>
+<p>This code defines and register an extension function. Note that
+thefunction can be bound to any name (foo) and how the binding is
+alsoassociated to a namespace name "http://example.com/foo". From an XSLT
+pointof view the function just returns an upper case version of the string
+passedas a parameter. But the first part of the function also read some
+contextualinformation from the current XSLT processing environement, in that
+case itlooks for the current insertion node in the resulting output (either
+theresulting document or the Result Value Tree being generated), and saves it
+toa global variable for checking that the access actually worked.</p>
 
-<p>For more informations on the xpathParserContext and transformContext
-objects check the <a href="internals.html">libray internals description</a>.
-The pctxt is actually an object from a class derived from the
-libxml2.xpathParserContext() with just a couple more properties including the
-possibility to look up the XSLT transformation context from the XPath
-context.</p>
+<p>For more informations on the xpathParserContext and
+transformContextobjects check the <a href="internals.html">libray internals
+description</a>.The pctxt is actually an object from a class derived from
+thelibxml2.xpathParserContext() with just a couple more properties including
+thepossibility to look up the XSLT transformation context from the
+XPathcontext.</p>
 <pre>styledoc = libxml2.parseDoc("""
 &lt;xsl:stylesheet version='1.0'
   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
@@ -1369,13 +1376,13 @@
 &lt;/xsl:stylesheet&gt;
 """)</pre>
 
-<p>Here is a simple example of how to read an XML document from a python
-string with libxml2. Note how this stylesheet:</p>
+<p>Here is a simple example of how to read an XML document from a
+pythonstring with libxml2. Note how this stylesheet:</p>
 <ul>
   <li>Uses a global parameter <code>bar</code></li>
   <li>Reference the extension function f</li>
-  <li>how the Namespace name "http://example.com/foo" has to be bound to a
-    prefix</li>
+  <li>how the Namespace name "http://example.com/foo" has to be bound to
+    aprefix</li>
   <li>how that prefix is excluded from the output</li>
   <li>how the function is called from the select</li>
 </ul>
@@ -1385,10 +1392,10 @@
 style.freeStylesheet()
 doc.freeDoc()</pre>
 
-<p>that part is identical, to the basic example except that the
-transformation is passed a dictionnary of parameters. Note that the string
-passed "success" had to be quoted, otherwise it is interpreted as an XPath
-query for the childs of root named "success".</p>
+<p>that part is identical, to the basic example except that thetransformation
+is passed a dictionnary of parameters. Note that the stringpassed "success"
+had to be quoted, otherwise it is interpreted as an XPathquery for the childs
+of root named "success".</p>
 <pre>root = result.children
 if root.name != "article":
     print "Unexpected root node name"
@@ -1402,22 +1409,24 @@
 
 result.freeDoc()</pre>
 
-<p>That part just verifies that the transformation worked, that the parameter
-got properly passed to the engine, that the function f() got called and that
-it properly accessed the context to find the name of the insertion node.</p>
+<p>That part just verifies that the transformation worked, that the
+parametergot properly passed to the engine, that the function f() got called
+and thatit properly accessed the context to find the name of the insertion
+node.</p>
 
 <h3>pyxsltproc.py:</h3>
 
-<p>this module is a bit too long to be described there but it is basically a
-rewrite of the xsltproc command line interface of libxslt in Python. It
-provides nearly all the functionalities of xsltproc and can be used as a base
-module to write Python customized XSLT processors. One of the thing to notice
-are:</p>
+<p>this module is a bit too long to be described there but it is basically
+arewrite of the xsltproc command line interface of libxslt in Python.
+Itprovides nearly all the functionalities of xsltproc and can be used as a
+basemodule to write Python customized XSLT processors. One of the thing to
+noticeare:</p>
 <pre>libxml2.lineNumbersDefault(1)
 libxml2.substituteEntitiesDefault(1)</pre>
 
-<p>those two calls in the main() function are needed to force the libxml2
-processor to generate DOM trees compliant with the XPath data model.</p>
+<p>those two calls in the main() function are needed to force the
+libxml2processor to generate DOM trees compliant with the XPath data
+model.</p>
 
 <h2><a name="Internals">Library internals</a></h2>
 
@@ -1433,8 +1442,7 @@
   <li><a href="internals.html#processing">The processing itself</a></li>
   <li><a href="internals.html#XPath">XPath expressions compilation</a></li>
   <li><a href="internals.html#XPath1">XPath interpretation</a></li>
-  <li><a href="internals.html#Descriptio">Description of XPath
-  Objects</a></li>
+  <li><a href="internals.html#Descriptio">Description of XPathObjects</a></li>
   <li><a href="internals.html#XPath3">XPath functions</a></li>
   <li><a href="internals.html#stack">The variables stack frame</a></li>
   <li><a href="internals.html#Extension">Extension support</a></li>
@@ -1446,246 +1454,248 @@
 
 <p>This document describes the processing of <a
 href="http://xmlsoft.org/XSLT/">libxslt</a>, the <a
-href="http://www.w3.org/TR/xslt">XSLT</a> C library developed for the <a
-href="http://www.gnome.org/">Gnome</a> project.</p>
+href="http://www.w3.org/TR/xslt">XSLT</a>C library developed for the <a
+href="http://www.gnome.org/">Gnome</a>project.</p>
 
-<p>Note: this documentation is by definition incomplete and I am not good at
-spelling, grammar, so patches and suggestions are <a
+<p>Note: this documentation is by definition incomplete and I am not good
+atspelling, grammar, so patches and suggestions are <a
 href="mailto:veillard at redhat.com">really welcome</a>.</p>
 
 <h3><a name="Basics1">Basics</a></h3>
 
-<p>XSLT is a transformation language. It takes an input document and a
-stylesheet document and generates an output document:</p>
+<p>XSLT is a transformation language. It takes an input document and
+astylesheet document and generates an output document:</p>
 
 <p align="center"><img src="processing.gif"
 alt="the XSLT processing model"></p>
 
 <p>Libxslt is written in C. It relies on <a
-href="http://www.xmlsoft.org/">libxml</a>, the XML C library for Gnome, for
-the following operations:</p>
+href="http://www.xmlsoft.org/">libxml</a>, the XML C library for Gnome,
+forthe following operations:</p>
 <ul>
   <li>parsing files</li>
-  <li>building the in-memory DOM structure associated with the documents
-    handled</li>
+  <li>building the in-memory DOM structure associated with the
+    documentshandled</li>
   <li>the XPath implementation</li>
-  <li>serializing back the result document to XML and HTML. (Text is handled
-    directly.)</li>
+  <li>serializing back the result document to XML and HTML. (Text is
+    handleddirectly.)</li>
 </ul>
 
 <h3><a name="Keep1">Keep it simple stupid</a></h3>
 
-<p>Libxslt is not very specialized. It is built under the assumption that all
-nodes from the source and output document can fit in the virtual memory of
-the system. There is a big trade-off there. It is fine for reasonably sized
-documents but may not be suitable for large sets of data. The gain is that it
-can be used in a relatively versatile way. The input or output may never be
-serialized, but the size of documents it can handle are limited by the size
-of the memory available.</p>
+<p>Libxslt is not very specialized. It is built under the assumption that
+allnodes from the source and output document can fit in the virtual memory
+ofthe system. There is a big trade-off there. It is fine for reasonably
+sizeddocuments but may not be suitable for large sets of data. The gain is
+that itcan be used in a relatively versatile way. The input or output may
+never beserialized, but the size of documents it can handle are limited by
+the sizeof the memory available.</p>
 
-<p>More specialized memory handling approaches are possible, like building
-the input tree from a serialization progressively as it is consumed,
-factoring repetitive patterns, or even on-the-fly generation of the output as
-the input is parsed but it is possible only for a limited subset of the
-stylesheets. In general the implementation of libxslt follows the following
-pattern:</p>
+<p>More specialized memory handling approaches are possible, like buildingthe
+input tree from a serialization progressively as it is consumed,factoring
+repetitive patterns, or even on-the-fly generation of the output asthe input
+is parsed but it is possible only for a limited subset of thestylesheets. In
+general the implementation of libxslt follows the followingpattern:</p>
 <ul>
   <li>KISS (keep it simple stupid)</li>
-  <li>when there is a clear bottleneck optimize on top of this simple
-    framework and refine only as much as is needed to reach the expected
-    result</li>
+  <li>when there is a clear bottleneck optimize on top of this
+    simpleframework and refine only as much as is needed to reach the
+    expectedresult</li>
 </ul>
 
-<p>The result is not that bad, clearly one can do a better job but more
-specialized too. Most optimization like building the tree on-demand would
-need serious changes to the libxml XPath framework. An easy step would be to
-serialize the output directly (or call a set of SAX-like output handler to
-keep this a flexible interface) and hence avoid the memory consumption of the
-result.</p>
+<p>The result is not that bad, clearly one can do a better job but
+morespecialized too. Most optimization like building the tree on-demand
+wouldneed serious changes to the libxml XPath framework. An easy step would
+be toserialize the output directly (or call a set of SAX-like output handler
+tokeep this a flexible interface) and hence avoid the memory consumption of
+theresult.</p>
 
 <h3><a name="libxml">The libxml nodes</a></h3>
 
-<p>DOM-like trees, as used and generated by libxml and libxslt, are
-relatively complex. Most node types follow the given structure except a few
-variations depending on the node type:</p>
+<p>DOM-like trees, as used and generated by libxml and libxslt, arerelatively
+complex. Most node types follow the given structure except a fewvariations
+depending on the node type:</p>
 
 <p align="center"><img src="node.gif" alt="description of a libxml node"></p>
 
-<p>Nodes carry a <strong>name</strong> and the node <strong>type</strong>
-indicates the kind of node it represents, the most common ones are:</p>
+<p>Nodes carry a <strong>name</strong>and the node
+<strong>type</strong>indicates the kind of node it represents, the most
+common ones are:</p>
 <ul>
   <li>document nodes</li>
   <li>element nodes</li>
   <li>text nodes</li>
 </ul>
 
-<p>For the XSLT processing, entity nodes should not be generated (i.e. they
-should be replaced by their content). Most nodes also contains the following
-"navigation" informations:</p>
+<p>For the XSLT processing, entity nodes should not be generated (i.e.
+theyshould be replaced by their content). Most nodes also contains the
+following"navigation" informations:</p>
 <ul>
   <li>the containing <strong>doc</strong>ument</li>
-  <li>the <strong>parent</strong> node</li>
-  <li>the first <strong>children</strong> node</li>
-  <li>the <strong>last</strong> children node</li>
+  <li>the <strong>parent</strong>node</li>
+  <li>the first <strong>children</strong>node</li>
+  <li>the <strong>last</strong>children node</li>
   <li>the <strong>prev</strong>ious sibling</li>
   <li>the following sibling (<strong>next</strong>)</li>
 </ul>
 
-<p>Elements nodes carries the list of attributes in the properties, an
-attribute itself holds the navigation pointers and the children list (the
-attribute value is not represented as a simple string to allow usage of
-entities references).</p>
+<p>Elements nodes carries the list of attributes in the properties,
+anattribute itself holds the navigation pointers and the children list
+(theattribute value is not represented as a simple string to allow usage
+ofentities references).</p>
 
-<p>The <strong>ns</strong> points to the namespace declaration for the
-namespace associated to the node, <strong>nsDef</strong> is the linked list
-of namespace declaration present on element nodes.</p>
+<p>The <strong>ns</strong>points to the namespace declaration for
+thenamespace associated to the node, <strong>nsDef</strong>is the linked
+listof namespace declaration present on element nodes.</p>
 
-<p>Most nodes also carry an <strong>_private</strong> pointer which can be
-used by the application to hold specific data on this node.</p>
+<p>Most nodes also carry an <strong>_private</strong>pointer which can beused
+by the application to hold specific data on this node.</p>
 
 <h3><a name="XSLT">The XSLT processing steps</a></h3>
 
-<p>There are a few steps which are clearly decoupled at the interface
-level:</p>
+<p>There are a few steps which are clearly decoupled at the
+interfacelevel:</p>
 <ol>
   <li>parse the stylesheet and generate a DOM tree</li>
-  <li>take the stylesheet tree and build a compiled version of it (the
-    compilation phase)</li>
+  <li>take the stylesheet tree and build a compiled version of it
+    (thecompilation phase)</li>
   <li>take the input and generate a DOM tree</li>
-  <li>process the stylesheet against the input tree and generate an output
-    tree</li>
+  <li>process the stylesheet against the input tree and generate an
+  outputtree</li>
   <li>serialize the output tree</li>
 </ol>
 
 <p>A few things should be noted here:</p>
 <ul>
   <li>the steps 1/ 3/ and 5/ are optional</li>
-  <li>the stylesheet obtained at 2/ can be reused by multiple processing 4/
-    (and this should also work in threaded programs)</li>
-  <li>the tree provided in 2/ should never be freed using xmlFreeDoc, but by
-    freeing the stylesheet.</li>
-  <li>the input tree 4/ is not modified except the _private field which may
-    be used for labelling keys if used by the stylesheet</li>
+  <li>the stylesheet obtained at 2/ can be reused by multiple processing
+    4/(and this should also work in threaded programs)</li>
+  <li>the tree provided in 2/ should never be freed using xmlFreeDoc, but
+    byfreeing the stylesheet.</li>
+  <li>the input tree 4/ is not modified except the _private field which maybe
+    used for labelling keys if used by the stylesheet</li>
 </ul>
 
 <h3><a name="XSLT1">The XSLT stylesheet compilation</a></h3>
 
-<p>This is the second step described. It takes a stylesheet tree, and
-"compiles" it. This associates to each node a structure stored in the
-_private field and containing information computed in the stylesheet:</p>
+<p>This is the second step described. It takes a stylesheet tree,
+and"compiles" it. This associates to each node a structure stored in
+the_private field and containing information computed in the stylesheet:</p>
 
 <p align="center"><img src="stylesheet.gif"
 alt="a compiled XSLT stylesheet"></p>
 
-<p>One xsltStylesheet structure is generated per document parsed for the
-stylesheet. XSLT documents allow includes and imports of other documents,
-imports are stored in the <strong>imports</strong> list (hence keeping the
-tree hierarchy of includes which is very important for a proper XSLT
-processing model) and includes are stored in the <strong>doclist</strong>
-list. An imported stylesheet has a parent link to allow browsing of the
-tree.</p>
+<p>One xsltStylesheet structure is generated per document parsed for
+thestylesheet. XSLT documents allow includes and imports of other
+documents,imports are stored in the <strong>imports</strong>list (hence
+keeping thetree hierarchy of includes which is very important for a proper
+XSLTprocessing model) and includes are stored in the
+<strong>doclist</strong>list. An imported stylesheet has a parent link to
+allow browsing of thetree.</p>
 
-<p>The DOM tree associated to the document is stored in <strong>doc</strong>.
-It is preprocessed to remove ignorable empty nodes and all the nodes in the
-XSLT namespace are subject to precomputing. This usually consist of
-extracting all the context information from the context tree (attributes,
-namespaces, XPath expressions), and storing them in an xsltStylePreComp
-structure associated to the <strong>_private</strong> field of the node.</p>
+<p>The DOM tree associated to the document is stored in
+<strong>doc</strong>.It is preprocessed to remove ignorable empty nodes and
+all the nodes in theXSLT namespace are subject to precomputing. This usually
+consist ofextracting all the context information from the context tree
+(attributes,namespaces, XPath expressions), and storing them in an
+xsltStylePreCompstructure associated to the <strong>_private</strong>field of
+the node.</p>
 
-<p>A couple of notable exceptions to this are XSLT template nodes (more on
-this later) and attribute value templates. If they are actually templates,
-the value cannot be computed at compilation time. (Some preprocessing could
-be done like isolation and preparsing of the XPath subexpressions but it's
-not done, yet.)</p>
+<p>A couple of notable exceptions to this are XSLT template nodes (more
+onthis later) and attribute value templates. If they are actually
+templates,the value cannot be computed at compilation time. (Some
+preprocessing couldbe done like isolation and preparsing of the XPath
+subexpressions but it'snot done, yet.)</p>
 
-<p>The xsltStylePreComp structure also allows storing of the precompiled form
-of an XPath expression that can be associated to an XSLT element (more on
-this later).</p>
+<p>The xsltStylePreComp structure also allows storing of the precompiled
+formof an XPath expression that can be associated to an XSLT element (more
+onthis later).</p>
 
 <h3><a name="XSLT2">The XSLT template compilation</a></h3>
 
-<p>A proper handling of templates lookup is one of the keys of fast XSLT
-processing. (Given a node in the source document this is the process of
-finding which templates should be applied to this node.) Libxslt follows the
-hint suggested in the <a href="http://www.w3.org/TR/xslt#patterns">5.2
-Patterns</a> section of the XSLT Recommendation, i.e. it doesn't evaluate it
-as an XPath expression but tokenizes it and compiles it as a set of rules to
-be evaluated on a candidate node. There usually is an indication of the node
-name in the last step of this evaluation and this is used as a key check for
-the match. As a result libxslt builds a relatively more complex set of
-structures for the templates:</p>
+<p>A proper handling of templates lookup is one of the keys of fast
+XSLTprocessing. (Given a node in the source document this is the process
+offinding which templates should be applied to this node.) Libxslt follows
+thehint suggested in the <a
+href="http://www.w3.org/TR/xslt#patterns">5.2Patterns</a>section of the XSLT
+Recommendation, i.e. it doesn't evaluate itas an XPath expression but
+tokenizes it and compiles it as a set of rules tobe evaluated on a candidate
+node. There usually is an indication of the nodename in the last step of this
+evaluation and this is used as a key check forthe match. As a result libxslt
+builds a relatively more complex set ofstructures for the templates:</p>
 
 <p align="center"><img src="templates.gif"
 alt="The templates related structure"></p>
 
-<p>Let's describe a bit more closely what is built. First the xsltStylesheet
-structure holds a pointer to the template hash table. All the XSLT patterns
-compiled in this stylesheet are indexed by the value of the the target
-element (or attribute, pi ...) name, so when a element or an attribute "foo"
-needs to be processed the lookup is done using the name as a key.</p>
+<p>Let's describe a bit more closely what is built. First the
+xsltStylesheetstructure holds a pointer to the template hash table. All the
+XSLT patternscompiled in this stylesheet are indexed by the value of the the
+targetelement (or attribute, pi ...) name, so when a element or an attribute
+"foo"needs to be processed the lookup is done using the name as a key.</p>
 
-<p>Each of the patterns is compiled into an xsltCompMatch structure. It holds
-the set of rules based on the tokenization of the pattern stored in reverse
-order (matching is easier this way). It also holds some information about the
-previous matches used to speed up the process when one iterates over a set of
-siblings. (This optimization may be defeated by trashing when running
-threaded computation, it's unclear that this is a big deal in practice.)
-Predicate expressions are not compiled at this stage, they may be at run-time
-if needed, but in this case they are compiled as full XPath expressions (the
-use of some fixed predicate can probably be optimized, they are not yet).</p>
+<p>Each of the patterns is compiled into an xsltCompMatch structure. It
+holdsthe set of rules based on the tokenization of the pattern stored in
+reverseorder (matching is easier this way). It also holds some information
+about theprevious matches used to speed up the process when one iterates over
+a set ofsiblings. (This optimization may be defeated by trashing when
+runningthreaded computation, it's unclear that this is a big deal in
+practice.)Predicate expressions are not compiled at this stage, they may be
+at run-timeif needed, but in this case they are compiled as full XPath
+expressions (theuse of some fixed predicate can probably be optimized, they
+are not yet).</p>
 
-<p>The xsltCompMatch are then stored in the hash table, the clash list is
-itself sorted by priority of the template to implement "naturally" the XSLT
-priority rules.</p>
+<p>The xsltCompMatch are then stored in the hash table, the clash list
+isitself sorted by priority of the template to implement "naturally" the
+XSLTpriority rules.</p>
 
-<p>Associated to the compiled pattern is the xsltTemplate itself containing
-the information required for the processing of the pattern including, of
-course, a pointer to the list of elements used for building the pattern
-result.</p>
+<p>Associated to the compiled pattern is the xsltTemplate itself
+containingthe information required for the processing of the pattern
+including, ofcourse, a pointer to the list of elements used for building the
+patternresult.</p>
 
-<p>Last but not least a number of patterns do not fit in the hash table
-because they are not associated to a name, this is the case for patterns
-applying to the root, any element, any attributes, text nodes, pi nodes, keys
-etc. Those are stored independently in the stylesheet structure as separate
-linked lists of xsltCompMatch.</p>
+<p>Last but not least a number of patterns do not fit in the hash
+tablebecause they are not associated to a name, this is the case for
+patternsapplying to the root, any element, any attributes, text nodes, pi
+nodes, keysetc. Those are stored independently in the stylesheet structure as
+separatelinked lists of xsltCompMatch.</p>
 
 <h3><a name="processing">The processing itself</a></h3>
 
-<p>The processing is defined by the XSLT specification (the basis of the
-algorithm is explained in <a
-href="http://www.w3.org/TR/xslt#section-Introduction">the Introduction</a>
-section). Basically it works by taking the root of the input document and
-applying the following algorithm:</p>
+<p>The processing is defined by the XSLT specification (the basis of
+thealgorithm is explained in <a
+href="http://www.w3.org/TR/xslt#section-Introduction">the
+Introduction</a>section). Basically it works by taking the root of the input
+document andapplying the following algorithm:</p>
 <ol>
-  <li>Finding the template applying to it. This is a lookup in the template
-    hash table, walking the hash list until the node satisfies all the steps
-    of the pattern, then checking the appropriate(s) global templates to see
-    if there isn't a higher priority rule to apply</li>
-  <li>If there is no template, apply the default rule (recurse on the
-    children)</li>
+  <li>Finding the template applying to it. This is a lookup in the
+    templatehash table, walking the hash list until the node satisfies all
+    the stepsof the pattern, then checking the appropriate(s) global
+    templates to seeif there isn't a higher priority rule to apply</li>
+  <li>If there is no template, apply the default rule (recurse on
+  thechildren)</li>
   <li>else walk the content list of the selected templates, for each of them:
     <ul>
-      <li>if the node is in the XSLT namespace then the node has a _private
-        field pointing to the preprocessed values, jump to the specific
-      code</li>
-      <li>if the node is in an extension namespace, look up the associated
-        behavior</li>
+      <li>if the node is in the XSLT namespace then the node has a
+        _privatefield pointing to the preprocessed values, jump to the
+        specificcode</li>
+      <li>if the node is in an extension namespace, look up the
+        associatedbehavior</li>
       <li>otherwise copy the node.</li>
     </ul>
-    <p>The closure is usually done through the XSLT
-    <strong>apply-templates</strong> construct recursing by applying the
-    adequate template on the input node children or on the result of an
-    associated XPath selection lookup.</p>
+    <p>The closure is usually done through the
+    XSLT<strong>apply-templates</strong>construct recursing by applying
+    theadequate template on the input node children or on the result of
+    anassociated XPath selection lookup.</p>
   </li>
 </ol>
 
-<p>Note that large parts of the input tree may not be processed by a given
-stylesheet and that on the opposite some may be processed multiple times.
-(This often is the case when a Table of Contents is built).</p>
+<p>Note that large parts of the input tree may not be processed by a
+givenstylesheet and that on the opposite some may be processed multiple
+times.(This often is the case when a Table of Contents is built).</p>
 
-<p>The module <code>transform.c</code> is the one implementing most of this
-logic. <strong>xsltApplyStylesheet()</strong> is the entry point, it
-allocates an xsltTransformContext containing the following:</p>
+<p>The module <code>transform.c</code>is the one implementing most of
+thislogic. <strong>xsltApplyStylesheet()</strong>is the entry point,
+itallocates an xsltTransformContext containing the following:</p>
 <ul>
   <li>a pointer to the stylesheet being processed</li>
   <li>a stack of templates</li>
@@ -1699,24 +1709,24 @@
   <li>a couple of hash tables for extension elements and functions</li>
 </ul>
 
-<p>Then a new document gets allocated (HTML or XML depending on the type of
-output), the user parameters and global variables and parameters are
-evaluated. Then <strong>xsltProcessOneNode()</strong> which implements the
-1-2-3 algorithm is called on the root element of the input. Step 1/ is
-implemented by calling <strong>xsltGetTemplate()</strong>, step 2/ is
-implemented by <strong>xsltDefaultProcessOneNode()</strong> and step 3/ is
-implemented by <strong>xsltApplyOneTemplate()</strong>.</p>
+<p>Then a new document gets allocated (HTML or XML depending on the type
+ofoutput), the user parameters and global variables and parameters
+areevaluated. Then <strong>xsltProcessOneNode()</strong>which implements
+the1-2-3 algorithm is called on the root element of the input. Step 1/
+isimplemented by calling <strong>xsltGetTemplate()</strong>, step 2/
+isimplemented by <strong>xsltDefaultProcessOneNode()</strong>and step 3/
+isimplemented by <strong>xsltApplyOneTemplate()</strong>.</p>
 
 <h3><a name="XPath">XPath expression compilation</a></h3>
 
-<p>The XPath support is actually implemented in the libxml module (where it
-is reused by the XPointer implementation). XPath is a relatively classic
-expression language. The only uncommon feature is that it is working on XML
-trees and hence has specific syntax and types to handle them.</p>
+<p>The XPath support is actually implemented in the libxml module (where itis
+reused by the XPointer implementation). XPath is a relatively
+classicexpression language. The only uncommon feature is that it is working
+on XMLtrees and hence has specific syntax and types to handle them.</p>
 
-<p>XPath expressions are compiled using <strong>xmlXPathCompile()</strong>.
-It will take an expression string in input and generate a structure
-containing the parsed expression tree, for example the expression:</p>
+<p>XPath expressions are compiled using <strong>xmlXPathCompile()</strong>.It
+will take an expression string in input and generate a structurecontaining
+the parsed expression tree, for example the expression:</p>
 <pre>/doc/chapter[title='Introduction']</pre>
 
 <p>will be compiled as</p>
@@ -1734,180 +1744,179 @@
               COLLECT  'child' 'name' 'node' title
                 NODE</pre>
 
-<p>This can be tested using the  <code>testXPath</code>  command (in the
-libxml codebase) using the <code>--tree</code> option.</p>
+<p>This can be tested using the  <code>testXPath</code>command (in thelibxml
+codebase) using the <code>--tree</code>option.</p>
 
-<p>Again, the KISS approach is used. No optimization is done. This could be
-an interesting thing to add. <a
-href="http://www-106.ibm.com/developerworks/library/x-xslt2/?dwzone=x?open&amp;l=132%2ct=gr%2c+p=saxon">Michael
-Kay describes</a> a lot of possible and interesting optimizations done in
-Saxon which would be possible at this level. I'm unsure they would provide
-much gain since the expressions tends to be relatively simple in general and
-stylesheets are still hand generated. Optimizations at the interpretation
-sounds likely to be more efficient.</p>
+<p>Again, the KISS approach is used. No optimization is done. This could bean
+interesting thing to add. <a
+href="http://www-106.ibm.com/developerworks/library/x-xslt2/?dwzone=x?open&amp;l=132%2ct=gr%2c+p=saxon">MichaelKay
+describes</a>a lot of possible and interesting optimizations done inSaxon
+which would be possible at this level. I'm unsure they would providemuch gain
+since the expressions tends to be relatively simple in general andstylesheets
+are still hand generated. Optimizations at the interpretationsounds likely to
+be more efficient.</p>
 
 <h3><a name="XPath1">XPath interpretation</a></h3>
 
-<p>The interpreter is implemented by <strong>xmlXPathCompiledEval()</strong>
-which is the front-end to <strong>xmlXPathCompOpEval()</strong> the function
-implementing the evaluation of the expression tree. This evaluation follows
-the KISS approach again. It's recursive and calls
-<strong>xmlXPathNodeCollectAndTest()</strong> to collect nodes set when
-evaluating a <code>COLLECT</code> node.</p>
+<p>The interpreter is implemented by
+<strong>xmlXPathCompiledEval()</strong>which is the front-end to
+<strong>xmlXPathCompOpEval()</strong>the functionimplementing the evaluation
+of the expression tree. This evaluation followsthe KISS approach again. It's
+recursive and calls<strong>xmlXPathNodeCollectAndTest()</strong>to collect
+nodes set whenevaluating a <code>COLLECT</code>node.</p>
 
-<p>An evaluation is done within the framework of an XPath context stored in
-an <strong>xmlXPathContext</strong> structure, in the framework of a
-transformation the context is maintained within the XSLT context. Its content
-follows the requirements from the XPath specification:</p>
+<p>An evaluation is done within the framework of an XPath context stored inan
+<strong>xmlXPathContext</strong>structure, in the framework of
+atransformation the context is maintained within the XSLT context. Its
+contentfollows the requirements from the XPath specification:</p>
 <ul>
   <li>the current document</li>
   <li>the current node</li>
   <li>a hash table of defined variables (but not used by XSLT)</li>
   <li>a hash table of defined functions</li>
-  <li>the proximity position (the place of the node in the current node
-  list)</li>
+  <li>the proximity position (the place of the node in the current
+  nodelist)</li>
   <li>the context size (the size of the current node list)</li>
-  <li>the array of namespace declarations in scope (there also is a namespace
-    hash table but it is not used in the XSLT transformation).</li>
+  <li>the array of namespace declarations in scope (there also is a
+    namespacehash table but it is not used in the XSLT transformation).</li>
 </ul>
 
-<p>For the purpose of XSLT an <strong>extra</strong> pointer has been added
-allowing to retrieve the XSLT transformation context. When an XPath
-evaluation is about to be performed, an XPath parser context is allocated
-containing and XPath object stack (this is actually an XPath evaluation
-context, this is a remain of the time where there was no separate parsing and
-evaluation phase in the XPath implementation). Here is an overview of the set
-of contexts associated to an XPath evaluation within an XSLT
-transformation:</p>
+<p>For the purpose of XSLT an <strong>extra</strong>pointer has been
+addedallowing to retrieve the XSLT transformation context. When an
+XPathevaluation is about to be performed, an XPath parser context is
+allocatedcontaining and XPath object stack (this is actually an XPath
+evaluationcontext, this is a remain of the time where there was no separate
+parsing andevaluation phase in the XPath implementation). Here is an overview
+of the setof contexts associated to an XPath evaluation within an
+XSLTtransformation:</p>
 
 <p align="center"><img src="contexts.gif"
 alt="The set of contexts associated "></p>
 
-<p>Clearly this is a bit too complex and confusing and should be refactored
-at the next set of binary incompatible releases of libxml. For example the
-xmlXPathCtxt has a lot of unused parts and should probably be merged with
-xmlXPathParserCtxt.</p>
+<p>Clearly this is a bit too complex and confusing and should be refactoredat
+the next set of binary incompatible releases of libxml. For example
+thexmlXPathCtxt has a lot of unused parts and should probably be merged
+withxmlXPathParserCtxt.</p>
 
 <h3><a name="Descriptio">Description of XPath Objects</a></h3>
 
-<p>An XPath expression manipulates XPath objects. XPath defines the default
-types boolean, numbers, strings and node sets. XSLT adds the result tree
-fragment type which is basically an unmodifiable node set.</p>
+<p>An XPath expression manipulates XPath objects. XPath defines the
+defaulttypes boolean, numbers, strings and node sets. XSLT adds the result
+treefragment type which is basically an unmodifiable node set.</p>
 
-<p>Implementation-wise, libxml follows again a KISS approach, the
-xmlXPathObject is a structure containing a type description and the various
-possibilities. (Using an enum could have gained some bytes.) In the case of
-node sets (or result tree fragments), it points to a separate xmlNodeSet
-object which contains the list of pointers to the document nodes:</p>
+<p>Implementation-wise, libxml follows again a KISS approach,
+thexmlXPathObject is a structure containing a type description and the
+variouspossibilities. (Using an enum could have gained some bytes.) In the
+case ofnode sets (or result tree fragments), it points to a separate
+xmlNodeSetobject which contains the list of pointers to the document
+nodes:</p>
 
 <p align="center"><img src="object.gif"
 alt="An Node set object pointing to "></p>
 
-<p>The <a href="http://xmlsoft.org/html/libxml-xpath.html">XPath API</a> (and
-its <a href="http://xmlsoft.org/html/libxml-xpathinternals.html">'internal'
-part</a>) includes a number of functions to create, copy, compare, convert or
-free XPath objects.</p>
+<p>The <a href="http://xmlsoft.org/html/libxml-xpath.html">XPath
+API</a>(andits <a
+href="http://xmlsoft.org/html/libxml-xpathinternals.html">'internal'part</a>)
+includes a number of functions to create, copy, compare, convert orfree XPath
+objects.</p>
 
 <h3><a name="XPath3">XPath functions</a></h3>
 
-<p>All the XPath functions available to the interpreter are registered in the
-function hash table linked from the XPath context. They all share the same
-signature:</p>
+<p>All the XPath functions available to the interpreter are registered in
+thefunction hash table linked from the XPath context. They all share the
+samesignature:</p>
 <pre>void xmlXPathFunc (xmlXPathParserContextPtr ctxt, int nargs);</pre>
 
-<p>The first argument is the XPath interpretation context, holding the
-interpretation stack. The second argument defines the number of objects
-passed on the stack for the function to consume (last argument is on top of
-the stack).</p>
+<p>The first argument is the XPath interpretation context, holding
+theinterpretation stack. The second argument defines the number of
+objectspassed on the stack for the function to consume (last argument is on
+top ofthe stack).</p>
 
 <p>Basically an XPath function does the following:</p>
 <ul>
-  <li>check <code>nargs</code> for proper handling of errors or functions
-    with variable numbers of parameters</li>
-  <li>pop the parameters from the stack using <code>obj =
-    valuePop(ctxt);</code></li>
+  <li>check <code>nargs</code>for proper handling of errors or functionswith
+    variable numbers of parameters</li>
+  <li>pop the parameters from the stack using <code>obj
+    =valuePop(ctxt);</code></li>
   <li>do the function specific computation</li>
-  <li>push the result parameter on the stack using <code>valuePush(ctxt,
-    res);</code></li>
-  <li>free up the input parameters with
-  <code>xmlXPathFreeObject(obj);</code></li>
+  <li>push the result parameter on the stack using
+    <code>valuePush(ctxt,res);</code></li>
+  <li>free up the input parameters
+  with<code>xmlXPathFreeObject(obj);</code></li>
   <li>return</li>
 </ul>
 
-<p>Sometime the work can be done directly by modifying in-situ the top object
-on the stack <code>ctxt-&gt;value</code>.</p>
+<p>Sometime the work can be done directly by modifying in-situ the top
+objecton the stack <code>ctxt-&gt;value</code>.</p>
 
 <h3><a name="stack">The XSLT variables stack frame</a></h3>
 
-<p>Not to be confused with XPath object stack, this stack holds the XSLT
-variables and parameters as they are defined through the recursive calls of
-call-template, apply-templates and default templates. This is used to define
-the scope of variables being called.</p>
+<p>Not to be confused with XPath object stack, this stack holds the
+XSLTvariables and parameters as they are defined through the recursive calls
+ofcall-template, apply-templates and default templates. This is used to
+definethe scope of variables being called.</p>
 
-<p>This part seems to be the most urgent attention right now, first it is
-done in a very inefficient way since the location of the variables and
-parameters within the stylesheet tree is still done at run time (it really
-should be done statically at compile time), and I am still unsure that my
-understanding of the template variables and parameter scope is actually
-right.</p>
+<p>This part seems to be the most urgent attention right now, first it isdone
+in a very inefficient way since the location of the variables andparameters
+within the stylesheet tree is still done at run time (it reallyshould be done
+statically at compile time), and I am still unsure that myunderstanding of
+the template variables and parameter scope is actuallyright.</p>
 
-<p>This part of the documentation is still to be written once this part of
-the code will be stable. <span
-style="background-color: #FF0000">TODO</span></p>
+<p>This part of the documentation is still to be written once this part ofthe
+code will be stable. <span style="background-color: #FF0000">TODO</span></p>
 
 <h3><a name="Extension">Extension support</a></h3>
 
-<p>There is a separate document explaining <a href="extensions.html">how the
-extension support works</a>.</p>
+<p>There is a separate document explaining <a href="extensions.html">how
+theextension support works</a>.</p>
 
 <h3><a name="Futher">Further reading</a></h3>
 
 <p>Michael Kay wrote <a
-href="http://www-106.ibm.com/developerworks/library/x-xslt2/?dwzone=x?open&amp;l=132%2ct=gr%2c+p=saxon">a
-really interesting article on Saxon internals</a> and the work he did on
-performance issues. I wishes I had read it before starting libxslt design (I
-would probably have avoided a few mistakes and progressed faster). A lot of
-the ideas in his papers should be implemented or at least tried in
-libxslt.</p>
+href="http://www-106.ibm.com/developerworks/library/x-xslt2/?dwzone=x?open&amp;l=132%2ct=gr%2c+p=saxon">areally
+interesting article on Saxon internals</a>and the work he did onperformance
+issues. I wishes I had read it before starting libxslt design (Iwould
+probably have avoided a few mistakes and progressed faster). A lot ofthe
+ideas in his papers should be implemented or at least tried inlibxslt.</p>
 
 <p>The <a href="http://xmlsoft.org/">libxml documentation</a>, especially <a
-href="http://xmlsoft.org/xmlio.html">the I/O interfaces</a> and the <a
+href="http://xmlsoft.org/xmlio.html">the I/O interfaces</a>and the <a
 href="http://xmlsoft.org/xmlmem.html">memory management</a>.</p>
 
 <h3><a name="TODOs">TODOs</a></h3>
 
-<p>redesign the XSLT stack frame handling. Far too much work is done at
-execution time. Similarly for the attribute value templates handling, at
-least the embedded subexpressions ought to be precompiled.</p>
+<p>redesign the XSLT stack frame handling. Far too much work is done
+atexecution time. Similarly for the attribute value templates handling,
+atleast the embedded subexpressions ought to be precompiled.</p>
 
-<p>Allow output to be saved to a SAX like output (this notion of SAX like API
-for output should be added directly to libxml).</p>
+<p>Allow output to be saved to a SAX like output (this notion of SAX like
+APIfor output should be added directly to libxml).</p>
 
-<p>Implement and test some of the optimization explained by Michael Kay
-especially:</p>
+<p>Implement and test some of the optimization explained by Michael
+Kayespecially:</p>
 <ul>
   <li>static slot allocation on the stack frame</li>
   <li>specific boolean interpretation of an XPath expression</li>
   <li>some of the sorting optimization</li>
-  <li>Lazy evaluation of location path. (this may require more changes but
-    sounds really interesting. XT does this too.)</li>
-  <li>Optimization of an expression tree (This could be done as a completely
-    independent module.)</li>
+  <li>Lazy evaluation of location path. (this may require more changes
+    butsounds really interesting. XT does this too.)</li>
+  <li>Optimization of an expression tree (This could be done as a
+    completelyindependent module.)</li>
 </ul>
 
 <p></p>
 
-<p>Error reporting, there is a lot of case where the XSLT specification
-specify that a given construct is an error are not checked adequately by
-libxslt. Basically one should do a complete pass on the XSLT spec again and
-add all tests to the stylesheet compilation. Using the DTD provided in the
-appendix and making direct checks using the libxml validation API sounds a
-good idea too (though one should take care of not raising errors for
-elements/attributes in different namespaces).</p>
+<p>Error reporting, there is a lot of case where the XSLT
+specificationspecify that a given construct is an error are not checked
+adequately bylibxslt. Basically one should do a complete pass on the XSLT
+spec again andadd all tests to the stylesheet compilation. Using the DTD
+provided in theappendix and making direct checks using the libxml validation
+API sounds agood idea too (though one should take care of not raising errors
+forelements/attributes in different namespaces).</p>
 
-<p>Double check all the places where the stylesheet compiled form might be
-modified at run time (extra removal of blanks nodes, hint on the
-xsltCompMatch).</p>
+<p>Double check all the places where the stylesheet compiled form might
+bemodified at run time (extra removal of blanks nodes, hint on
+thexsltCompMatch).</p>
 
 <p></p>
 
@@ -1920,69 +1929,67 @@
   <li><a href="extensions.html#Keep">Extension modules</a></li>
   <li><a href="extensions.html#Registerin">Registering a module</a></li>
   <li><a href="extensions.html#module">Loading a module</a></li>
-  <li><a href="extensions.html#Registerin1">Registering an extension
-    function</a></li>
-  <li><a href="extensions.html#Implementi">Implementing an extension
-    function</a></li>
-  <li><a href="extensions.html#Examples">Examples for extension
-  functions</a></li>
-  <li><a href="extensions.html#Registerin2">Registering an extension
-    element</a></li>
-  <li><a href="extensions.html#Implementi1">Implementing an extension
-    element</a></li>
-  <li><a href="extensions.html#Example">Example for extension
-  elements</a></li>
+  <li><a href="extensions.html#Registerin1">Registering an
+    extensionfunction</a></li>
+  <li><a href="extensions.html#Implementi">Implementing an
+    extensionfunction</a></li>
+  <li><a href="extensions.html#Examples">Examples for
+  extensionfunctions</a></li>
+  <li><a href="extensions.html#Registerin2">Registering an
+    extensionelement</a></li>
+  <li><a href="extensions.html#Implementi1">Implementing an
+    extensionelement</a></li>
+  <li><a href="extensions.html#Example">Example for extensionelements</a></li>
   <li><a href="extensions.html#shutdown">The shutdown of a module</a></li>
   <li><a href="extensions.html#Future">Future work</a></li>
 </ul>
 
 <h3><a name="Introducti1">Introduction</a></h3>
 
-<p>This document describes the work needed to write extensions to the
-standard XSLT library for use with <a
-href="http://xmlsoft.org/XSLT/">libxslt</a>, the <a
-href="http://www.w3.org/TR/xslt">XSLT</a> C library developed for the <a
-href="http://www.gnome.org/">Gnome</a> project.</p>
+<p>This document describes the work needed to write extensions to thestandard
+XSLT library for use with <a href="http://xmlsoft.org/XSLT/">libxslt</a>, the
+<a href="http://www.w3.org/TR/xslt">XSLT</a>C library developed for the <a
+href="http://www.gnome.org/">Gnome</a>project.</p>
 
-<p>Before starting reading this document it is highly recommended to get
-familiar with <a href="internals.html">the libxslt internals</a>.</p>
+<p>Before starting reading this document it is highly recommended to
+getfamiliar with <a href="internals.html">the libxslt internals</a>.</p>
 
-<p>Note: this documentation is by definition incomplete and I am not good at
-spelling, grammar, so patches and suggestions are <a
+<p>Note: this documentation is by definition incomplete and I am not good
+atspelling, grammar, so patches and suggestions are <a
 href="mailto:veillard at redhat.com">really welcome</a>.</p>
 
 <h3><a name="Basics">Basics</a></h3>
 
-<p>The <a href="http://www.w3.org/TR/xslt">XSLT specification</a> provides
-two <a href="http://www.w3.org/TR/xslt">ways to extend an XSLT engine</a>:</p>
+<p>The <a href="http://www.w3.org/TR/xslt">XSLT specification</a>providestwo
+<a href="http://www.w3.org/TR/xslt">ways to extend an XSLT engine</a>:</p>
 <ul>
-  <li>providing <a href="http://www.w3.org/TR/xslt">new extension
-    functions</a> which can be called from XPath expressions</li>
-  <li>providing <a href="http://www.w3.org/TR/xslt">new extension
-    elements</a> which can be inserted in stylesheets</li>
+  <li>providing <a href="http://www.w3.org/TR/xslt">new
+    extensionfunctions</a>which can be called from XPath expressions</li>
+  <li>providing <a href="http://www.w3.org/TR/xslt">new
+    extensionelements</a>which can be inserted in stylesheets</li>
 </ul>
 
-<p>In both cases the extensions need to be associated to a new namespace,
-i.e. an URI used as the name for the extension's namespace (there is no need
-to have a resource there for this to work).</p>
+<p>In both cases the extensions need to be associated to a new namespace,i.e.
+an URI used as the name for the extension's namespace (there is no needto
+have a resource there for this to work).</p>
 
-<p>libxslt provides a few extensions itself, either in the libxslt namespace
-"http://xmlsoft.org/XSLT/namespace" or in namespaces for other well known
-extensions provided by other XSLT processors like Saxon, Xalan or XT.</p>
+<p>libxslt provides a few extensions itself, either in the libxslt
+namespace"http://xmlsoft.org/XSLT/namespace" or in namespaces for other well
+knownextensions provided by other XSLT processors like Saxon, Xalan or XT.</p>
 
 <h3><a name="Keep">Extension modules</a></h3>
 
-<p>Since extensions are bound to a namespace name, usually sets of extensions
-coming from a given source are using the same namespace name defining in
-practice a group of extensions providing elements, functions or both. From
-the libxslt point of view those are considered as an "extension module", and
-most of the APIs work at a module point of view.</p>
+<p>Since extensions are bound to a namespace name, usually sets of
+extensionscoming from a given source are using the same namespace name
+defining inpractice a group of extensions providing elements, functions or
+both. Fromthe libxslt point of view those are considered as an "extension
+module", andmost of the APIs work at a module point of view.</p>
 
-<p>Registration of new functions or elements are bound to the activation of
-the module. This is currently done by declaring the namespace as an extension
-by using the attribute  <code>extension-element-prefixes</code> on the
-<code><a href="http://www.w3.org/TR/xslt">xsl:stylesheet</a></code>
-element.</p>
+<p>Registration of new functions or elements are bound to the activation
+ofthe module. This is currently done by declaring the namespace as an
+extensionby using the attribute  <code>extension-element-prefixes</code>on
+the<code><a
+href="http://www.w3.org/TR/xslt">xsl:stylesheet</a></code>element.</p>
 
 <p>An extension module is defined by 3 objects:</p>
 <ul>
@@ -1993,13 +2000,13 @@
 
 <h3><a name="Registerin">Registering a module</a></h3>
 
-<p>Currently a libxslt module has to be compiled within the application using
-libxslt. There is no code to load dynamically shared libraries associated to
-a namespace (this may be added but is likely to become a portability
-nightmare).</p>
+<p>Currently a libxslt module has to be compiled within the application
+usinglibxslt. There is no code to load dynamically shared libraries
+associated toa namespace (this may be added but is likely to become a
+portabilitynightmare).</p>
 
-<p>The current way to register a module is to link the code implementing it
-with the application and to call a registration function:</p>
+<p>The current way to register a module is to link the code implementing
+itwith the application and to call a registration function:</p>
 <pre>int xsltRegisterExtModule(const xmlChar *URI,
                           xsltExtInitFunction initFunc,
                           xsltExtShutdownFunction shutdownFunc);</pre>
@@ -2007,17 +2014,17 @@
 <p>The associated header is read by:</p>
 <pre>#include&lt;libxslt/extensions.h&gt;</pre>
 
-<p>which also defines the type for the initialization and shutdown
-functions</p>
+<p>which also defines the type for the initialization and
+shutdownfunctions</p>
 
 <h3><a name="module">Loading a module</a></h3>
 
-<p>Once the module URI has been registered and if the XSLT processor detects
-that a given stylesheet needs the functionalities of an extended module, this
-one is initialized.</p>
+<p>Once the module URI has been registered and if the XSLT processor
+detectsthat a given stylesheet needs the functionalities of an extended
+module, thisone is initialized.</p>
 
-<p>The xsltExtInitFunction type defines the interface for an initialization
-function:</p>
+<p>The xsltExtInitFunction type defines the interface for an
+initializationfunction:</p>
 <pre>/**
  * xsltExtInitFunction:
  * @ctxt:  an XSLT transformation context
@@ -2034,24 +2041,24 @@
 
 <p>There are 3 things to notice:</p>
 <ul>
-  <li>The function gets passed the namespace name URI as an argument. This
-    allows a single function to provide the initialization for multiple
-    logical modules.</li>
-  <li>It also gets passed a transformation context. The initialization is
-    done at run time before any processing occurs on the stylesheet but it
-    will be invoked separately each time for each transformation.</li>
-  <li>It returns a pointer.  This can be used to store module specific
-    information which can be retrieved later when a function or an element
-    from the extension is used.  An obvious example is a connection to a
-    database which should be kept and reused along with the transformation.
-    NULL is a perfectly valid return; there is no way to indicate a failure
-    at this level</li>
+  <li>The function gets passed the namespace name URI as an argument.
+    Thisallows a single function to provide the initialization for
+    multiplelogical modules.</li>
+  <li>It also gets passed a transformation context. The initialization isdone
+    at run time before any processing occurs on the stylesheet but itwill be
+    invoked separately each time for each transformation.</li>
+  <li>It returns a pointer.  This can be used to store module
+    specificinformation which can be retrieved later when a function or an
+    elementfrom the extension is used.  An obvious example is a connection to
+    adatabase which should be kept and reused along with the
+    transformation.NULL is a perfectly valid return; there is no way to
+    indicate a failureat this level</li>
 </ul>
 
 <p>What this function is expected to do is:</p>
 <ul>
-  <li>prepare the context for this module (like opening the database
-    connection)</li>
+  <li>prepare the context for this module (like opening the
+    databaseconnection)</li>
   <li>register the extensions specific to this module</li>
 </ul>
 
@@ -2063,16 +2070,16 @@
                             const xmlChar *URI,
                             xmlXPathEvalFunc function);</pre>
 
-<p>The registration is bound to a single transformation instance referred by
-ctxt, name is the UTF8 encoded name for the NCName of the function, and URI
-is the namespace name for the extension (no checking is done, a module could
-register functions or elements from a different namespace, but it is not
-recommended).</p>
+<p>The registration is bound to a single transformation instance referred
+byctxt, name is the UTF8 encoded name for the NCName of the function, and
+URIis the namespace name for the extension (no checking is done, a module
+couldregister functions or elements from a different namespace, but it is
+notrecommended).</p>
 
 <h3><a name="Implementi">Implementing an extension function</a></h3>
 
-<p>The implementation of the function must have the signature of a libxml
-XPath function:</p>
+<p>The implementation of the function must have the signature of a
+libxmlXPath function:</p>
 <pre>/**
  * xmlXPathEvalFunc:
  * @ctxt: an XPath parser context
@@ -2086,67 +2093,67 @@
                                  int nargs);</pre>
 
 <p>The context passed to an XPath function is not an XSLT context but an <a
-href="internals.html#XPath1">XPath context</a>. However it is possible to
-find one from the other:</p>
+href="internals.html#XPath1">XPath context</a>. However it is possible tofind
+one from the other:</p>
 <ul>
   <li>The function xsltXPathGetTransformContext provides this lookup facility:
     <pre>xsltTransformContextPtr
          xsltXPathGetTransformContext
                           (xmlXPathParserContextPtr ctxt);</pre>
   </li>
-  <li>The <code>xmlXPathContextPtr</code> associated to an
-    <code>xsltTransformContext</code> is stored in the <code>xpathCtxt</code>
-    field.</li>
+  <li>The <code>xmlXPathContextPtr</code>associated to
+    an<code>xsltTransformContext</code>is stored in the
+    <code>xpathCtxt</code>field.</li>
 </ul>
 
-<p>The first thing an extension function may want to do is to check the
-arguments passed on the stack, the <code>nargs</code> parameter will tell how
-many of them were provided on the XPath expression. The macro valuePop will
-extract them from the XPath stack:</p>
+<p>The first thing an extension function may want to do is to check
+thearguments passed on the stack, the <code>nargs</code>parameter will tell
+howmany of them were provided on the XPath expression. The macro valuePop
+willextract them from the XPath stack:</p>
 <pre>#include &lt;libxml/xpath.h&gt;
 #include &lt;libxml/xpathInternals.h&gt;
 
 xmlXPathObjectPtr obj = valuePop(ctxt); </pre>
 
-<p>Note that <code>ctxt</code> is the XPath context not the XSLT one. It is
-then possible to examine the content of the value. Check <a
-href="internals.html#Descriptio">the description of XPath objects</a> if
-necessary. The following is a common sequence checking whether the argument
-passed is a string and converting it using the built-in XPath
-<code>string()</code> function if this is not the case:</p>
+<p>Note that <code>ctxt</code>is the XPath context not the XSLT one. It
+isthen possible to examine the content of the value. Check <a
+href="internals.html#Descriptio">the description of XPath
+objects</a>ifnecessary. The following is a common sequence checking whether
+the argumentpassed is a string and converting it using the built-in
+XPath<code>string()</code>function if this is not the case:</p>
 <pre>if (obj-&gt;type != XPATH_STRING) {
     valuePush(ctxt, obj);
     xmlXPathStringFunction(ctxt, 1);
     obj = valuePop(ctxt);
 }</pre>
 
-<p>Most common XPath functions are available directly at the C level and are
-exported either in <code>&lt;libxml/xpath.h&gt;</code> or in
-<code>&lt;libxml/xpathInternals.h&gt;</code>.</p>
+<p>Most common XPath functions are available directly at the C level and
+areexported either in <code>&lt;libxml/xpath.h&gt;</code>or
+in<code>&lt;libxml/xpathInternals.h&gt;</code>.</p>
 
-<p>The extension function may also need to retrieve the data associated to
-this module instance (the database connection in the previous example) this
-can be done using the xsltGetExtData:</p>
+<p>The extension function may also need to retrieve the data associated
+tothis module instance (the database connection in the previous example)
+thiscan be done using the xsltGetExtData:</p>
 <pre>void * xsltGetExtData(xsltTransformContextPtr ctxt,
                       const xmlChar *URI);</pre>
 
-<p>Again the URI to be provided is the one which was used when registering
-the module.</p>
+<p>Again the URI to be provided is the one which was used when registeringthe
+module.</p>
 
 <p>Once the function finishes, don't forget to:</p>
 <ul>
-  <li>push the return value on the stack using <code>valuePush(ctxt,
-    obj)</code></li>
-  <li>deallocate the parameters passed to the function using
-    <code>xmlXPathFreeObject(obj)</code></li>
+  <li>push the return value on the stack using
+    <code>valuePush(ctxt,obj)</code></li>
+  <li>deallocate the parameters passed to the function
+    using<code>xmlXPathFreeObject(obj)</code></li>
 </ul>
 
 <h3><a name="Examples">Examples for extension functions</a></h3>
 
-<p>The module libxslt/functions.c contains the sources of the XSLT built-in
-functions, including document(), key(), generate-id(), etc. as well as a full
-example module at the end. Here is the test function implementation for the
-libxslt:test function:</p>
+<p>The module libxslt/functions.c contains the sources of the XSLT
+built-infunctions, including document(), key(), generate-id(), etc. as well
+as a fullexample module at the end. Here is the test function implementation
+for thelibxslt:test function:</p>
 <pre>/**
  * xsltExtFunctionTest:
  * @ctxt:  the XPath Parser context
@@ -2186,19 +2193,20 @@
                            const xmlChar *URI,
                            xsltTransformFunction function);</pre>
 
-<p>It is similar to the mechanism used to register an extension function,
-except that the signature of an extension element implementation is
-different.</p>
+<p>It is similar to the mechanism used to register an extension
+function,except that the signature of an extension element implementation
+isdifferent.</p>
 
-<p>The registration is bound to a single transformation instance referred to
-by ctxt, name is the UTF8 encoded name for the NCName of the element, and URI
-is the namespace name for the extension (no checking is done, a module could
-register elements for a different namespace, but it is not recommended).</p>
+<p>The registration is bound to a single transformation instance referred
+toby ctxt, name is the UTF8 encoded name for the NCName of the element, and
+URIis the namespace name for the extension (no checking is done, a module
+couldregister elements for a different namespace, but it is not
+recommended).</p>
 
 <h3><a name="Implementi1">Implementing an extension element</a></h3>
 
-<p>The implementation of the element must have the signature of an XSLT
-transformation function:</p>
+<p>The implementation of the element must have the signature of an
+XSLTtransformation function:</p>
 <pre>/** 
  * xsltTransformFunction: 
  * @ctxt: the XSLT transformation context
@@ -2215,37 +2223,37 @@
                            xmlNodePtr inst,
                            xsltStylePreCompPtr comp);</pre>
 
-<p>The first argument is the XSLT transformation context. The second and
-third arguments are xmlNodePtr i.e. internal memory <a
-href="internals.html#libxml">representation of  XML nodes</a>. They are
-respectively <code>node</code> from the the input document being transformed
-by the stylesheet and <code>inst</code> the extension element in the
-stylesheet. The last argument is <code>comp</code> a pointer to a precompiled
-representation of <code>inst</code> but usually for an extension function
-this value is <code>NULL</code> by default (it could be added and associated
-to the instruction in <code>inst-&gt;_private</code>).</p>
+<p>The first argument is the XSLT transformation context. The second andthird
+arguments are xmlNodePtr i.e. internal memory <a
+href="internals.html#libxml">representation of  XML nodes</a>. They
+arerespectively <code>node</code>from the the input document being
+transformedby the stylesheet and <code>inst</code>the extension element in
+thestylesheet. The last argument is <code>comp</code>a pointer to a
+precompiledrepresentation of <code>inst</code>but usually for an extension
+functionthis value is <code>NULL</code>by default (it could be added and
+associatedto the instruction in <code>inst-&gt;_private</code>).</p>
 
-<p>The same functions are available from a function implementing an extension
-element as in an extension function, including
-<code>xsltGetExtData()</code>.</p>
+<p>The same functions are available from a function implementing an
+extensionelement as in an extension function,
+including<code>xsltGetExtData()</code>.</p>
 
-<p>The goal of an extension element being usually to enrich the generated
-output, it is expected that they will grow the currently generated output
-tree. This can be done by grabbing ctxt-&gt;insert which is the current
-libxml node being generated (Note this can also be the intermediate value
-tree being built for example to initialize a variable, the processing should
-be similar). The functions for libxml tree manipulation from <a
-href="http://xmlsoft.org/html/libxml-tree.html">&lt;libxml/tree.h&gt;</a> can
-be employed to extend or modify the tree, but it is required to preserve the
-insertion node and its ancestors since there are existing pointers to those
-elements still in use in the XSLT template execution stack.</p>
+<p>The goal of an extension element being usually to enrich the
+generatedoutput, it is expected that they will grow the currently generated
+outputtree. This can be done by grabbing ctxt-&gt;insert which is the
+currentlibxml node being generated (Note this can also be the intermediate
+valuetree being built for example to initialize a variable, the processing
+shouldbe similar). The functions for libxml tree manipulation from <a
+href="http://xmlsoft.org/html/libxml-tree.html">&lt;libxml/tree.h&gt;</a>canbe
+employed to extend or modify the tree, but it is required to preserve
+theinsertion node and its ancestors since there are existing pointers to
+thoseelements still in use in the XSLT template execution stack.</p>
 
 <h3><a name="Example">Example for extension elements</a></h3>
 
-<p>The module libxslt/transform.c contains the sources of the XSLT built-in
-elements, including xsl:element, xsl:attribute, xsl:if, etc. There is a small
-but full example in functions.c providing the implementation for the
-libxslt:test element, it will output a comment in the result tree:</p>
+<p>The module libxslt/transform.c contains the sources of the XSLT
+built-inelements, including xsl:element, xsl:attribute, xsl:if, etc. There is
+a smallbut full example in functions.c providing the implementation for
+thelibxslt:test element, it will output a comment in the result tree:</p>
 <pre>/**
  * xsltExtElementTest:
  * @ctxt:  an XSLT processing context
@@ -2290,10 +2298,10 @@
 
 <h3><a name="shutdown">The shutdown of a module</a></h3>
 
-<p>When the XSLT processor ends a transformation, the shutdown function (if
-it exists) for each of the modules initialized is called.  The
-xsltExtShutdownFunction type defines the interface for a shutdown
-function:</p>
+<p>When the XSLT processor ends a transformation, the shutdown function (ifit
+exists) for each of the modules initialized is called. 
+ThexsltExtShutdownFunction type defines the interface for a
+shutdownfunction:</p>
 <pre>/**
  * xsltExtShutdownFunction:
  * @ctxt:  an XSLT transformation context
@@ -2306,64 +2314,66 @@
                                          const xmlChar *URI,
                                          void *data);</pre>
 
-<p>This is really similar to a module initialization function except a third
-argument is passed, it's the value that was returned by the initialization
-function. This allows the routine to deallocate resources from the module for
-example close the connection to the database to keep the same example.</p>
+<p>This is really similar to a module initialization function except a
+thirdargument is passed, it's the value that was returned by the
+initializationfunction. This allows the routine to deallocate resources from
+the module forexample close the connection to the database to keep the same
+example.</p>
 
 <h3><a name="Future">Future work</a></h3>
 
 <p>Well, some of the pieces missing:</p>
 <ul>
   <li>a way to load shared libraries to instantiate new modules</li>
-  <li>a better detection of extension functions usage and their registration
-    without having to use the extension prefix which ought to be reserved to
-    element extensions.</li>
+  <li>a better detection of extension functions usage and their
+    registrationwithout having to use the extension prefix which ought to be
+    reserved toelement extensions.</li>
   <li>more examples</li>
-  <li>implementations of the <a href="http://www.exslt.org/">EXSLT</a> common
-    extension libraries, Thomas Broyer nearly finished implementing them.</li>
+  <li>implementations of the <a
+    href="http://www.exslt.org/">EXSLT</a>commonextension libraries, Thomas
+    Broyer nearly finished implementing them.</li>
 </ul>
 
 <p></p>
 
 <h2><a name="Contributi">Contributions</a></h2>
 <ul>
-  <li>Bjorn Reese is the author of the number support and worked on the
-    XSLTMark support</li>
-  <li>William Brack was an early adopted, contributed a number of patches and
-    spent quite some time debugging non-trivial problems in early versions of
-    libxslt</li>
-  <li><a href="mailto:igor at zlatkovic.com">Igor  Zlatkovic</a> is now the
-    maintainer of the Windows port, <a
-    href="http://www.zlatkovic.com/projects/libxml/index.html">he provides
-    binaries</a></li>
-  <li>Thomas Broyer provided a lot of suggestions, and drafted most of the
-    extension API</li>
-  <li>John Fleck maintains <a href="tutorial/libxslttutorial.html">a tutorial
-    for libxslt</a></li>
+  <li>Bjorn Reese is the author of the number support and worked on
+    theXSLTMark support</li>
+  <li>William Brack was an early adopted, contributed a number of patches
+    andspent quite some time debugging non-trivial problems in early versions
+    oflibxslt</li>
+  <li><a href="mailto:igor at zlatkovic.com">Igor  Zlatkovic</a>is now
+    themaintainer of the Windows port, <a
+    href="http://www.zlatkovic.com/projects/libxml/index.html">he
+    providesbinaries</a></li>
+  <li>Thomas Broyer provided a lot of suggestions, and drafted most of
+    theextension API</li>
+  <li>John Fleck maintains <a href="tutorial/libxslttutorial.html">a
+    tutorialfor libxslt</a></li>
   <li><a
-    href="http://mail.gnome.org/archives/xml/2001-March/msg00014.html">Matt
-    Sergeant</a> developed <a
-    href="http://axkit.org/download/">XML::LibXSLT</a>, a perl wrapper for
-    libxml2/libxslt as part of the <a href="http://axkit.com/">AxKit XML
-    application server</a></li>
+    href="http://mail.gnome.org/archives/xml/2001-March/msg00014.html">MattSergeant</a>developed
+    <a href="http://axkit.org/download/">XML::LibXSLT</a>, a perl wrapper
+    forlibxml2/libxslt as part of the <a href="http://axkit.com/">AxKit
+    XMLapplication server</a></li>
   <li>there is a module for <a
-    href="http://acs-misc.sourceforge.net/nsxml.html">libxml/libxslt support
-    in OpenNSD/AOLServer</a></li>
-  <li><a href="mailto:dkuhlman at cutter.rexx.com">Dave Kuhlman</a> provides
-    libxml/libxslt <a href="http://www.rexx.com/~dkuhlman">wrappers for
-    Python</a></li>
-  <li><a href="mailto:Steve.Ball at explain.com.au">Steve Ball</a>, and
-    contributors maintain <a href="http://tclxml.sourceforge.net/">tcl
-    bindings for libxml2 and libxslt</a>, as well as <a
-    href="http://tclxml.sf.net/tkxmllint.html">tkxmllint</a> a GUI for
-    xmllint and <a href="http://tclxml.sf.net/tkxsltproc.html">tkxsltproc</a>
-    a GUI for xsltproc.</li>
-  <li>If you want to use libxslt in a Mac OS X/Cocoa or Objective-C
-    framework, Marc Liyanage provides <a
-    href="http://www.entropy.ch/software/macosx/#testxslt">an application
-    TestXSLT for XSLT and XML editing</a> including wrapper classes for the
-    XML parser and XSLT processor.</li>
+    href="http://acs-misc.sourceforge.net/nsxml.html">libxml/libxslt
+    supportin OpenNSD/AOLServer</a></li>
+  <li><a href="mailto:dkuhlman at cutter.rexx.com">Dave
+    Kuhlman</a>provideslibxml/libxslt <a
+    href="http://www.rexx.com/~dkuhlman">wrappers forPython</a></li>
+  <li><a href="mailto:Steve.Ball at explain.com.au">Steve Ball</a>,
+    andcontributors maintain <a
+    href="http://tclxml.sourceforge.net/">tclbindings for libxml2 and
+    libxslt</a>, as well as <a
+    href="http://tclxml.sf.net/tkxmllint.html">tkxmllint</a>a GUI forxmllint
+    and <a href="http://tclxml.sf.net/tkxsltproc.html">tkxsltproc</a>a GUI
+    for xsltproc.</li>
+  <li>If you want to use libxslt in a Mac OS X/Cocoa or Objective-Cframework,
+    Marc Liyanage provides <a
+    href="http://www.entropy.ch/software/macosx/#testxslt">an
+    applicationTestXSLT for XSLT and XML editing</a>including wrapper classes
+    for theXML parser and XSLT processor.</li>
 </ul>
 
 <p></p>

Modified: packages/libxslt/branches/upstream/current/doc/xsltproc2.html
===================================================================
--- packages/libxslt/branches/upstream/current/doc/xsltproc2.html	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/doc/xsltproc2.html	2006-06-08 22:23:55 UTC (rev 563)
@@ -8,11 +8,11 @@
 H3 {font-family: Verdana,Arial,Helvetica}
 A:link, A:visited, A:active { text-decoration: underline }
     </style><title>The xsltproc tool</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for Gnome</h1><h2>The xsltproc tool</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="http://xmlsoft.org/wiki">Wiki</a></li><li><a href="intro.html">Introduction</a></li><li><a href="docs.html">Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="news.html">News</a></li><li><a href="xsltproc2.html">The xsltproc tool</a></li><li><a href="docbook.html">DocBook</a></li><li><a href="API.html">The programming API</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="internals.html">Library internals</a></li><li><a href="extensions.html">Writing extensions</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li><li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="tutorial/libxslttutorial.html">Tutorial</a>,
-          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>This program is the simplest way to use libxslt: from the command line. It
-is also used for doing the regression tests of the library.</p><p>It takes as first argument the path or URL to an XSLT stylesheet, the next
-arguments are filenames or URIs of the inputs to be processed. The output of
-the processing is redirected on the standard output. There is actually a few
-more options available:</p><pre>orchis:~ -&gt; xsltproc
+          <a href="tutorial2/libxslt_pipes.html">Tutorial2</a></li><li><a href="xsltproc.html">Man page for xsltproc</a></li><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>This program is the simplest way to use libxslt: from the command line.
+Itis also used for doing the regression tests of the library.</p><p>It takes as first argument the path or URL to an XSLT stylesheet, the
+nextarguments are filenames or URIs of the inputs to be processed. The output
+ofthe processing is redirected on the standard output. There is actually a
+fewmore options available:</p><pre>orchis:~ -&gt; xsltproc
 Usage: xsltproc [options] stylesheet file [file ...]
    Options:
       --version or -V: show the version of libxml and libxslt used

Modified: packages/libxslt/branches/upstream/current/libexslt/exsltconfig.h
===================================================================
--- packages/libxslt/branches/upstream/current/libexslt/exsltconfig.h	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libexslt/exsltconfig.h	2006-06-08 22:23:55 UTC (rev 563)
@@ -18,7 +18,7 @@
  *
  * the version string like "1.2.3"
  */
-#define LIBEXSLT_DOTTED_VERSION "1.1.16"
+#define LIBEXSLT_DOTTED_VERSION "1.1.17"
 
 /**
  * LIBEXSLT_VERSION:
@@ -39,7 +39,7 @@
  *
  * extra version information, used to show a CVS compilation
  */
-#define	LIBEXSLT_VERSION_EXTRA "-CVS1050"
+#define	LIBEXSLT_VERSION_EXTRA "-CVS1062"
 
 /**
  * WITH_CRYPTO:

Modified: packages/libxslt/branches/upstream/current/libexslt/functions.c
===================================================================
--- packages/libxslt/branches/upstream/current/libexslt/functions.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libexslt/functions.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -128,6 +128,10 @@
  * @URI: the namespace URI for the extension
  *
  * Initializes the EXSLT - Functions module.
+ * Called at transformation-time; merges all
+ * functions declared in the import tree taking
+ * import precedence into account, i.e. overriding
+ * functions with lower import precedence.
  *
  * Returns the data for this transformation
  */
@@ -170,8 +174,9 @@
  * @ctxt: an XSLT transformation context
  * @URI: the namespace URI for the extension
  * @data: the module data to free up
- *
+ *  
  * Shutdown the EXSLT - Functions module
+ * Called at transformation-time.
  */
 static void
 exsltFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
@@ -188,6 +193,7 @@
  * @URI: the namespace URI for the extension
  *
  * Allocates the stylesheet data for EXSLT - Function
+ * Called at compile-time.
  *
  * Returns the allocated data
  */
@@ -201,9 +207,10 @@
  * exsltFuncStyleShutdown:
  * @style: an XSLT stylesheet
  * @URI: the namespace URI for the extension
- * @data: the stylesheet data to free up
+ * @data: the stylesheet data to free up 
  *
  * Shutdown the EXSLT - Function module
+ * Called at compile-time.
  */
 static void
 exsltFuncStyleShutdown (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
@@ -431,8 +438,19 @@
      * Register the function data such that it can be retrieved
      * by exslFuncFunctionFunction
      */
-    data = (xmlHashTablePtr) xsltStyleGetExtData (style,
-						  EXSLT_FUNCTIONS_NAMESPACE);
+#ifdef XSLT_REFACTORED
+    /*
+    * Ensure that the hash table will be stored in the *current*
+    * stylesheet level in order to correctly evaluate the
+    * import precedence.
+    */
+    data = (xmlHashTablePtr)
+	xsltStyleStylesheetLevelGetExtData(style,
+	    EXSLT_FUNCTIONS_NAMESPACE);
+#else
+    data = (xmlHashTablePtr)
+	xsltStyleGetExtData (style, EXSLT_FUNCTIONS_NAMESPACE);
+#endif
     if (data == NULL) {
 	xsltGenericError(xsltGenericErrorContext,
 			 "exsltFuncFunctionComp: no stylesheet data\n");
@@ -441,9 +459,10 @@
     }
 
     if (xmlHashAddEntry2 (data, ns->href, name, func) < 0) {
-	xsltGenericError(xsltGenericErrorContext,
-			 "Failed to register function {%s}%s\n",
+	xsltTransformError(NULL, style, inst,
+	    "Failed to register function {%s}%s\n",
 			 ns->href, name);
+	style->errors++;
     } else {
 	xsltGenericDebug(xsltGenericDebugContext,
 			 "exsltFuncFunctionComp: register {%s}%s\n",

Modified: packages/libxslt/branches/upstream/current/libxslt/attributes.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/attributes.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/attributes.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -38,6 +38,7 @@
 #include <libxml/hash.h>
 #include <libxml/xmlerror.h>
 #include <libxml/uri.h>
+#include <libxml/parserInternals.h>
 #include "xslt.h"
 #include "xsltInternals.h"
 #include "xsltutils.h"
@@ -46,6 +47,7 @@
 #include "templates.h"
 #include "imports.h"
 #include "transform.h"
+#include "preproc.h"
 
 #define WITH_XSLT_DEBUG_ATTRIBUTES
 #ifdef WITH_XSLT_DEBUG
@@ -63,6 +65,9 @@
 /*
  * Useful macros
  */
+#ifdef IS_BLANK
+#undef IS_BLANK
+#endif
 
 #define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) ||	\
                      ((c) == 0x0D))
@@ -143,6 +148,11 @@
     }
 }
 
+#ifdef XSLT_REFACTORED
+    /*
+    * This was moved to xsltParseStylesheetAttributeSet().
+    */
+#else
 /**
  * xsltAddAttrElemList:
  * @list:  an XSLT AttrElem list
@@ -161,7 +171,7 @@
     if (list == NULL)
 	return(xsltNewAttrElem(attr));
     cur = list;
-    while (cur != NULL) {
+    while (cur != NULL) {	
 	next = cur->next;
 	if (cur->attr == attr)
 	    return(cur);
@@ -173,6 +183,7 @@
     }
     return(list);
 }
+#endif /* XSLT_REFACTORED */
 
 /**
  * xsltMergeAttrElemList:
@@ -185,7 +196,8 @@
  * Returns the new list pointer
  */
 static xsltAttrElemPtr
-xsltMergeAttrElemList(xsltAttrElemPtr list, xsltAttrElemPtr old) {
+xsltMergeAttrElemList(xsltStylesheetPtr style,
+		      xsltAttrElemPtr list, xsltAttrElemPtr old) {
     xsltAttrElemPtr cur;
     int add;
 
@@ -233,19 +245,23 @@
 	}
 
 	if (add == 1) {
+	    /*
+	    * Changed to use the string-dict, rather than duplicating
+	    * @set and @ns; this fixes bug #340400.
+	    */
 	    if (cur == NULL) {
 		list = xsltNewAttrElem(old->attr);
 		if (old->set != NULL) {
-		    list->set = xmlStrdup(old->set);
+		    list->set = xmlDictLookup(style->dict, old->set, -1);
 		    if (old->ns != NULL)
-			list->ns = xmlStrdup(old->ns);
+			list->ns = xmlDictLookup(style->dict, old->ns, -1);
 		}
 	    } else if (add) {
 		cur->next = xsltNewAttrElem(old->attr);
 		if (old->set != NULL) {
-		    cur->next->set = xmlStrdup(old->set);
+		    cur->next->set = xmlDictLookup(style->dict, old->set, -1);
 		    if (old->ns != NULL)
-			cur->next->ns = xmlStrdup(old->ns);
+			cur->next->ns = xmlDictLookup(style->dict, old->ns, -1);
 		}
 	    }
 	}
@@ -273,24 +289,23 @@
 xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) {
     const xmlChar *ncname;
     const xmlChar *prefix;
-    const xmlChar *attrib, *endattr;
-    xmlChar *prop;
-    xmlChar *attributes;
-    xmlNodePtr list;
-    xsltAttrElemPtr values;
+    xmlChar *value;
+    xmlNodePtr child;
+    xsltAttrElemPtr attrItems;
 
     if ((cur == NULL) || (style == NULL))
 	return;
 
-    prop = xmlGetNsProp(cur, (const xmlChar *)"name", NULL);
-    if (prop == NULL) {
+    value = xmlGetNsProp(cur, (const xmlChar *)"name", NULL);
+    if (value == NULL) {
 	xsltGenericError(xsltGenericErrorContext,
 	     "xsl:attribute-set : name is missing\n");
 	return;
     }
 
-    ncname = xsltSplitQName(style->dict, prop, &prefix);
-    xmlFree(prop);
+    ncname = xsltSplitQName(style->dict, value, &prefix);
+    xmlFree(value);
+    value = NULL;
 
     if (style->attributeSets == NULL) {
 #ifdef WITH_XSLT_DEBUG_ATTRIBUTES
@@ -302,80 +317,141 @@
     if (style->attributeSets == NULL)
 	return;
 
-    values = xmlHashLookup2(style->attributeSets, ncname, prefix);
+    attrItems = xmlHashLookup2(style->attributeSets, ncname, prefix);
 
     /*
-     * check the children list
-     */
-    list = cur->children;
-    while (list != NULL) {
-	if (IS_XSLT_ELEM(list)) {
-	    if (!IS_XSLT_NAME(list, "attribute")) {
-		xsltGenericError(xsltGenericErrorContext,
-		    "xsl:attribute-set : unexpected child xsl:%s\n",
-		                 list->name);
+    * Parse the content. Only xsl:attribute elements are allowed.
+    */
+    child = cur->children;
+    while (child != NULL) {
+	/*
+	* Report invalid nodes.
+	*/
+	if ((child->type != XML_ELEMENT_NODE) ||
+	    (child->ns == NULL) ||
+	    (! IS_XSLT_ELEM(child)))
+	{
+	    if (child->type == XML_ELEMENT_NODE)
+		xsltTransformError(NULL, style, child,
+			"xsl:attribute-set : unexpected child %s\n",
+		                 child->name);
+	    else
+		xsltTransformError(NULL, style, child,
+			"xsl:attribute-set : child of unexpected type\n");
+	} else if (!IS_XSLT_NAME(child, "attribute")) {
+	    xsltTransformError(NULL, style, child,
+		"xsl:attribute-set : unexpected child xsl:%s\n",
+		child->name);
+	} else {
+#ifdef XSLT_REFACTORED
+	    xsltAttrElemPtr nextAttr, curAttr;
+
+	    /*
+	    * Process xsl:attribute
+	    * ---------------------
+	    */
+
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"add attribute to list %s\n", ncname);
+#endif
+	    /*
+	    * The following was taken over from
+	    * xsltAddAttrElemList().
+	    */
+	    if (attrItems == NULL) {
+		attrItems = xsltNewAttrElem(child);
 	    } else {
+		curAttr = attrItems;
+		while (curAttr != NULL) {
+		    nextAttr = curAttr->next;
+		    if (curAttr->attr == child) {
+			/*
+			* URGENT TODO: Can somebody explain
+			*  why attrItems is set to curAttr
+			*  here? Is this somehow related to
+			*  avoidance of recursions?
+			*/
+			attrItems = curAttr;
+			goto next_child;
+		    }
+		    if (curAttr->next == NULL)			
+			curAttr->next = xsltNewAttrElem(child);
+		    curAttr = nextAttr;
+		}
+	    }
+	    /*
+	    * Parse the xsl:attribute and its content.
+	    */
+	    xsltParseAnyXSLTElem(XSLT_CCTXT(style), child);
+#else
 #ifdef WITH_XSLT_DEBUG_ATTRIBUTES
-		xsltGenericDebug(xsltGenericDebugContext,
-		    "add attribute to list %s\n", ncname);
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"add attribute to list %s\n", ncname);
 #endif
-                values = xsltAddAttrElemList(values, list);
-	    }
-	} else {
-	    xsltGenericError(xsltGenericErrorContext,
-		"xsl:attribute-set : unexpected child %s\n", list->name);
+	    /*
+	    * OLD behaviour:
+	    */
+	    attrItems = xsltAddAttrElemList(attrItems, child);
+#endif
 	}
-	list = list->next;
+
+#ifdef XSLT_REFACTORED
+next_child:
+#endif
+	child = child->next;
     }
 
     /*
-     * Check a possible use-attribute-sets definition
-     */
-    /* TODO check recursion */
-
-    attributes = xmlGetNsProp(cur, (const xmlChar *)"use-attribute-sets",
+    * Process attribue "use-attribute-sets".
+    */
+    /* TODO check recursion */    
+    value = xmlGetNsProp(cur, (const xmlChar *)"use-attribute-sets",
 	NULL);
-    if (attributes == NULL) {
-	goto done;
-    }
-
-    attrib = attributes;
-    while (*attrib != 0) {
-	while (IS_BLANK(*attrib)) attrib++;
-	if (*attrib == 0)
-	    break;
-        endattr = attrib;
-	while ((*endattr != 0) && (!IS_BLANK(*endattr))) endattr++;
-	attrib = xmlDictLookup(style->dict, attrib, endattr - attrib);
-	if (attrib) {
-	    const xmlChar *ncname2 = NULL;
-	    const xmlChar *prefix2 = NULL;
-	    xsltAttrElemPtr values2;
-
+    if (value != NULL) {
+	const xmlChar *curval, *endval;
+	curval = value;
+	while (*curval != 0) {
+	    while (IS_BLANK(*curval)) curval++;
+	    if (*curval == 0)
+		break;
+	    endval = curval;
+	    while ((*endval != 0) && (!IS_BLANK(*endval))) endval++;
+	    curval = xmlDictLookup(style->dict, curval, endval - curval);
+	    if (curval) {
+		const xmlChar *ncname2 = NULL;
+		const xmlChar *prefix2 = NULL;
+		xsltAttrElemPtr refAttrItems;
+		
 #ifdef WITH_XSLT_DEBUG_ATTRIBUTES
-	    xsltGenericDebug(xsltGenericDebugContext,
-		"xsl:attribute-set : %s adds use %s\n", ncname, attrib);
+		xsltGenericDebug(xsltGenericDebugContext,
+		    "xsl:attribute-set : %s adds use %s\n", ncname, curval);
 #endif
-	    ncname2 = xsltSplitQName(style->dict, attrib, &prefix2);
-	    values2 = xsltNewAttrElem(NULL);
-	    if (values2 != NULL) {
-		values2->set = ncname2;
-		values2->ns = prefix2;
-		values = xsltMergeAttrElemList(values, values2);
-		xsltFreeAttrElem(values2);
+		ncname2 = xsltSplitQName(style->dict, curval, &prefix2);
+		refAttrItems = xsltNewAttrElem(NULL);
+		if (refAttrItems != NULL) {
+		    refAttrItems->set = ncname2;
+		    refAttrItems->ns = prefix2;
+		    attrItems = xsltMergeAttrElemList(style,
+			attrItems, refAttrItems);
+		    xsltFreeAttrElem(refAttrItems);
+		}
 	    }
+	    curval = endval;
 	}
-	attrib = endattr;
+	xmlFree(value);
+	value = NULL;
     }
-    xmlFree(attributes);
 
-done:
     /*
      * Update the value
      */
-    if (values == NULL)
-	values = xsltNewAttrElem(NULL);
-    xmlHashUpdateEntry2(style->attributeSets, ncname, prefix, values, NULL);
+    /*
+    * TODO: Why is this dummy entry needed.?
+    */
+    if (attrItems == NULL)
+	attrItems = xsltNewAttrElem(NULL);
+    xmlHashUpdateEntry2(style->attributeSets, ncname, prefix, attrItems, NULL);
 #ifdef WITH_XSLT_DEBUG_ATTRIBUTES
     xsltGenericDebug(xsltGenericDebugContext,
 	"updated attribute list %s\n", ncname);
@@ -447,15 +523,12 @@
 		    /*
 		     * Then merge
 		     */
-		    xsltMergeAttrElemList(values, refs);
+		    xsltMergeAttrElemList(style, values, refs);
 		    /*
 		     * Then suppress the reference
 		     */
-		    xmlFree((char *)tmp->set);
 		    tmp->set = NULL;
-		    if (tmp->ns != NULL) {
-			xmlFree((char *)tmp->ns);
-		    }
+		    tmp->ns = NULL;
 		}
 	    }
 	}
@@ -492,7 +565,7 @@
 	        "xsl:attribute-set : logic error merging from imports for"
 		" attribute-set %s\n", name);
 	} else {
-	    topSet = xsltMergeAttrElemList(topSet, values);
+	    topSet = xsltMergeAttrElemList(style, topSet, values);
 	    xmlHashUpdateEntry2(style->attributeSets, name, ns, topSet, NULL);
 	}
 	xsltFreeAttrElemList(values);
@@ -557,9 +630,9 @@
  * xsltAttributeInternal:
  * @ctxt:  a XSLT process context
  * @node:  the node in the source tree.
- * @inst:  the xslt attribute node
+ * @inst:  the xsl:attribute element
  * @comp:  precomputed information
- * @fromset:  the attribute comes from an attribute-set
+ * @fromAttributeSet:  the attribute comes from an attribute-set
  *
  * Process the xslt attribute node on the source node
  */
@@ -567,59 +640,113 @@
 xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr node,
                       xmlNodePtr inst,
 		      xsltStylePreCompPtr castedComp,
-                      int fromset) {
+                      int fromAttributeSet) {
 #ifdef XSLT_REFACTORED
     xsltStyleItemAttributePtr comp =
 	(xsltStyleItemAttributePtr) castedComp;
+    /*
+    * TODO: Change the fields of the compiled struct:
+    *  1) @name (char)
+    *  2) @nameType (String, AVT)
+    *  3) @nsName (char)
+    *  4) nsNameType (None, String, AVT)
+    */
 #else
     xsltStylePreCompPtr comp = castedComp;
 #endif
-    xmlChar *prop = NULL;
-    xmlChar *namespace;
-    const xmlChar *name = NULL;
-    const xmlChar *prefix = NULL;
+    xmlNodePtr targetElem;
+    xmlChar *prop = NULL;    
+    const xmlChar *name = NULL, *prefix = NULL, *nsName = NULL;
     xmlChar *value = NULL;
     xmlNsPtr ns = NULL;
-    xmlAttrPtr attr;
-    const xmlChar *URL = NULL;
+    xmlAttrPtr attr;    
 
+    if ((ctxt == NULL) || (node == NULL) || (inst == NULL))
+        return;
+    /*
+    * BIG NOTE: This previously used xsltGetSpecialNamespace() and
+    *  xsltGetNamespace(), but since both are not appropriate, we
+    *  will process namespace lookup here to avoid adding yet another
+    *  ns-lookup function to namespaces.c.
+    */
+    /*
+    * SPEC XSLT 1.0: Error cases:
+    * - Creating nodes other than text nodes during the instantiation of
+    *   the content of the xsl:attribute element; implementations may
+    *   either signal the error or ignore the offending nodes."
+    */
 
-    if ((comp == NULL) || (ctxt == NULL)) {
+    if (comp == NULL) {
         xsltTransformError(ctxt, NULL, inst,
-                         "xsl:attribute : compilation failed\n");
+	    "Internal error in xsltAttributeInternal(): "
+	    "The instruction was no compiled.\n");
         return;
-    }
+    }    
+    /*
+    * TODO: Shouldn't ctxt->insert == NULL be treated as an internal error?
+    *   So report an internal error?
+    */
     if (ctxt->insert == NULL)
+        return;    
+    /*
+    * SPEC XSLT 1.0:
+    *  "Adding an attribute to a node that is not an element;
+    *  implementations may either signal the error or ignore the attribute."
+    *
+    * TODO: I think we should signal such errors in the future, and maybe
+    *  provide an option to ignore such errors.
+    */
+    targetElem = ctxt->insert;
+    if (targetElem->type != XML_ELEMENT_NODE)
+	return;
+    
+    /*
+    * SPEC XSLT 1.0:
+    * "Adding an attribute to an element after children have been added
+    *  to it; implementations may either signal the error or ignore the
+    *  attribute."
+    *
+    * TODO: We should decide whether not to report such errors or
+    *  to ignore them; note that we *ignore* if the parent is not an
+    *  element, but here we report an error.
+    */
+    if (targetElem->children != NULL) {
+	/*
+	* NOTE: Ah! This seems to be intended to support streamed
+	*  result generation!.
+	*/
+        xsltTransformError(ctxt, NULL, inst,
+	    "xsl:attribute: Cannot add attributes to an "
+	    "element if children have been already added "
+	    "to the element.\n");
         return;
+    }
 
-    if ((node == NULL) || (inst == NULL) || (comp == NULL))
+    /*
+    * Process the name
+    * ----------------
+    */
+    if (!comp->has_name) /* TODO: raise error */
         return;
-    if (!comp->has_name) {
-        return;
-    }
-    if (ctxt->insert->children != NULL) {
-        xsltTransformError(ctxt, NULL, inst,
-                         "xsl:attribute : node already has children\n");
-        return;
-    }
+
 #ifdef WITH_DEBUGGER
-    if (ctxt->debugStatus != XSLT_DEBUG_NONE) {
+    if (ctxt->debugStatus != XSLT_DEBUG_NONE)
         xslHandleDebugger(inst, node, NULL, ctxt);
-    }
 #endif
 
     if (comp->name == NULL) {
-        prop =
-            xsltEvalAttrValueTemplate(ctxt, inst, (const xmlChar *) "name",
-                                      XSLT_NAMESPACE);
+	/* TODO: fix attr acquisition wrt to the XSLT namespace */
+        prop = xsltEvalAttrValueTemplate(ctxt, inst,
+	    (const xmlChar *) "name", XSLT_NAMESPACE);
         if (prop == NULL) {
             xsltTransformError(ctxt, NULL, inst,
-                             "xsl:attribute : name is missing\n");
+		"xsl:attribute: The attribute 'name' is missing.\n");
             goto error;
         }
 	if (xmlValidateQName(prop, 0)) {
 	    xsltTransformError(ctxt, NULL, inst,
-			    "xsl:attribute : invalid QName\n");
+		"xsl:attribute: The effective name '%s' is not a "
+		"valid QName.\n", prop);
 	    /* we fall through to catch any further errors, if possible */
 	}
 	name = xsltSplitQName(ctxt->dict, prop, &prefix);
@@ -631,72 +758,286 @@
     if (!xmlStrncasecmp(prefix, (xmlChar *) "xmlns", 5)) {
 #ifdef WITH_XSLT_DEBUG_PARSING
         xsltGenericDebug(xsltGenericDebugContext,
-                         "xsltAttribute: xmlns prefix forbidden\n");
+	    "xsltAttribute: xmlns prefix forbidden\n");
 #endif
+	/*
+	* SPEC XSLT 1.0:
+	*  "It is an error if the string that results from instantiating
+	*  the attribute value template is not a QName or is the string
+	*  xmlns. An XSLT processor may signal the error; if it does not
+	*  signal the error, it must recover by not adding the attribute
+	*  to the result tree."
+	* TODO: Decide which way to go here.
+	*/
         goto error;
     }
-    if ((comp->ns == NULL) && (comp->has_ns)) {
-        namespace = xsltEvalAttrValueTemplate(ctxt, inst,
-                                              (const xmlChar *)
-                                              "namespace", XSLT_NAMESPACE);
-        if (namespace != NULL) {
-            ns = xsltGetSpecialNamespace(ctxt, inst, namespace, prefix,
-                                         ctxt->insert);
-            xmlFree(namespace);
-        } else {
-            if (prefix != NULL) {
-                ns = xmlSearchNs(inst->doc, inst, prefix);
-                if (ns == NULL) {
-                    xsltTransformError(ctxt, NULL, inst,
-			 "xsl:attribute : no namespace bound to prefix %s\n",
-                                     prefix);
-                } else {
-                    ns = xsltGetNamespace(ctxt, inst, ns, ctxt->insert);
-                }
-            }
-        }
-    } else if (comp->ns != NULL) {
-        ns = xsltGetSpecialNamespace(ctxt, inst, comp->ns, prefix,
-                                     ctxt->insert);
+    /*
+    * Process namespace semantics
+    * ---------------------------
+    *
+    * Evaluate the namespace name.
+    */
+    if (comp->has_ns) {	 
+	if (comp->ns != NULL) {
+	    if (comp->ns[0] != 0)
+		nsName = comp->ns;
+	} else {
+	    xmlChar *tmpNsName;
+	    /*
+	    * Eval the AVT.
+	    */
+	    /* TODO: check attr acquisition wrt to the XSLT namespace */
+	    tmpNsName = xsltEvalAttrValueTemplate(ctxt, inst,
+		(const xmlChar *) "namespace", XSLT_NAMESPACE);	
+	    /*
+	    * This fixes bug #302020: The AVT might also evaluate to the 
+	    * empty string; this means that the empty string also indicates
+	    * "no namespace".
+	    * SPEC XSLT 1.0:
+	    *  "If the string is empty, then the expanded-name of the
+	    *  attribute has a null namespace URI."
+	    */
+	    if ((tmpNsName != NULL) && (tmpNsName[0] != 0))
+		nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1);
+	    xmlFree(tmpNsName);		
+	};	    
     } else if (prefix != NULL) {
-	xmlNsPtr tmp;
-	tmp = xmlSearchNs(inst->doc, inst, prefix);
-	if (tmp != NULL) {
-	    ns = xsltGetNamespace(ctxt, inst, tmp, ctxt->insert);
-	}
+	/*
+	* SPEC XSLT 1.0:
+	*  "If the namespace attribute is not present, then the QName is
+	*  expanded into an expanded-name using the namespace declarations
+	*  in effect for the xsl:attribute element, *not* including any
+	*  default namespace declaration."
+	*/	
+	ns = xmlSearchNs(inst->doc, inst, prefix);
+	if (ns == NULL) {
+	    /*
+	    * Note that this is treated as an error now (checked with
+	    *  Saxon, Xalan-J and MSXML).
+	    */
+	    xsltTransformError(ctxt, NULL, inst,
+		"xsl:attribute: The effective prefix '%s', has no "
+		"namespace binding in scope in the stylesheet; "
+		"this is an error, since the namespace was not "
+		"specified by the instruction itself.\n", prefix);
+	} else
+	    nsName = ns->href;	
     }
 
-    if ((fromset) && (ns != NULL))
-        URL = ns->href;
-
-    if (fromset) {
-	if (URL != NULL)
-	    attr = xmlHasNsProp(ctxt->insert, name, URL);
-	else
-	    attr = xmlHasProp(ctxt->insert, name);
+    if (fromAttributeSet) {
+	/*
+	* I think this tries to ensure that xsl:attribute(s) coming
+	* from an xsl:attribute-set won't override attribute of
+	* literal result elements or of explicit xsl:attribute(s).
+	*/
+	attr = xmlHasNsProp(targetElem, name, nsName);
 	if (attr != NULL)
 	    return;
     }
-    value = xsltEvalTemplateString(ctxt, node, inst);
-    if (value == NULL) {
-        if (ns) {
-            attr = xmlSetNsProp(ctxt->insert, ns, name,
-                                (const xmlChar *) "");
-        } else {
-            attr =
-                xmlSetProp(ctxt->insert, name, (const xmlChar *) "");
-        }
+
+    /*
+    * Something about ns-prefixes:
+    * SPEC XSLT 1.0:
+    *  "XSLT processors may make use of the prefix of the QName specified
+    *  in the name attribute when selecting the prefix used for outputting
+    *  the created attribute as XML; however, they are not required to do
+    *  so and, if the prefix is xmlns, they must not do so"
+    */        
+    /*
+    * Find/create a matching ns-decl in the result tree.
+    */
+    ns = NULL;
+#if 0
+    if (0) {	
+	/*
+	* OPTIMIZE TODO: How do we know if we are adding to a
+	*  fragment or not?
+	*
+	* If we are adding to a result tree fragment (i.e., not to the
+	* actual result tree), we'll don't bother searching for the
+	* ns-decl, but just store it in the dummy-doc of the result
+	* tree fragment.
+	*/
+	if (nsName != NULL) {
+	    ns = xsltTreeAcquireStoredNs(ctxt->document->doc, nsName,
+		prefix);
+	}
+    }
+#endif
+    if (nsName != NULL) {
+	/*
+	* The owner-element might be in the same namespace.
+	*/
+	if ((targetElem->ns != NULL) &&
+	    (targetElem->ns->prefix != NULL) &&	    
+	    xmlStrEqual(targetElem->ns->href, nsName))
+	{
+	    ns = targetElem->ns;
+	    goto namespace_finished;
+	}
+	if (prefix != NULL) {
+	    /*
+	    * Search by ns-prefix.
+	    */
+	    ns = xmlSearchNs(targetElem->doc, targetElem, prefix);
+	    if ((ns != NULL) && (xmlStrEqual(ns->href, nsName))) {
+		goto namespace_finished;
+	    }
+	}
+	/*
+	* Fallback to a search by ns-name.
+	*/	
+	ns = xmlSearchNsByHref(targetElem->doc, targetElem, nsName);
+	if ((ns != NULL) && (ns->prefix != NULL)) {
+	    goto namespace_finished;
+	}
+	/*
+	* OK, we need to declare the namespace on the target element.
+	*/
+	if (prefix) {
+	    if (targetElem->nsDef != NULL) {
+		ns = targetElem->nsDef;
+		do {
+		    if ((ns->prefix) && xmlStrEqual(ns->prefix, prefix)) {
+			/*
+			* The prefix is aready occupied.
+			*/
+			break;
+		    }
+		    ns = ns->next;
+		} while (ns != NULL);
+		if (ns == NULL) {
+		    ns = xmlNewNs(targetElem, nsName, prefix);
+		    goto namespace_finished;
+		}
+	    }
+	}
+	/*
+	* Generate a new prefix.
+	*/
+	{
+	    const xmlChar *basepref = prefix;
+	    xmlChar pref[30];
+	    int counter = 1;
+	    
+	    if (prefix != NULL)
+		basepref = prefix;
+	    else
+		basepref = xmlStrdup(BAD_CAST "ns");
+	    
+	    do {
+		snprintf((char *) pref, 30, "%s%d",
+		    basepref, counter++);
+		ns = xmlSearchNs(targetElem->doc, targetElem, BAD_CAST pref);
+		if (counter > 1000) {
+		    xsltTransformError(ctxt, NULL, inst,
+		    	"Namespace fixup error: Failed to compute a "
+			"new unique ns-prefix for the generated attribute "
+			"{%s}%s'.\n", nsName, name);		    			
+		    ns = NULL;
+		    break;
+		}
+	    } while (ns != NULL);
+	    if (basepref != prefix)
+		xmlFree((xmlChar *)basepref);
+	    ns = xmlNewNs(targetElem, nsName, BAD_CAST pref);
+	}
+
+namespace_finished:
+
+	if (ns == NULL) {
+	    xsltTransformError(ctxt, NULL, inst,
+		"Namespace fixup error: Failed to acquire an in-scope "
+		"namespace binding of the generated attribute '{%s}%s'.\n",
+		nsName, name);
+	    /*
+	    * TODO: Should we just stop here?
+	    */
+	}
+    }
+    /*
+    * Construction of the value
+    * -------------------------
+    */
+    if (inst->children == NULL) {
+	/*
+	* No content.
+	* TODO: Do we need to put the empty string in ?
+	*/
+	attr = xmlSetNsProp(ctxt->insert, ns, name, (const xmlChar *) "");
+    } else if ((inst->children->next == NULL) && 
+	    ((inst->children->type == XML_TEXT_NODE) ||
+	     (inst->children->type == XML_CDATA_SECTION_NODE)))
+    {
+	xmlNodePtr origTxt = inst->children, copyTxt;
+	/*
+	* Optimization: if the content is just 1 text node, then
+	* just need to copy it over, or just assign it to the result
+	* if the string is shared.
+	*/
+	attr = xmlSetNsProp(ctxt->insert, ns, name, NULL);
+	if (attr == NULL) /* TODO: report error ? */
+	    goto error;
+	/*
+	* This was taken over from xsltCopyText() (transform.c).
+	*/
+	if (ctxt->internalized &&
+	    (ctxt->insert->doc != NULL) &&
+	    (ctxt->insert->doc->dict == ctxt->dict))
+	{
+	    copyTxt = xmlNewText(NULL);
+	    if (copyTxt == NULL) /* TODO: report error */
+		goto error;
+	    /*
+	    * This is a safe scenario where we don't need to lookup
+	    * the dict.
+	    */
+	    copyTxt->content = origTxt->content;
+	    /*
+	    * Copy "disable-output-escaping" information.
+	    * TODO: Does this have any effect for attribute values
+	    *  anyway?
+	    */
+	    if (origTxt->name == xmlStringTextNoenc)
+		copyTxt->name = xmlStringTextNoenc;
+	} else {
+	    /*
+	    * Copy the value.
+	    */
+	    copyTxt = xmlNewText(origTxt->content);
+	    if (copyTxt == NULL) /* TODO: report error */
+		goto error;
+	    /*
+	    * Copy "disable-output-escaping" information.
+	    * TODO: Does this have any effect for attribute values
+	    *  anyway?
+	    */
+	    if (origTxt->name == xmlStringTextNoenc)
+		copyTxt->name = xmlStringTextNoenc;
+	}
+	if (copyTxt != NULL) {
+	    copyTxt->doc = attr->doc;
+	    xmlAddChild((xmlNodePtr) attr, copyTxt);
+	}
     } else {
-        if (ns) {
-            attr = xmlSetNsProp(ctxt->insert, ns, name, value);
-        } else {
-            attr = xmlSetProp(ctxt->insert, name, value);
-        }
+	/*
+	* The sequence constructor might be complex, so instantiate it.
+	*/
+	value = xsltEvalTemplateString(ctxt, node, inst);
+	if (value != NULL) {
+	    attr = xmlSetNsProp(ctxt->insert, ns, name, value);
+	    xmlFree(value);
+	} else {
+	    /*
+	    * TODO: Do we have to add the empty string to the attr?
+	    */
+	    attr = xmlSetNsProp(ctxt->insert, ns, name,
+		(const xmlChar *) "");
+	}
     }
 
 error:
-    if (value != NULL)
-        xmlFree(value);
+    return;    
 }
 
 /**

Modified: packages/libxslt/branches/upstream/current/libxslt/documents.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/documents.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/documents.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -153,11 +153,24 @@
     memset(cur, 0, sizeof(xsltDocument));
     cur->doc = doc;
     if (ctxt != NULL) {
-        if (!xmlStrEqual((xmlChar *)doc->name, BAD_CAST " fake node libxslt")) {
+        if (! XSLT_IS_RES_TREE_FRAG(doc)) {
 	    cur->next = ctxt->docList;
 	    ctxt->docList = cur;
 	}
+#ifdef XSLT_REFACTORED_KEYCOMP
+	/*
+	* A key with a specific name for a specific document
+	* will only be computed if there's a call to the key()
+	* function using that specific name for that specific
+	* document. I.e. computation of keys will be done in
+	* xsltGetKey() (keys.c) on an on-demand basis.
+	*/
+#else
+	/*
+	* Old behaviour.
+	*/
 	xsltInitCtxtKeys(ctxt, cur);
+#endif
     }
     return(cur);
 }
@@ -192,18 +205,40 @@
 
 /**
  * xsltFreeStyleDocuments:
- * @style: an XSLT style sheet
+ * @style: an XSLT stylesheet (representing a stylesheet-level)
  *
- * Free up all the space used by the loaded documents
+ * Frees the node-trees (and xsltDocument structures) of all
+ * stylesheet-modules of the stylesheet-level represented by
+ * the given @style. 
  */
 void	
 xsltFreeStyleDocuments(xsltStylesheetPtr style) {
     xsltDocumentPtr doc, cur;
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    xsltNsMapPtr nsMap;
+#endif
+    
+    if (style == NULL)
+	return;
 
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    if (XSLT_HAS_INTERNAL_NSMAP(style))
+	nsMap = XSLT_GET_INTERNAL_NSMAP(style);
+    else
+	nsMap = NULL;    
+#endif   
+
     cur = style->docList;
     while (cur != NULL) {
 	doc = cur;
 	cur = cur->next;
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+	/*
+	* Restore all changed namespace URIs of ns-decls.
+	*/
+	if (nsMap)
+	    xsltRestoreDocumentNamespaces(nsMap, doc->doc);
+#endif
 	xsltFreeDocumentKeys(doc);
 	if (!doc->main)
 	    xmlFreeDoc(doc->doc);

Modified: packages/libxslt/branches/upstream/current/libxslt/extensions.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/extensions.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/extensions.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -469,12 +469,19 @@
 /**
  * xsltRegisterExtPrefix:
  * @style: an XSLT stylesheet
- * @prefix: the prefix used
+ * @prefix: the prefix used (optional)
  * @URI: the URI associated to the extension
- *
+ * 
  * Registers an extension namespace
+ * This is called from xslt.c during compile-time.
+ * The given prefix is not needed.
+ * Called by:
+ *   xsltParseExtElemPrefixes() (new function)
+ *   xsltRegisterExtPrefix() (old function)
  *
- * Returns 0 in case of success, -1 in case of failure
+ * Returns 0 in case of success, 1 if the @URI was already
+ *         registered as an extension namespace and
+ *         -1 in case of failure
  */
 int
 xsltRegisterExtPrefix(xsltStylesheetPtr style,
@@ -482,20 +489,30 @@
 {
     xsltExtDefPtr def, ret;
 
-    if ((style == NULL) || (prefix == NULL) | (URI == NULL))
+    if ((style == NULL) || (URI == NULL))
         return (-1);
 
 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
     xsltGenericDebug(xsltGenericDebugContext,
-                     "Registering extension prefix %s : %s\n", prefix,
-                     URI);
+	"Registering extension namespace '%s'.\n", URI);
 #endif
     def = (xsltExtDefPtr) style->nsDefs;
+#ifdef XSLT_REFACTORED
+    /*
+    * The extension is associated with a namespace name.
+    */
     while (def != NULL) {
+        if (xmlStrEqual(URI, def->URI))
+            return (1);
+        def = def->next;
+    }
+#else
+    while (def != NULL) {
         if (xmlStrEqual(prefix, def->prefix))
             return (-1);
         def = def->next;
     }
+#endif
     ret = xsltNewExtDef(prefix, URI);
     if (ret == NULL)
         return (-1);
@@ -506,6 +523,12 @@
      * check wether there is an extension module with a stylesheet
      * initialization function.
      */
+#ifdef XSLT_REFACTORED
+    /*
+    * Don't initialize modules based on specified namespaced via
+    * the attribute "[xsl:]extension-element-prefixes".
+    */
+#else
     if (xsltExtensionsHash != NULL) {
         xsltExtModulePtr module;
 
@@ -515,11 +538,11 @@
                 module = xmlHashLookup(xsltExtensionsHash, URI);
             }
         }
-
         if (module != NULL) {
             xsltStyleGetExtData(style, URI);
         }
     }
+#endif
     return (0);
 }
 
@@ -600,85 +623,200 @@
 }
 
 /**
- * xsltStyleGetExtData:
+ * xsltStyleGetStylesheetExtData:
  * @style: an XSLT stylesheet
  * @URI:  the URI associated to the exension module
  *
- * Retrieve the data associated to the extension module in this given
- * stylesheet.
+ * Fires the compile-time initialization callback
+ * of an extension module and returns a container
+ * holding the user-data (retrieved via the callback).
  *
- * Returns the pointer or NULL if not present
+ * Returns the create module-data container
+ *         or NULL if such a module was not registered.
  */
-void *
-xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar * URI)
+static xsltExtDataPtr
+xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style,
+				     const xmlChar * URI)
 {
-    xsltExtDataPtr data = NULL;
-    xsltStylesheetPtr tmp;
+    xsltExtDataPtr dataContainer;
+    void *userData = NULL;
+    xsltExtModulePtr module;
+    
+    if ((style == NULL) || (URI == NULL))	
+	return(NULL);
 
-
-    if ((style == NULL) || (URI == NULL))
-        return (NULL);
-
-    tmp = style;
-    while (tmp != NULL) {
-        if (tmp->extInfos != NULL) {
-            data = (xsltExtDataPtr) xmlHashLookup(tmp->extInfos, URI);
-            if (data != NULL)
-                break;
-        }
-        tmp = xsltNextImport(tmp);
+    if (xsltExtensionsHash == NULL) {
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "Not registered extension module: %s\n", URI);
+#endif
+	return(NULL);
     }
-    if (data == NULL) {
-        if (style->extInfos == NULL) {
-            style->extInfos = xmlHashCreate(10);
-            if (style->extInfos == NULL)
-                return (NULL);
-        }
-    }
-    if (data == NULL) {
-        void *extData;
-        xsltExtModulePtr module;
 
-        module = xmlHashLookup(xsltExtensionsHash, URI);
-        if (module == NULL) {
+    module = xmlHashLookup(xsltExtensionsHash, URI);
+    if (module == NULL) {
 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
-            xsltGenericDebug(xsltGenericDebugContext,
-                             "Not registered extension module: %s\n", URI);
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "Not registered extension module: %s\n", URI);
 #endif
-            return (NULL);
-        } else {
-            if (module->styleInitFunc == NULL) {
+	return (NULL);
+    }
+    /*
+    * The specified module was registered so initialize it.
+    */
+    if (style->extInfos == NULL) {
+	style->extInfos = xmlHashCreate(10);
+	if (style->extInfos == NULL)
+	    return (NULL);
+    }
+    /*
+    * Fire the initialization callback if available.
+    */
+    if (module->styleInitFunc == NULL) {
 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
-                xsltGenericDebug(xsltGenericDebugContext,
-                                 "Registering style module: %s\n", URI);
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "Initializing module with *no* callback: %s\n", URI);
 #endif
-                extData = NULL;
-            } else {
+    } else {
 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
-                xsltGenericDebug(xsltGenericDebugContext,
-                                 "Initializing module: %s\n", URI);
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "Initializing module with callback: %s\n", URI);
 #endif
-                extData = module->styleInitFunc(style, URI);
-            }
+	/*
+	* Fire the initialization callback.
+	*/
+	userData = module->styleInitFunc(style, URI);
+    }    
+    /*
+    * Store the user-data in the context of the given stylesheet.
+    */
+    dataContainer = xsltNewExtData(module, userData);
+    if (dataContainer == NULL)
+	return (NULL);
 
-            data = xsltNewExtData(module, extData);
-            if (data == NULL)
-                return (NULL);
-            if (xmlHashAddEntry(style->extInfos, URI, (void *) data) < 0) {
-                xsltGenericError(xsltGenericErrorContext,
-                                 "Failed to register module data: %s\n",
-                                 URI);
-                if (module->styleShutdownFunc)
-                    module->styleShutdownFunc(style, URI, extData);
-                xsltFreeExtData(data);
-                return (NULL);
-            }
-        }
+    if (xmlHashAddEntry(style->extInfos, URI,
+	(void *) dataContainer) < 0)
+    {
+	xsltTransformError(NULL, style, NULL,	    
+	    "Failed to register module '%s'.\n", URI);
+	style->errors++;
+	if (module->styleShutdownFunc)
+	    module->styleShutdownFunc(style, URI, userData);
+	xsltFreeExtData(dataContainer);
+	return (NULL);
     }
-    return (data->extData);
+
+    return(dataContainer);
 }
 
 /**
+ * xsltStyleGetExtData:
+ * @style: an XSLT stylesheet
+ * @URI:  the URI associated to the exension module
+ *
+ * Retrieve the data associated to the extension module
+ * in this given stylesheet.
+ * Called by:
+ *   xsltRegisterExtPrefix(),
+ *   ( xsltExtElementPreCompTest(), xsltExtInitTest )
+ *
+ * Returns the pointer or NULL if not present
+ */
+void *
+xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar * URI)
+{
+    xsltExtDataPtr dataContainer = NULL;
+    xsltStylesheetPtr tmpStyle;
+
+    if ((style == NULL) || (URI == NULL) ||
+	(xsltExtensionsHash == NULL))
+	return (NULL);
+
+    
+#ifdef XSLT_REFACTORED
+    /*
+    * This is intended for global storage, so only the main
+    * stylesheet will hold the data.
+    */
+    tmpStyle = style;
+    while (tmpStyle->parent != NULL)
+	tmpStyle = tmpStyle->parent;
+    if (tmpStyle->extInfos != NULL) {
+	dataContainer =
+	    (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI);
+	if (dataContainer != NULL) {
+	    /*
+	    * The module was already initialized in the context
+	    * of this stylesheet; just return the user-data that
+	    * comes with it.
+	    */
+	    return(dataContainer->extData);
+	}
+    }
+#else
+    /*
+    * Old behaviour.
+    */
+    tmpStyle = style;
+    while (tmpStyle != NULL) {
+	if (tmpStyle->extInfos != NULL) {
+	    dataContainer =
+		(xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI);
+	    if (dataContainer != NULL) {
+		return(dataContainer->extData);
+	    }
+	}
+	tmpStyle = xsltNextImport(tmpStyle);
+    }
+    tmpStyle = style;
+#endif
+
+    dataContainer =
+        xsltStyleInitializeStylesheetModule(tmpStyle, URI);
+    if (dataContainer != NULL)
+	return (dataContainer->extData);
+    return(NULL);
+}
+
+/**
+ * xsltStyleGetExtDataPerStylesheetLevel:
+ * @style: an XSLT stylesheet
+ * @URI:  the URI associated to the exension module
+ *
+ * Retrieve the data associated to the extension module in this given
+ * stylesheet.
+ *
+ * Returns the pointer or NULL if not present
+ */
+void *
+xsltStyleStylesheetLevelGetExtData(xsltStylesheetPtr style,
+				   const xmlChar * URI)
+{
+    xsltExtDataPtr dataContainer = NULL;
+
+    if ((style == NULL) || (URI == NULL) ||
+	(xsltExtensionsHash == NULL))
+	return (NULL);
+
+    if (style->extInfos != NULL) {
+	dataContainer = (xsltExtDataPtr) xmlHashLookup(style->extInfos, URI);
+	/*
+	* The module was already initialized in the context
+	* of this stylesheet; just return the user-data that
+	* comes with it.
+	*/
+	if (dataContainer)
+	    return(dataContainer->extData);
+    }  
+
+    dataContainer =
+        xsltStyleInitializeStylesheetModule(style, URI);
+    if (dataContainer != NULL)
+	return (dataContainer->extData);
+    return(NULL);
+}
+
+/**
  * xsltGetExtData:
  * @ctxt: an XSLT transformation context
  * @URI:  the URI associated to the exension module
@@ -939,8 +1077,13 @@
                      "Shutting down module : %s\n", URI);
 #endif
     module->styleShutdownFunc(style, URI, data->extData);
-    xmlHashRemoveEntry(style->extInfos, URI,
-                       (xmlHashDeallocator) xsltFreeExtData);
+    /*
+    * Don't remove the entry from the hash table here, since
+    * this will produce segfaults - this fixes bug #340624.
+    *
+    * xmlHashRemoveEntry(style->extInfos, URI,
+    *   (xmlHashDeallocator) xsltFreeExtData);
+    */    
 }
 
 /**
@@ -964,29 +1107,60 @@
 /**
  * xsltCheckExtPrefix:
  * @style: the stylesheet
- * @prefix: the namespace prefix (possibly NULL)
+ * @URI: the namespace URI (possibly NULL)
  *
- * Check if the given prefix is one of the declared extensions
+ * Check if the given prefix is one of the declared extensions.
+ * This is intended to be called only at compile-time.
+ * Called by:
+ *  xsltGetInheritedNsList() (xslt.c)
+ *  xsltParseTemplateContent (xslt.c)
  *
  * Returns 1 if this is an extension, 0 otherwise
  */
 int
-xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar * prefix)
-{
+xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar * URI)
+{    
+#ifdef XSLT_REFACTORED
+    if ((style == NULL) || (style->compCtxt == NULL) ||
+	(XSLT_CCTXT(style)->inode == NULL) ||
+	(XSLT_CCTXT(style)->inode->extElemNs == NULL))
+        return (0);    
+    /*
+    * Lookup the extension namespaces registered
+    * at the current node in the stylesheet's tree.
+    */
+    if (XSLT_CCTXT(style)->inode->extElemNs != NULL) {
+	int i;
+	xsltPointerListPtr list = XSLT_CCTXT(style)->inode->extElemNs;
+
+	for (i = 0; i < list->number; i++) {
+	    if (xmlStrEqual((const xmlChar *) list->items[i],
+		URI))
+	    {
+		return(1);
+	    }	    
+	}
+    }
+#else
     xsltExtDefPtr cur;
 
     if ((style == NULL) || (style->nsDefs == NULL))
         return (0);
-
-    if (prefix == NULL)
-        prefix = BAD_CAST "#default";
-
+    if (URI == NULL)
+        URI = BAD_CAST "#default";
     cur = (xsltExtDefPtr) style->nsDefs;
     while (cur != NULL) {
-        if (xmlStrEqual(prefix, cur->prefix))
+	/*
+	* NOTE: This was change to work on namespace names rather
+	* than namespace prefixes. This fixes bug #339583.
+	* TODO: Consider renaming the field "prefix" of xsltExtDef
+	*  to "href".
+	*/
+        if (xmlStrEqual(URI, cur->prefix))
             return (1);
         cur = cur->next;
     }
+#endif
     return (0);
 }
 
@@ -1281,13 +1455,39 @@
 
     ext = (xsltExtElementPtr)
         xmlHashLookup2(xsltElementsHash, inst->name, inst->ns->href);
+    /*
+    * EXT TODO: Now what?
+    */
     if (ext == NULL)
         return (NULL);
 
-    if (ext->precomp != NULL)
+    if (ext->precomp != NULL) {
+	/*
+	* REVISIT TODO: Check if the text below is correct.
+	* This will return a xsltElemPreComp structure or NULL.
+	* 1) If the the author of the extension needs a
+	*  custom structure to hold the specific values of
+	*  this extension, he will derive a structure based on
+	*  xsltElemPreComp; thus we obviously *cannot* refactor
+	*  the xsltElemPreComp structure, since all already derived
+	*  user-defined strucures will break.
+	*  Example: For the extension xsl:document,
+	*   in xsltDocumentComp() (preproc.c), the structure
+	*   xsltStyleItemDocument is allocated, filled with
+	*   specific values and returned.
+	* 2) If the author needs no values to be stored in
+	*  this structure, then he'll return NULL;
+	*/
         comp = ext->precomp(style, inst, ext->transform);
-    if (comp == NULL)
+    }
+    if (comp == NULL) {
+	/*
+	* Default creation of a xsltElemPreComp structure, if
+	* the author of this extension did not create a custom
+	* structure.
+	*/
         comp = xsltNewElemPreComp(style, inst, ext->transform);
+    }
 
     return (comp);
 }
@@ -1553,6 +1753,13 @@
 {
     xsltExtDataPtr data;
 
+    /*
+    * TODO: Why do we have a return type of xmlHashTablePtr?
+    *   Is the user-allocated data for extension modules expected
+    *   to be a xmlHashTablePtr only? Or is this intended for
+    *   the EXSLT module only?
+    */
+
     if (style != NULL && style->extInfos != NULL) {
         data = xmlHashLookup(style->extInfos, URI);
         if (data != NULL && data->extData != NULL)

Modified: packages/libxslt/branches/upstream/current/libxslt/extensions.h
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/extensions.h	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/extensions.h	2006-06-08 22:23:55 UTC (rev 563)
@@ -93,7 +93,12 @@
 XSLTPUBFUN void * XSLTCALL		
 		xsltStyleGetExtData	(xsltStylesheetPtr style,
 					 const xmlChar *URI);
-
+#ifdef XSLT_REFACTORED
+XSLTPUBFUN void * XSLTCALL
+		xsltStyleStylesheetLevelGetExtData(
+					 xsltStylesheetPtr style,
+					 const xmlChar * URI);
+#endif
 XSLTPUBFUN void XSLTCALL		
     		xsltShutdownCtxtExts	(xsltTransformContextPtr ctxt);
 
@@ -210,7 +215,7 @@
 					 const xmlChar *URI);
 XSLTPUBFUN int XSLTCALL		
 		xsltCheckExtPrefix	(xsltStylesheetPtr style,
-					 const xmlChar *prefix);
+					 const xmlChar *URI);
 XSLTPUBFUN int XSLTCALL		
 		xsltInitCtxtExts	(xsltTransformContextPtr ctxt);
 XSLTPUBFUN void XSLTCALL		

Modified: packages/libxslt/branches/upstream/current/libxslt/imports.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/imports.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/imports.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -41,6 +41,7 @@
 #include "xslt.h"
 #include "xsltInternals.h"
 #include "xsltutils.h"
+#include "preproc.h"
 #include "imports.h"
 #include "documents.h"
 #include "security.h"
@@ -229,7 +230,16 @@
 	    "xsl:include : unable to load %s\n", URI);
 	goto error;
     }
-
+#ifdef XSLT_REFACTORED    
+    if (IS_XSLT_ELEM_FAST(cur) && (cur->psvi != NULL)) {
+	((xsltStyleItemIncludePtr) cur->psvi)->include = include;
+    } else {
+	xsltTransformError(NULL, style, cur,
+	    "Internal error: (xsltParseStylesheetInclude) "
+	    "The xsl:include element was not compiled.\n", URI);
+	style->errors++;
+    }
+#endif
     oldDoc = style->doc;
     style->doc = include->doc;
     /* chain to stylesheet for recursion checking */
@@ -237,6 +247,12 @@
     style->includes = include;
     oldNopreproc = style->nopreproc;
     style->nopreproc = include->preproc;
+    /*
+    * TODO: This will change some values of the
+    *  including stylesheet with every included module
+    *  (e.g. excluded-result-prefixes)
+    *  We need to strictly seperate such stylesheet-owned values.
+    */
     result = xsltParseStylesheetProcess(style, include->doc);
     style->nopreproc = oldNopreproc;
     include->preproc = 1;
@@ -359,6 +375,13 @@
  * @nameURI: the template name URI
  *
  * Finds the named template, apply import precedence rule.
+ * REVISIT TODO: We'll change the nameURI fields of
+ *  templates to be in the string dict, so if the
+ *  specified @nameURI is in the same dict, then use pointer
+ *  comparison. Check if this can be done in a sane way.
+ *  Maybe this function is not needed internally at
+ *  transformation-time if we hard-wire the called templates
+ *  to the caller.
  *
  * Returns the xsltTemplatePtr or NULL if not found
  */

Modified: packages/libxslt/branches/upstream/current/libxslt/keys.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/keys.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/keys.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -32,31 +32,7 @@
 #define WITH_XSLT_DEBUG_KEYS
 #endif
 
-typedef struct _xsltKeyDef xsltKeyDef;
-typedef xsltKeyDef *xsltKeyDefPtr;
-struct _xsltKeyDef {
-    struct _xsltKeyDef *next;
-    xmlNodePtr inst;
-    xmlChar *name;
-    xmlChar *nameURI;
-    xmlChar *match;
-    xmlChar *use;
-    xmlXPathCompExprPtr comp;
-    xmlXPathCompExprPtr usecomp;
-    xmlNsPtr *nsList;           /* the namespaces in scope */
-    int nsNr;                   /* the number of namespaces in scope */
-};
 
-typedef struct _xsltKeyTable xsltKeyTable;
-typedef xsltKeyTable *xsltKeyTablePtr;
-struct _xsltKeyTable {
-    struct _xsltKeyTable *next;
-    xmlChar *name;
-    xmlChar *nameURI;
-    xmlHashTablePtr keys;
-};
-
-
 /************************************************************************
  * 									*
  * 			Type functions 					*
@@ -369,6 +345,14 @@
     xsltGenericDebug(xsltGenericDebugContext,
 	"   resulting pattern %s\n", pattern);
 #endif
+    /*    
+    * XSLT-1: "It is an error for the value of either the use
+    *  attribute or the match attribute to contain a
+    *  VariableReference."
+    * TODO: We should report a variable-reference at compile-time.
+    *   Maybe a search for "$", if it occurs outside of quotation
+    *   marks, could be sufficient.
+    */
     key->comp = xsltXPathCompile(style, pattern);
     if (key->comp == NULL) {
 	xsltTransformError(NULL, style, inst,
@@ -407,6 +391,9 @@
 	   const xmlChar *nameURI, const xmlChar *value) {
     xmlNodeSetPtr ret;
     xsltKeyTablePtr table;
+#ifdef XSLT_REFACTORED_KEYCOMP
+    int found = 0;
+#endif
 
     if ((ctxt == NULL) || (name == NULL) || (value == NULL) ||
 	(ctxt->document == NULL))
@@ -418,15 +405,62 @@
 #endif
     table = (xsltKeyTablePtr) ctxt->document->keys;
     while (table != NULL) {
-	if (xmlStrEqual(table->name, name) &&
-	    (((nameURI == NULL) && (table->nameURI == NULL)) ||
-	     ((nameURI != NULL) && (table->nameURI != NULL) &&
-	      (xmlStrEqual(table->nameURI, nameURI))))) {
+	if (((nameURI != NULL) == (table->nameURI != NULL)) &&
+	    xmlStrEqual(table->name, name) &&
+	    xmlStrEqual(table->nameURI, nameURI))
+	{
+#ifdef XSLT_REFACTORED_KEYCOMP
+	    found = 1;
+#endif
 	    ret = (xmlNodeSetPtr)xmlHashLookup(table->keys, value);
 	    return(ret);
 	}
 	table = table->next;
     }
+#ifdef XSLT_REFACTORED_KEYCOMP
+    if (! found) {
+	xsltStylesheetPtr style = ctxt->style;	
+	xsltKeyDefPtr keyd;
+	/*
+	* This might be the first call to the key with the specified
+	* name and the specified document.
+	* Find all keys with a matching name and compute them for the
+	* current tree.
+	*/
+	found = 0;
+	while (style != NULL) {
+	    keyd = (xsltKeyDefPtr) style->keys;
+	    while (keyd != NULL) {
+		if (((nameURI != NULL) == (keyd->nameURI != NULL)) &&
+		    xmlStrEqual(keyd->name, name) &&
+		    xmlStrEqual(keyd->nameURI, nameURI))
+		{
+		    found = 1;
+		    xsltInitCtxtKey(ctxt, ctxt->document, keyd);
+		}
+		keyd = keyd->next;		
+	    }	    
+	    style = xsltNextImport(style);
+	}
+	if (found) {
+	    /*
+	    * The key was computed, so look it up.
+	    */
+	    table = (xsltKeyTablePtr) ctxt->document->keys;
+	    while (table != NULL) {
+		if (((nameURI != NULL) == (table->nameURI != NULL)) &&
+		    xmlStrEqual(table->name, name) &&
+		    xmlStrEqual(table->nameURI, nameURI))
+		{
+		    ret = (xmlNodeSetPtr)xmlHashLookup(table->keys, value);
+		    return(ret);
+		}
+		table = table->next;
+	    }
+
+	}
+    }
+#endif
     return(NULL);
 }
 
@@ -513,6 +547,7 @@
     ctxt->xpathCtxt->namespaces = oldNamespaces;
     return(ret);
 }
+
 /**
  * xsltInitCtxtKey:
  * @ctxt: an XSLT transformation context
@@ -521,7 +556,7 @@
  *
  * Computes the key tables this key and for the current input document.
  */
-static void
+int
 xsltInitCtxtKey(xsltTransformContextPtr ctxt, xsltDocumentPtr doc,
 	        xsltKeyDefPtr keyd) {
     int i;
@@ -537,6 +572,7 @@
     int oldNsNr;
     xmlNsPtr *oldNamespaces;
 
+    doc->nbKeysComputed++;
     /*
      * Evaluate the nodelist
      */
@@ -692,6 +728,7 @@
     ctxt->node = oldNode;
     if (res != NULL)
 	xmlXPathFreeObject(res);
+    return(0);
 }
 
 /**
@@ -701,6 +738,7 @@
  *
  * Computes all the keys tables for the current input document.
  * Should be done before global varibales are initialized.
+ * NOTE: Not used anymore in the refactored code.
  */
 void
 xsltInitCtxtKeys(xsltTransformContextPtr ctxt, xsltDocumentPtr doc) {

Modified: packages/libxslt/branches/upstream/current/libxslt/namespaces.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/namespaces.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/namespaces.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -52,6 +52,32 @@
  *									*
  ************************************************************************/
 
+#ifdef XSLT_REFACTORED  
+static xsltNsAliasPtr
+xsltNewNsAlias(xsltCompilerCtxtPtr cctxt)
+{
+    xsltNsAliasPtr ret;
+
+    if (cctxt == NULL)
+	return(NULL);
+
+    ret = (xsltNsAliasPtr) xmlMalloc(sizeof(xsltNsAlias));
+    if (ret == NULL) {
+	xsltTransformError(NULL, cctxt->style, NULL,
+	    "Internal error in xsltNewNsAlias(): Memory allocation failed.\n");
+	cctxt->style->errors++;
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(xsltNsAlias));    
+    /*
+    * TODO: Store the item at current stylesheet-level.
+    */
+    ret->next = cctxt->nsAliases;
+    cctxt->nsAliases = ret;       
+
+    return(ret);
+}
+#endif /* XSLT_REFACTORED */
 /**
  * xsltNamespaceAlias:
  * @style:  the XSLT stylesheet
@@ -61,46 +87,163 @@
  * them as well as the corresponding namespace.
  */
 void
-xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) {
-    xmlChar *sprefix;
-    xmlNsPtr sNs;
-    const xmlChar *shref;
-    xmlChar *rprefix;
-    xmlNsPtr rNs;
-    const xmlChar *rhref;
+xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
+{
+    xmlChar *resultPrefix = NULL;
+    xmlChar *stylePrefix = NULL;
+    xmlNsPtr literalNs = NULL;
+    xmlNsPtr targetNs = NULL;
+ 
+#ifdef XSLT_REFACTORED 
+    xsltNsAliasPtr alias;
 
-    sprefix = xmlGetNsProp(node, (const xmlChar *)"stylesheet-prefix", NULL);
-    if (sprefix == NULL) {
+    if ((style == NULL) || (node == NULL))
+	return;
+
+    /*
+    * SPEC XSLT 1.0:
+    *  "If a namespace URI is declared to be an alias for multiple
+    *  different namespace URIs, then the declaration with the highest
+    *  import precedence is used. It is an error if there is more than
+    *  one such declaration. An XSLT processor may signal the error;
+    *  if it does not signal the error, it must recover by choosing,
+    *  from amongst the declarations with the highest import precedence,
+    *  the one that occurs last in the stylesheet."
+    *
+    * SPEC TODO: Check for the errors mentioned above.
+    */
+    /*
+    * NOTE that the XSLT 2.0 also *does* use the NULL namespace if
+    *  "#default" is used and there's no default namespace is scope.
+    *  I.e., this is *not* an error. 
+    *  Most XSLT 1.0 implementations work this way.
+    *  The XSLT 1.0 spec has nothing to say on the subject. 
+    */
+    /*
+    * Attribute "stylesheet-prefix".
+    */
+    stylePrefix = xmlGetNsProp(node, (const xmlChar *)"stylesheet-prefix", NULL);
+    if (stylePrefix == NULL) {
 	xsltTransformError(NULL, style, node,
+	    "The attribute 'stylesheet-prefix' is missing.\n");
+	return;
+    }
+    if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default"))
+	literalNs = xmlSearchNs(node->doc, node, NULL);	
+    else {
+	literalNs = xmlSearchNs(node->doc, node, stylePrefix);
+	if (literalNs == NULL) {
+	    xsltTransformError(NULL, style, node,
+	        "Attribute 'stylesheet-prefix': There's no namespace "
+		"declaration in scope for the prefix '%s'.\n",
+		    stylePrefix);
+	    goto error;
+	}
+    }
+    /*
+    * Attribute "result-prefix".
+    */
+    resultPrefix = xmlGetNsProp(node, (const xmlChar *)"result-prefix", NULL);
+    if (resultPrefix == NULL) {
+	xsltTransformError(NULL, style, node,
+	    "The attribute 'result-prefix' is missing.\n");
+	goto error;
+    }        
+    if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default"))
+	targetNs = xmlSearchNs(node->doc, node, NULL);
+    else {
+	targetNs = xmlSearchNs(node->doc, node, resultPrefix);
+
+        if (targetNs == NULL) {
+	   xsltTransformError(NULL, style, node,
+	        "Attribute 'result-prefix': There's no namespace "
+		"declaration in scope for the prefix '%s'.\n",
+		    stylePrefix);
+	    goto error;
+	}
+    }
+    /*
+     *
+     * Same alias for multiple different target namespace URIs:
+     *  TODO: The one with the highest import precedence is used.
+     *  Example:
+     *  <xsl:namespace-alias stylesheet-prefix="foo"
+     *                       result-prefix="bar"/>
+     *
+     *  <xsl:namespace-alias stylesheet-prefix="foo"
+     *                       result-prefix="zar"/>
+     *
+     * Same target namespace URI for multiple different aliases:
+     *  All alias-definitions will be used.
+     *  Example:
+     *  <xsl:namespace-alias stylesheet-prefix="bar"
+     *                       result-prefix="foo"/>
+     *
+     *  <xsl:namespace-alias stylesheet-prefix="zar"
+     *                       result-prefix="foo"/>
+     * Cases using #default:
+     *  <xsl:namespace-alias stylesheet-prefix="#default"
+     *                       result-prefix="#default"/>
+     *  TODO: Has this an effect at all?
+     *
+     *  <xsl:namespace-alias stylesheet-prefix="foo"
+     *                       result-prefix="#default"/>
+     *  From namespace to no namespace.
+     *
+     *  <xsl:namespace-alias stylesheet-prefix="#default"
+     *                       result-prefix="foo"/>
+     *  From no namespace to namespace.
+     */
+    
+	
+	/*
+	* Store the ns-node in the alias-object.
+	*/
+	alias = xsltNewNsAlias(XSLT_CCTXT(style));
+	if (alias == NULL)
+	    return;
+	alias->literalNs = literalNs;
+	alias->targetNs = targetNs;
+	XSLT_CCTXT(style)->hasNsAliases = 1;
+
+
+#else /* XSLT_REFACTORED */
+    const xmlChar *literalNsName;
+    const xmlChar *targetNsName;
+    
+
+    if ((style == NULL) || (node == NULL))
+	return;
+
+    stylePrefix = xmlGetNsProp(node, (const xmlChar *)"stylesheet-prefix", NULL);
+    if (stylePrefix == NULL) {
+	xsltTransformError(NULL, style, node,
 	    "namespace-alias: stylesheet-prefix attribute missing\n");
 	return;
     }
-    rprefix = xmlGetNsProp(node, (const xmlChar *)"result-prefix", NULL);
-    if (rprefix == NULL) {
+    resultPrefix = xmlGetNsProp(node, (const xmlChar *)"result-prefix", NULL);
+    if (resultPrefix == NULL) {
 	xsltTransformError(NULL, style, node,
 	    "namespace-alias: result-prefix attribute missing\n");
 	goto error;
     }
     
-    if (xmlStrEqual(sprefix, (const xmlChar *)"#default")) {
-        /*
-	 * Do we have a default namespace previously declared?
-	 */
-	sNs = xmlSearchNs(node->doc, node, NULL);
-	if (sNs == NULL)
-	    shref = NULL;	/* No - set NULL */
-	else
-	    shref = sNs->href;	/* Yes - set for nsAlias table */
+    if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default")) {
+	literalNs = xmlSearchNs(node->doc, node, NULL);
+	if (literalNs == NULL) {
+	    literalNsName = NULL;
+	} else
+	    literalNsName = literalNs->href; /* Yes - set for nsAlias table */
     } else {
-	sNs = xmlSearchNs(node->doc, node, sprefix);
+	literalNs = xmlSearchNs(node->doc, node, stylePrefix);
  
-	if ((sNs == NULL) || (sNs->href == NULL)) {
+	if ((literalNs == NULL) || (literalNs->href == NULL)) {
 	    xsltTransformError(NULL, style, node,
 	        "namespace-alias: prefix %s not bound to any namespace\n",
-					sprefix);
+					stylePrefix);
 	    goto error;
 	} else
-	    shref = sNs->href;
+	    literalNsName = literalNs->href;
     }
 
     /*
@@ -108,30 +251,43 @@
      * been explicitly declared the special value UNDEFINED_DEFAULT_NS is
      * put into the nsAliases table
      */
-    if (xmlStrEqual(rprefix, (const xmlChar *)"#default")) {
-	rNs = xmlSearchNs(node->doc, node, NULL);
-	if (rNs == NULL)
-	    rhref = UNDEFINED_DEFAULT_NS;
-	else
-	    rhref = rNs->href;
+    if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default")) {
+	targetNs = xmlSearchNs(node->doc, node, NULL);
+	if (targetNs == NULL) {
+	    targetNsName = UNDEFINED_DEFAULT_NS;
+	} else
+	    targetNsName = targetNs->href;
     } else {
-	rNs = xmlSearchNs(node->doc, node, rprefix);
+	targetNs = xmlSearchNs(node->doc, node, resultPrefix);
 
-        if ((rNs == NULL) || (rNs->href == NULL)) {
+        if ((targetNs == NULL) || (targetNs->href == NULL)) {
 	    xsltTransformError(NULL, style, node,
 	        "namespace-alias: prefix %s not bound to any namespace\n",
-					rprefix);
+					resultPrefix);
 	    goto error;
 	} else
-	    rhref = rNs->href;
+	    targetNsName = targetNs->href;
     }
     /*
-     * Special case if #default is used for stylesheet and no default has
-     * been explicitly declared.  We use style->defaultAlias for this
-     */
-    if (shref == NULL) {
-        if (rNs != NULL)
-            style->defaultAlias = rNs->href;
+     * Special case: if #default is used for
+     *  the stylesheet-prefix (literal namespace) and there's no default
+     *  namespace in scope, we'll use style->defaultAlias for this.
+     */   
+    if (literalNsName == NULL) {
+        if (targetNs != NULL) {
+	    /*
+	    * BUG TODO: Is it not sufficient to have only 1 field for
+	    *  this, since subsequently alias declarations will
+	    *  overwrite this.	    
+	    *  Example:
+	    *   <xsl:namespace-alias result-prefix="foo"
+	    *                        stylesheet-prefix="#default"/>
+	    *   <xsl:namespace-alias result-prefix="bar"
+	    *                        stylesheet-prefix="#default"/>
+	    *  The mapping for "foo" won't be visible anymore.
+	    */
+            style->defaultAlias = targetNs->href;
+	}
     } else {
         if (style->nsAliases == NULL)
 	    style->nsAliases = xmlHashCreate(10);
@@ -140,15 +296,16 @@
 	        "namespace-alias: cannot create hash table\n");
 	    goto error;
         }
-        xmlHashAddEntry((xmlHashTablePtr) style->nsAliases,
-	            shref, (void *) rhref);
+	xmlHashAddEntry((xmlHashTablePtr) style->nsAliases,
+	    literalNsName, (void *) targetNsName);
     }
+#endif /* else of XSLT_REFACTORED */
 
 error:
-    if (sprefix != NULL)
-	xmlFree(sprefix);
-    if (rprefix != NULL)
-	xmlFree(rprefix);
+    if (stylePrefix != NULL)
+	xmlFree(stylePrefix);
+    if (resultPrefix != NULL)
+	xmlFree(resultPrefix);
 }
 
 /**
@@ -255,27 +412,39 @@
  * and add a new namespace decalaration on the node
  * Handle namespace aliases and make sure the prefix is not NULL, this
  * is needed for attributes.
+ * Called from:
+ *   xsltAttrTemplateProcess() (templates.c)
+ *   xsltCopyProp() (transform.c)
  *
  * Returns the namespace node to use or NULL
  */
 xmlNsPtr
 xsltGetPlainNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur,
-                      xmlNsPtr ns, xmlNodePtr out) {
-    xsltStylesheetPtr style;
+                      xmlNsPtr ns, xmlNodePtr out) {    
     xmlNsPtr ret;
     const xmlChar *URI = NULL; /* the replacement URI */
 
     if ((ctxt == NULL) || (cur == NULL) || (out == NULL) || (ns == NULL))
 	return(NULL);
 
-    style = ctxt->style;
-    while (style != NULL) {
-	if (style->nsAliases != NULL)
-	    URI = (const xmlChar *) xmlHashLookup(style->nsAliases, ns->href);
-	if (URI != NULL)
-	    break;
-
-	style = xsltNextImport(style);
+#ifdef XSLT_REFACTORED
+    /*
+    * Namespace exclusion and ns-aliasing is performed at
+    * compilation-time in the refactored code.
+    */
+    URI = ns->href;
+#else
+    {
+	xsltStylesheetPtr style;
+	style = ctxt->style;
+	while (style != NULL) {
+	    if (style->nsAliases != NULL)
+		URI = (const xmlChar *) xmlHashLookup(style->nsAliases, ns->href);
+	    if (URI != NULL)
+		break;
+	    
+	    style = xsltNextImport(style);
+	}
     }
 
     if (URI == UNDEFINED_DEFAULT_NS) {
@@ -289,6 +458,7 @@
 
     if (URI == NULL)
 	URI = ns->href;
+#endif
 
     if ((out->parent != NULL) &&
 	(out->parent->type == XML_ELEMENT_NODE) &&
@@ -339,10 +509,34 @@
 	return(NULL);
 
     if ((prefix == NULL) && (URI[0] == 0)) {
+	/*
+	* This tries to "undeclare" a default namespace.
+	* This fixes a part of bug #302020:
+	*  1) Added a check whether the queried ns-decl
+	*     is already an "undeclaration" of the default
+	*     namespace.
+	*  2) This fires an error if the default namespace
+	*     couldn't be "undeclared".	
+	*/
 	ret = xmlSearchNs(out->doc, out, NULL);
+	if ((ret == NULL) ||
+	    (ret->href == NULL) || (ret->href[0] == 0))
+	    return(ret);
+
 	if (ret != NULL) {
-	    ret = xmlNewNs(out, URI, prefix);
-	    return(ret);
+	    xmlNsPtr newns;
+
+	    newns = xmlNewNs(out, URI, prefix);
+	    if (newns == NULL) {
+		xsltTransformError(ctxt, NULL, cur,
+		    "Namespace fixup error: Failed to undeclare "
+		    "the default namespace '%s'.\n",
+		    ret->href);
+	    }
+	    /*
+	    * TODO: Why does this try to return an xmlns="" at all?
+	    */
+	    return(newns);
 	}
 	return(NULL);
     }
@@ -351,8 +545,9 @@
 	(out->parent->type == XML_ELEMENT_NODE) &&
 	(out->parent->ns != NULL) &&
 	(xmlStrEqual(out->parent->ns->href, URI)))
+    {
 	ret = out->parent->ns;
-    else 
+    } else 
 	ret = xmlSearchNsByHref(out->doc, out, URI);
 
     if ((ret == NULL) || (ret->prefix == NULL)) {
@@ -381,6 +576,9 @@
  * @ns:  the namespace
  * @out:  the output node (or its parent)
  *
+ * REFACTORED NOTE: Won't be used anymore in the refactored code
+ *  for literal result elements/attributes.
+ *
  * Find the right namespace value for this prefix, if needed create
  * and add a new namespace decalaration on the node
  * Handle namespace aliases
@@ -389,27 +587,38 @@
  */
 xmlNsPtr
 xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns,
-	         xmlNodePtr out) {
-    xsltStylesheetPtr style;
+	         xmlNodePtr out) {    
     xmlNsPtr ret;
     const xmlChar *URI = NULL; /* the replacement URI */
 
     if ((ctxt == NULL) || (cur == NULL) || (out == NULL) || (ns == NULL))
 	return(NULL);
-
-    style = ctxt->style;
-    while (style != NULL) {
-	if (style->nsAliases != NULL)
-	    URI = (const xmlChar *) 
+    
+#ifdef XSLT_REFACTORED
+    /*
+    * Namespace exclusion and ns-aliasing is performed at
+    * compilation-time in the refactored code.    
+    */
+    URI = ns->href;
+#else
+    {
+	xsltStylesheetPtr style;
+	style = ctxt->style;
+	while (style != NULL) {
+	    if (style->nsAliases != NULL)
+		URI = (const xmlChar *) 
 		xmlHashLookup(style->nsAliases, ns->href);
-	if (URI != NULL)
-	    break;
-
-	style = xsltNextImport(style);
+	    if (URI != NULL)
+		break;
+	    
+	    style = xsltNextImport(style);
+	}
     }
 
     if (URI == UNDEFINED_DEFAULT_NS) {
         xmlNsPtr dflt;
+	/*
+	*/
 	dflt = xmlSearchNs(cur->doc, cur, NULL);
 	if (dflt != NULL)
 	    URI = dflt->href;
@@ -417,7 +626,7 @@
 	    return NULL;
     } else if (URI == NULL)
 	URI = ns->href;
-
+#endif
     /*
      * If the parent is an XML_ELEMENT_NODE, and has the "equivalent"
      * namespace as ns (either both default, or both with a prefix
@@ -468,7 +677,14 @@
  *
  * Do a copy of an namespace list. If @node is non-NULL the
  * new namespaces are added automatically. This handles namespaces
- * aliases
+ * aliases.
+ * This function is intended only for *internal* use at
+ * transformation-time. Use it *only* for copying ns-decls of
+ * literal result elements.
+ * 
+ * Called by:
+ *   xsltCopyTree() (transform.c)
+ *   xsltCopyNode() (transform.c)
  *
  * Returns: a new xmlNsPtr, or NULL in case of error.
  */
@@ -476,8 +692,7 @@
 xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node,
 	              xmlNsPtr cur) {
     xmlNsPtr ret = NULL, tmp;
-    xmlNsPtr p = NULL,q;
-    const xmlChar *URI;
+    xmlNsPtr p = NULL,q;    
 
     if (cur == NULL)
 	return(NULL);
@@ -495,12 +710,13 @@
 	    break;
 
 	/*
-	 * Avoid duplicating namespace declrations on the tree
+	 * Avoid duplicating namespace declarations in the tree if
+	 * a matching declaration is in scope.
 	 */
 	if (node != NULL) {
 	    if ((node->ns != NULL) &&
-        	(xmlStrEqual(node->ns->href, cur->href)) &&
-        	(xmlStrEqual(node->ns->prefix, cur->prefix))) {
+		(xmlStrEqual(node->ns->prefix, cur->prefix)) &&
+        	(xmlStrEqual(node->ns->href, cur->href))) {
 		cur = cur->next;
 		continue;
 	    }
@@ -510,8 +726,21 @@
 		continue;
 	    }
 	}
-	
+#ifdef XSLT_REFACTORED
+	/*
+	* Namespace exclusion and ns-aliasing is performed at
+	* compilation-time in the refactored code.
+	*/
+	q = xmlNewNs(node, cur->href, cur->prefix);
+	if (p == NULL) {
+	    ret = p = q;
+	} else {
+	    p->next = q;
+	    p = q;
+	}
+#else
 	if (!xmlStrEqual(cur->href, XSLT_NAMESPACE)) {
+	    const xmlChar *URI;
 	    /* TODO apply cascading */
 	    URI = (const xmlChar *) xmlHashLookup(ctxt->style->nsAliases,
 		                                  cur->href);
@@ -529,6 +758,7 @@
 		p = q;
 	    }
 	}
+#endif
 	cur = cur->next;
     }
     return(ret);
@@ -550,8 +780,7 @@
 xsltCopyNamespace(xsltTransformContextPtr ctxt, xmlNodePtr node,
 	          xmlNsPtr cur) {
     xmlNsPtr ret = NULL;
-    const xmlChar *URI;
-
+    
     if (cur == NULL)
 	return(NULL);
     if (cur->type != XML_NAMESPACE_DECL)
@@ -563,7 +792,16 @@
     if ((node != NULL) && (node->type != XML_ELEMENT_NODE))
 	node = NULL;
 
+#ifdef XSLT_REFACTORED
+    /*
+    * Namespace exclusion and ns-aliasing is performed at
+    * compilation-time in the refactored code.
+    */
+    ret = xmlNewNs(node, cur->href, cur->prefix);	
+#else
     if (!xmlStrEqual(cur->href, XSLT_NAMESPACE)) {
+	const xmlChar *URI;
+
 	URI = (const xmlChar *) xmlHashLookup(ctxt->style->nsAliases,
 					      cur->href);
 	if (URI == UNDEFINED_DEFAULT_NS)
@@ -574,6 +812,7 @@
 	    ret = xmlNewNs(node, cur->href, cur->prefix);
 	}
     }
+#endif
     return(ret);
 }
 

Modified: packages/libxslt/branches/upstream/current/libxslt/pattern.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/pattern.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/pattern.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -466,11 +466,7 @@
     int isRVT;
 
     doc = node->doc;
-    if ((doc != NULL) &&
-	(doc->name != NULL) &&
-	(doc->name[0] == ' ') &&
-	(xmlStrEqual(BAD_CAST doc->name,
-		     BAD_CAST " fake node libxslt")))
+    if (XSLT_IS_RES_TREE_FRAG(doc))
 	isRVT = 1;
     else
 	isRVT = 0;
@@ -825,11 +821,7 @@
 		}
 
 		doc = node->doc;
-		if ((doc != NULL) &&
-		    (doc->name != NULL) &&
-		    (doc->name[0] == ' ') &&
-		    (xmlStrEqual(BAD_CAST doc->name,
-		    		 BAD_CAST " fake node libxslt")))
+		if (XSLT_IS_RES_TREE_FRAG(doc))
 		    isRVT = 1;
 		else
 		    isRVT = 0;
@@ -1424,7 +1416,7 @@
 	    return;
 	}
 	NEXT;
-	/* TODO: support namespace in keys */
+	/* URGENT TODO: support namespace in keys */
 	PUSH(XSLT_OP_KEY, lit, lit2, novar);
     } else if (xmlStrEqual(name, (const xmlChar *)"processing-instruction")) {
 	NEXT;
@@ -2217,6 +2209,71 @@
     return(0);
 }
 
+#ifdef XSLT_REFACTORED_KEYCOMP
+static int
+xsltComputeAllKeys(xsltTransformContextPtr ctxt,
+		xsltDocumentPtr document)
+{
+    xsltStylesheetPtr style, style2;
+    xsltKeyDefPtr keyd, keyd2;
+    xsltKeyTablePtr table;
+
+    if ((ctxt == NULL) || (document == NULL))
+	return(-1);
+ 
+    if (document->nbKeysComputed == ctxt->nbKeys)
+	return(0);
+    /*
+    * TODO: This could be further optimized
+    */
+    style = ctxt->style;
+    while (style) {
+	keyd = (xsltKeyDefPtr) style->keys;
+	while (keyd != NULL) {	    
+	    /*
+	    * Check if keys with this QName have been already
+	    * computed.
+	    */
+	    table = (xsltKeyTablePtr) document->keys;
+	    while (table) {
+		if (((keyd->nameURI != NULL) == (table->nameURI != NULL)) &&
+		    xmlStrEqual(keyd->name, table->name) &&
+		    xmlStrEqual(keyd->nameURI, table->nameURI))
+		{
+		    break;
+		}		
+		table = table->next;
+	    }
+	    if (table == NULL) {
+		/*
+		* Keys with this QName have not been yet computed.
+		*/
+		style2 = ctxt->style;
+		while (style2 != NULL) {
+		    keyd2 = (xsltKeyDefPtr) style2->keys;
+		    while (keyd2 != NULL) {
+			if (((keyd2->nameURI != NULL) ==
+			     (keyd->nameURI != NULL)) &&
+			    xmlStrEqual(keyd2->name, keyd->name) &&
+			    xmlStrEqual(keyd2->nameURI, keyd->nameURI))
+			{
+			    xsltInitCtxtKey(ctxt, document, keyd2);
+			    if (document->nbKeysComputed == ctxt->nbKeys)
+				return(0);
+			}
+			keyd2 = keyd2->next;		
+		    }	    
+		    style2 = xsltNextImport(style2);
+		}
+	    }	    
+	    keyd = keyd->next;
+	}
+	style = xsltNextImport(style);
+    }
+    return(0);
+}
+#endif
+
 /**
  * xsltGetTemplate:
  * @ctxt:  a XSLT process context
@@ -2403,6 +2460,9 @@
 	    }
 	}
 
+#ifdef XSLT_REFACTORED_KEYCOMP
+keyed_match:
+#endif
 	if (keyed) {
 	    list = curstyle->keyMatch;
 	    while ((list != NULL) &&
@@ -2416,6 +2476,41 @@
 		list = list->next;
 	    }
 	}
+#ifdef XSLT_REFACTORED_KEYCOMP	
+	else if (ctxt->hasTemplKeyPatterns &&
+	    (ctxt->document->nbKeysComputed < ctxt->nbKeys))
+	{
+	    /*
+	    * Compute all remaining keys for this document.
+	    *
+	    * REVISIT TODO: I think this could be further optimized.	    
+	    */
+	    xsltComputeAllKeys(ctxt, ctxt->document);
+
+	    switch (node->type) {
+		case XML_ELEMENT_NODE:		    
+		    if (node->psvi != NULL) keyed = 1;
+		    break;
+		case XML_ATTRIBUTE_NODE:
+		    if (((xmlAttrPtr) node)->psvi != NULL) keyed = 1;
+		    break;
+		case XML_TEXT_NODE:
+		case XML_CDATA_SECTION_NODE:
+		case XML_COMMENT_NODE:
+		case XML_PI_NODE:		
+		    if (node->psvi != NULL) keyed = 1;
+		    break;
+		case XML_DOCUMENT_NODE:
+		case XML_HTML_DOCUMENT_NODE:
+		    if (((xmlDocPtr) node)->psvi != NULL) keyed = 1;
+		    break;		
+		default:
+		    break;
+	    }
+	    if (keyed)
+		goto keyed_match;
+	}
+#endif /* XSLT_REFACTORED_KEYCOMP */
 	if (ret != NULL)
 	    return(ret);
 

Modified: packages/libxslt/branches/upstream/current/libxslt/preproc.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/preproc.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/preproc.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -52,6 +52,11 @@
  *									*
  ************************************************************************/
 
+#ifdef XSLT_REFACTORED
+    /*
+    * Grammar checks are now performed in xslt.c.
+    */
+#else
 /**
  * xsltCheckTopLevelElement:
  * @style: the XSLT stylesheet
@@ -197,6 +202,7 @@
 		       inst->name);
     style->errors++;
 }
+#endif
 
 /************************************************************************
  *									*
@@ -350,7 +356,6 @@
 	case XSLT_FUNC_PARAM:	    
 	case XSLT_FUNC_VARIABLE:	    
 	case XSLT_FUNC_WHEN:
-	case XSLT_FUNC_OTHERWISE:
 	    break;
 	default:
 	if (cur->func == NULL) {
@@ -380,6 +385,8 @@
     * URGENT TODO: Implement destructors.
     */
     switch (comp->type) {
+	case XSLT_FUNC_LITERAL_RESULT_ELEMENT:
+	    break;
 	case XSLT_FUNC_COPY:
             break;
         case XSLT_FUNC_SORT: {
@@ -468,7 +475,12 @@
 		    xmlXPathFreeCompExpr(item->comp);
 	    }
 	    break;
-	case XSLT_FUNC_OTHERWISE:
+	case XSLT_FUNC_OTHERWISE:	    
+	case XSLT_FUNC_FALLBACK:
+	case XSLT_FUNC_MESSAGE:
+	case XSLT_FUNC_INCLUDE:
+	case XSLT_FUNC_ATTRSET:
+	
 	    break;
 	default:
 	    /* TODO: Raise error. */
@@ -518,7 +530,8 @@
     * "output" in XSLT_SAXON_NAMESPACE
     * "write" XSLT_XALAN_NAMESPACE
     * "document" XSLT_XT_NAMESPACE
-    * "document" XSLT_NAMESPACE
+    * "document" XSLT_NAMESPACE (from the abandoned old working
+    *                            draft of XSLT 1.1)
     * (in libexslt/common.c)
     * "document" in EXSLT_COMMON_NAMESPACE
     */
@@ -544,6 +557,8 @@
 	*   (http://icl.com/saxon)
 	* The @file is in no namespace; it is an AVT.
 	*   (http://www.computerwizards.com/saxon/doc/extensions.html#saxon:output)
+	*
+	* TODO: Do we need not to check the namespace here?
 	*/
 	filename = xsltEvalStaticAttrValueTemplate(style, inst,
 			 (const xmlChar *)"file",
@@ -557,6 +572,10 @@
 	/*
 	* TODO: Is "filename need to be interpreted" meant to be a todo?
 	*   Where will be the filename of xalan:write be processed?
+	*
+	* TODO: Do we need not to check the namespace here?
+	*   The extension ns is "http://xml.apache.org/xalan/redirect".
+	*   See http://xml.apache.org/xalan-j/extensionslib.html.
 	*/
     } else if (xmlStrEqual(inst->name, (const xmlChar *) "document")) {
 	if (inst->ns != NULL) {
@@ -770,11 +789,17 @@
 	comp->has_use = 1;
 }
 
+#ifdef XSLT_REFACTORED
+    /* Enable if ever needed for xsl:text. */
+#else
 /**
  * xsltTextComp:
  * @style: an XSLT compiled stylesheet
  * @inst:  the xslt text node
  *
+ * TODO: This function is obsolete, since xsl:text won't
+ *  be compiled, but removed from the tree.
+ *
  * Process the xslt text node on the source node
  */
 static void
@@ -807,13 +832,14 @@
 	if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
 	    comp->noescape = 1;
 	} else if (!xmlStrEqual(prop,
-				(const xmlChar *)"no")){
+	    (const xmlChar *)"no")){
 	    xsltTransformError(NULL, style, inst,
-"xsl:text: disable-output-escaping allows only yes or no\n");
+		"xsl:text: disable-output-escaping allows only yes or no\n");
 	    if (style != NULL) style->warnings++;
 	}
     }
 }
+#endif /* else of XSLT_REFACTORED */
 
 /**
  * xsltElementComp:
@@ -1774,85 +1800,6 @@
     }
 }
 
-#ifdef XSLT_REFACTORED
-
-/*
-* xsltCompilerGetInScopeNSInfo:
-*
-* Create and store the list of in-scope namespaces for the given
-* node in the stylesheet. If there are no changes in the in-scope
-* namespaces then the last ns-info of the ancestor axis will be returned.
-* Compilation-time only.
-*
-* Returns the ns-info or NULL if there are no namespaces in scope.
-*/
-xsltNsListPtr
-xsltCompilerGetInScopeNSInfo(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
-{
-    xsltNsListPtr nsi = NULL;
-    xmlNsPtr *list = NULL;
-    /*
-    * Create a new ns-list for this position in the node-tree.
-    * xmlGetNsList() will return NULL, if there are no ns-decls in the
-    * tree. Note that the ns-decl for the XML namespace is not added
-    * to the resulting list; the XPath module handles the XML namespace
-    * internally.
-    */
-    list = xmlGetNsList(node->doc, node);
-    if (list == NULL)
-	return(NULL);
-    /*
-    * Initialize the list hold by the stylesheet.
-    */
-    if (cctxt->sheet->inScopeNamespaces == NULL) {
-	cctxt->sheet->inScopeNamespaces = xsltPointerListCreate();
-	if (cctxt->sheet->inScopeNamespaces == NULL) {	    
-	    xsltTransformError(NULL, cctxt->sheet, NULL,
-		"xsltCompilerGetInScopeNSInfo: malloc failed.\n");	    
-	    goto internal_err;	    
-	}
-    }
-    /*
-    * Create the info-structure.
-    */
-    nsi = (xsltNsListPtr) xmlMalloc(sizeof(xsltNsList));
-    if (nsi == NULL) {	
-	xsltTransformError(NULL, cctxt->sheet, NULL,
-	    "xsltCompilerGetInScopeNSInfo: malloc failed.\n");
-	goto internal_err;
-    }
-    memset(nsi, 0, sizeof(xsltNsList));
-    nsi->list = list;
-    /*
-    * Eval the number of ns-decls; this is used to speed up
-    * XPath-context initialization.
-    */
-    while (list[nsi->number] != NULL)
-	nsi->number++;
-    /*
-    * Store the ns-list in the stylesheet.
-    */
-    if (xsltPointerListAdd(
-	(xsltPointerListPtr)cctxt->sheet->inScopeNamespaces,
-	(void *) nsi) == -1)
-    {	
-	xmlFree(nsi);
-	nsi = NULL;
-	xsltTransformError(NULL, cctxt->sheet, NULL,
-	    "xsltCompilerGetInScopeNSInfo: failed to add ns-info.\n");
-	goto internal_err;
-    }     
-
-    return(nsi);
-
-internal_err:
-    if (list != NULL)
-	xmlFree(list);    
-    cctxt->sheet->errors++;
-    return(NULL);
-}
-#endif /* XSLT_REFACTORED */
-
 /************************************************************************
  *									*
  *		    Generic interface					*
@@ -1870,10 +1817,11 @@
     xsltElemPreCompPtr cur, next;
 
     if (style == NULL)
-	return;
+	return;        
+    
     cur = style->preComps;
     while (cur != NULL) {
-	next = cur->next;
+	next = cur->next;		
 	if (cur->type == XSLT_FUNC_EXTENSION)
 	    cur->free(cur);
 	else
@@ -1882,9 +1830,224 @@
     }
 }
 
+#ifdef XSLT_REFACTORED
+
 /**
  * xsltStylePreCompute:
  * @style:  the XSLT stylesheet
+ * @node:  the element in the XSLT namespace
+ *
+ * Precompute an XSLT element.
+ * This expects the type of the element to be already
+ * set in style->compCtxt->inode->type;
+ */
+void
+xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
+    /*    
+    * The xsltXSLTElemMarker marker was set beforehand by
+    *  the parsing mechanism for all elements in the XSLT namespace.
+    */
+    if (style == NULL) {
+	if (node != NULL)
+	    node->psvi = NULL;
+	return;
+    }
+    if (node == NULL)
+	return;
+    if (! IS_XSLT_ELEM_FAST(node))
+	return;
+
+    node->psvi = NULL;
+    if (XSLT_CCTXT(style)->inode->type != 0) {
+	switch (XSLT_CCTXT(style)->inode->type) {
+	    case XSLT_FUNC_APPLYTEMPLATES:
+		xsltApplyTemplatesComp(style, node);
+		break;
+	    case XSLT_FUNC_WITHPARAM:			   
+		xsltWithParamComp(style, node);
+		break;
+	    case XSLT_FUNC_VALUEOF:	    
+		xsltValueOfComp(style, node);
+		break;
+	    case XSLT_FUNC_COPY:	    
+		xsltCopyComp(style, node);
+		break;
+	    case XSLT_FUNC_COPYOF:
+		xsltCopyOfComp(style, node);
+		break;
+	    case XSLT_FUNC_IF:	    
+		xsltIfComp(style, node);
+		break;
+	    case XSLT_FUNC_CHOOSE:	    
+		xsltChooseComp(style, node);
+		break;
+	    case XSLT_FUNC_WHEN:	    
+		xsltWhenComp(style, node);
+		break;
+	    case XSLT_FUNC_OTHERWISE:	    
+		/* NOP yet */
+		return;
+	    case XSLT_FUNC_FOREACH:	    
+		xsltForEachComp(style, node);
+		break;
+	    case XSLT_FUNC_APPLYIMPORTS:	    
+		xsltApplyImportsComp(style, node);
+		break;
+	    case XSLT_FUNC_ATTRIBUTE:	    
+		xsltAttributeComp(style, node);
+		break;
+	    case XSLT_FUNC_ELEMENT:	    
+		xsltElementComp(style, node);
+		break;
+	    case XSLT_FUNC_SORT:	    
+		xsltSortComp(style, node);
+		break;
+	    case XSLT_FUNC_COMMENT:	    
+		xsltCommentComp(style, node);
+		break;
+	    case XSLT_FUNC_NUMBER:	    
+		xsltNumberComp(style, node);
+		break;
+	    case XSLT_FUNC_PI:	    
+		xsltProcessingInstructionComp(style, node);
+		break;
+	    case XSLT_FUNC_CALLTEMPLATE:	    
+		xsltCallTemplateComp(style, node);
+		break;
+	    case XSLT_FUNC_PARAM:	    
+		xsltParamComp(style, node);
+		break;
+	    case XSLT_FUNC_VARIABLE:	    
+		xsltVariableComp(style, node);
+		break;
+	    case XSLT_FUNC_FALLBACK:	    
+		/* NOP yet */
+		return;
+	    case XSLT_FUNC_DOCUMENT:	    
+		/* The extra one */
+		node->psvi = (void *) xsltDocumentComp(style, node,
+		    (xsltTransformFunction) xsltDocumentElem);
+		break;
+	    case XSLT_FUNC_MESSAGE:
+		/* NOP yet */
+		return;
+	    default:
+		/*
+		* NOTE that xsl:text, xsl:template, xsl:stylesheet,
+		*  xsl:transform, xsl:import, xsl:include are not expected
+		*  to be handed over to this function.
+		*/
+		xsltTransformError(NULL, style, node,
+		    "Internal error: (xsltStylePreCompute) cannot handle "
+		    "the XSLT element '%s'.\n", node->name);
+		style->errors++;
+		return;
+	}
+    } else {
+	/*
+	* Fallback to string comparison.
+	*/	
+	if (IS_XSLT_NAME(node, "apply-templates")) {
+	    xsltApplyTemplatesComp(style, node);
+	} else if (IS_XSLT_NAME(node, "with-param")) {
+	    xsltWithParamComp(style, node);
+	} else if (IS_XSLT_NAME(node, "value-of")) {
+	    xsltValueOfComp(style, node);
+	} else if (IS_XSLT_NAME(node, "copy")) {
+	    xsltCopyComp(style, node);
+	} else if (IS_XSLT_NAME(node, "copy-of")) {
+	    xsltCopyOfComp(style, node);
+	} else if (IS_XSLT_NAME(node, "if")) {
+	    xsltIfComp(style, node);
+	} else if (IS_XSLT_NAME(node, "choose")) {
+	    xsltChooseComp(style, node);
+	} else if (IS_XSLT_NAME(node, "when")) {
+	    xsltWhenComp(style, node);	
+	} else if (IS_XSLT_NAME(node, "otherwise")) {
+	    /* NOP yet */
+	    return;
+	} else if (IS_XSLT_NAME(node, "for-each")) {
+	    xsltForEachComp(style, node);
+	} else if (IS_XSLT_NAME(node, "apply-imports")) {
+	    xsltApplyImportsComp(style, node);
+	} else if (IS_XSLT_NAME(node, "attribute")) {
+	    xsltAttributeComp(style, node);
+	} else if (IS_XSLT_NAME(node, "element")) {
+	    xsltElementComp(style, node);
+	} else if (IS_XSLT_NAME(node, "sort")) {
+	    xsltSortComp(style, node);
+	} else if (IS_XSLT_NAME(node, "comment")) {
+	    xsltCommentComp(style, node);
+	} else if (IS_XSLT_NAME(node, "number")) {
+	    xsltNumberComp(style, node);
+	} else if (IS_XSLT_NAME(node, "processing-instruction")) {
+	    xsltProcessingInstructionComp(style, node);
+	} else if (IS_XSLT_NAME(node, "call-template")) {
+	    xsltCallTemplateComp(style, node);
+	} else if (IS_XSLT_NAME(node, "param")) {
+	    xsltParamComp(style, node);
+	} else if (IS_XSLT_NAME(node, "variable")) {
+	    xsltVariableComp(style, node);
+	} else if (IS_XSLT_NAME(node, "fallback")) {
+	    /* NOP yet */
+	    return;
+	} else if (IS_XSLT_NAME(node, "document")) {
+	    /* The extra one */
+	    node->psvi = (void *) xsltDocumentComp(style, node,
+		(xsltTransformFunction) xsltDocumentElem);	
+	} else if (IS_XSLT_NAME(node, "output")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "preserve-space")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "strip-space")) {
+	    /* Top-level */
+	    return;	
+	} else if (IS_XSLT_NAME(node, "key")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "message")) {
+	    return;
+	} else if (IS_XSLT_NAME(node, "attribute-set")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "namespace-alias")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "decimal-format")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "include")) {
+	    /* Top-level */	    	    
+	} else {
+	    /*
+	    * NOTE that xsl:text, xsl:template, xsl:stylesheet,
+	    *  xsl:transform, xsl:import, xsl:include are not expected
+	    *  to be handed over to this function.
+	    */
+	    xsltTransformError(NULL, style, node,
+		"Internal error: (xsltStylePreCompute) cannot handle "
+		"the XSLT element '%s'.\n", node->name);
+		style->errors++;
+	    return;
+	}	
+    }
+    /*
+    * Assign the current list of in-scope namespaces to the
+    * item. This is needed for XPath expressions.
+    */
+    if (node->psvi != NULL) {
+	((xsltStylePreCompPtr) node->psvi)->inScopeNs =
+	    XSLT_CCTXT(style)->inode->inScopeNs;
+    }
+}
+
+#else
+
+/**
+ * xsltStylePreCompute:
+ * @style:  the XSLT stylesheet
  * @inst:  the instruction in the stylesheet
  *
  * Precompute an XSLT stylesheet element
@@ -1895,10 +2058,14 @@
     * URGENT TODO: Normally inst->psvi Should never be reserved here,
     *   BUT: since if we include the same stylesheet from
     *   multiple imports, then the stylesheet will be parsed
-    *   again. We simply must not try to compute the stylesheet again.    
+    *   again. We simply must not try to compute the stylesheet again.
+    * TODO: Get to the point where we don't need to query the
+    *   namespace- and local-name of the node, but can evaluate this
+    *   using cctxt->style->inode->category;
     */
-    if (inst->psvi != NULL) 
-        return;
+    if (inst->psvi != NULL)
+	return;
+
     if (IS_XSLT_ELEM(inst)) {
 	xsltStylePreCompPtr cur;
 
@@ -1965,7 +2132,7 @@
 	} else if (IS_XSLT_NAME(inst, "call-template")) {
 	    xsltCheckInstructionElement(style, inst);
 	    xsltCallTemplateComp(style, inst);
-	} else if (IS_XSLT_NAME(inst, "param")) {
+	} else if (IS_XSLT_NAME(inst, "param")) {	   
 	    if (xsltCheckTopLevelElement(style, inst, 0) == 0)
 	        xsltCheckInstructionElement(style, inst);
 	    xsltParamComp(style, inst);
@@ -2034,19 +2201,8 @@
 	    if (style != NULL) style->warnings++;
 	}
 	
-	
 	cur = (xsltStylePreCompPtr) inst->psvi;
-
-#ifdef XSLT_REFACTORED
 	/*
-	* Assign the current list of in-scope namespaces to the
-	* item. This is needed for XPath expressions.
-	*/
-	if (cur != NULL) {
-	    cur->inScopeNS = XSLT_CCTXT(style)->inode->inScopeNS;	    	    
-	}
-#else
-	/*
 	* A ns-list is build for every XSLT item in the
 	* node-tree. This is needed for XPath expressions.
 	*/
@@ -2060,7 +2216,6 @@
 	    }
 	    cur->nsNr = i;
 	}
-#endif
     } else {
 	inst->psvi =
 	    (void *) xsltPreComputeExtModuleElement(style, inst);
@@ -2073,3 +2228,4 @@
 	    inst->psvi = (void *) xsltExtMarker;
     }
 }
+#endif /* XSLT_REFACTORED */

Modified: packages/libxslt/branches/upstream/current/libxslt/templates.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/templates.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/templates.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -202,6 +202,12 @@
     if (parent->children == NULL)
 	return(NULL);
 
+    /*
+    * This creates a temporary element-node to add the resulting
+    * text content to.
+    * OPTIMIZE TODO: Keep such an element-node in the transformation
+    *  context to avoid creating it every time.
+    */
     insert = xmlNewDocNode(ctxt->output, NULL,
 	                   (const xmlChar *)"fake", NULL);
     if (insert == NULL) {
@@ -211,7 +217,7 @@
     }
     oldInsert = ctxt->insert;
     ctxt->insert = insert;
-
+    /* OPTIMIZE TODO: if parent->children consists only of text-nodes. */
     xsltApplyOneTemplate(ctxt, node, parent->children, NULL, NULL);
 
     ctxt->insert = oldInsert;

Modified: packages/libxslt/branches/upstream/current/libxslt/transform.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/transform.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/transform.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -366,8 +366,7 @@
     if (cur->templTab == NULL) {
 	xsltTransformError(NULL, NULL, (xmlNodePtr) doc,
 		"xsltNewTransformContext: out of memory\n");
-	xmlFree(cur);
-	return(NULL);
+	goto internal_err;
     }
     cur->templNr = 0;
     cur->templMax = 5;
@@ -381,9 +380,7 @@
     if (cur->varsTab == NULL) {
         xmlGenericError(xmlGenericErrorContext,
 		"xsltNewTransformContext: out of memory\n");
-	xmlFree(cur->templTab);
-	xmlFree(cur);
-	return(NULL);
+	goto internal_err;
     }
     cur->varsNr = 0;
     cur->varsMax = 5;
@@ -404,15 +401,16 @@
     if (cur->xpathCtxt == NULL) {
 	xsltTransformError(NULL, NULL, (xmlNodePtr) doc,
 		"xsltNewTransformContext : xmlXPathNewContext failed\n");
-	xmlFree(cur->templTab);
-	xmlFree(cur->varsTab);
-	xmlFree(cur);
-	return(NULL);
+	goto internal_err;
     }
     cur->xpathCtxt->proximityPosition = 0;
     cur->xpathCtxt->contextSize = 0;
-
     /*
+    * Create an XPath cache.
+    */
+    if (xmlXPathContextSetCache(cur->xpathCtxt, 1, -1, 0) == -1)
+	goto internal_err;
+    /*
      * Initialize the extras array
      */
     if (style->extrasNr != 0) {
@@ -422,11 +420,7 @@
 	if (cur->extras == NULL) {
 	    xmlGenericError(xmlGenericErrorContext,
 		    "xsltNewTransformContext: out of memory\n");
-	    xmlFree(cur->xpathCtxt);
-	    xmlFree(cur->varsTab);
-	    xmlFree(cur->templTab);
-	    xmlFree(cur);
-	    return(NULL);
+	    goto internal_err;
 	}
 	cur->extrasNr = style->extrasNr;
 	for (i = 0;i < cur->extrasMax;i++) {
@@ -462,10 +456,7 @@
     if (docu == NULL) {
 	xsltTransformError(cur, NULL, (xmlNodePtr)doc,
 		"xsltNewTransformContext : xsltNewDocument failed\n");
-	xmlFree(cur->templTab);
-	xmlFree(cur->varsTab);
-	xmlFree(cur);
-	return(NULL);
+	goto internal_err;
     }
     docu->main = 1;
     cur->document = docu;
@@ -477,6 +468,11 @@
     cur->xinclude = xsltGetXIncludeDefault();
 
     return(cur);
+
+internal_err:
+    if (cur != NULL)
+	xsltFreeTransformContext(cur);
+    return(NULL);
 }
 
 /**
@@ -709,31 +705,48 @@
 	 ((target->ns != NULL) &&
 	  (xmlHashLookup2(ctxt->style->cdataSection,
 	                  target->name, target->ns->href) != NULL)))) {
+	/* 
+	* OPTIMIZE TODO: xsltCopyText() is also used for attribute content.	
+	*/
 	/*
-	 * nodes which must be output as CDATA due to the stylesheet
-	 */
+	* TODO: Since this doesn't merge adjacent CDATA-section nodes,
+	* we'll get: <![CDATA[x]]><!CDATA[y]]>.
+	*/
 	copy = xmlNewCDataBlock(ctxt->output, cur->content,
 				xmlStrlen(cur->content));
 	ctxt->lasttext = NULL;
-    } else if ((target != NULL) && (target->last != NULL) &&
-	    (target->last->type == XML_TEXT_NODE) &&
-	    (target->last->name == xmlStringText) &&
-	    (cur->name != xmlStringTextNoenc)) {
+    } else if ((target != NULL) &&
+	(target->last != NULL) &&
+	/* both escaped or both non-escaped text-nodes */
+	(((target->last->type == XML_TEXT_NODE) &&
+	(target->last->name == cur->name)) ||
+        /* non-escaped text nodes and CDATA-section nodes */
+	(((target->last->type == XML_CDATA_SECTION_NODE) &&
+	(cur->name == xmlStringTextNoenc)))))
+    {
 	/*
 	 * we are appending to an existing text node
 	 */
 	return(xsltAddTextString(ctxt, target->last, cur->content,
-	                         xmlStrlen(cur->content)));
-    } else if ((interned) && (target != NULL) && (target->doc != NULL) &&
-               (target->doc->dict == ctxt->dict)) {
+	    xmlStrlen(cur->content)));
+    } else if ((interned) && (target != NULL) &&
+	(target->doc != NULL) &&
+	(target->doc->dict == ctxt->dict))
+    {        
+	/*
+	* TODO: DO we want to use this also for "text" output?
+	*/
         copy = xmlNewTextLen(NULL, 0);
 	if (copy == NULL)
-	    return NULL;
+	    return NULL;	
 	if (cur->name == xmlStringTextNoenc)
 	    copy->name = xmlStringTextNoenc;
-	/*
-	 * Must confirm that content is in dict
-	 * (bug 302821)
+	
+	/* OPTIMIZE TODO: get rid of xmlDictOwns() in safe cases;
+	 *  e.g. attribute values don't need the lookup.
+	 *
+	 * Must confirm that content is in dict (bug 302821)
+	 * TODO: Check if bug 302821 still applies here.
 	 */
 	if (xmlDictOwns(ctxt->dict, cur->content))
 	    copy->content = cur->content;
@@ -761,6 +774,11 @@
     if (copy != NULL) {
 	if (target != NULL) {
 	    copy->doc = target->doc;
+	    /*
+	    * MAYBE TODO: Maybe we should reset the ctxt->lasttext here
+	    *  to ensure that the optimized text-merging mechanism
+	    *  won't interfere with normal node-merging in any case.
+	    */
 	    xmlAddChild(target, copy);
 	}
     } else {
@@ -773,35 +791,190 @@
 /**
  * xsltCopyProp:
  * @ctxt:  a XSLT process context
- * @target:  the element where the attribute will be grafted
- * @attr:  the attribute
+ * @targetElem:  the element where the attribute will be grafted
+ * @attr: the attribute to be copied
  *
  * Do a copy of an attribute
  *
  * Returns: a new xmlAttrPtr, or NULL in case of error.
  */
 static xmlAttrPtr
-xsltCopyProp(xsltTransformContextPtr ctxt, xmlNodePtr target,
-	     xmlAttrPtr attr) {
-    xmlAttrPtr ret = NULL;
-    xmlNsPtr ns;
-    xmlChar *val;
+xsltCopyProp(xsltTransformContextPtr ctxt, xmlNodePtr targetElem,
+	     xmlAttrPtr attr)
+{
+    xmlAttrPtr attrCopy;
+    xmlChar *value;
+#ifdef XSLT_REFACTORED 
+    xmlNodePtr txtNode;
+#endif
 
     if (attr == NULL)
 	return(NULL);
-    if (target->type != XML_ELEMENT_NODE)
+
+    if (targetElem->type != XML_ELEMENT_NODE) {
+	/*
+	* TODO: Hmm, it would be better to have the node at hand of the
+	*  instruction which lead to this here.
+	*/
+	xsltTransformError(ctxt, NULL, NULL,
+	    "Result tree construction error: cannot set an attribute node "
+	    "on a non-element node.\n");
 	return(NULL);
+    }    
 
+#ifdef XSLT_REFACTORED
+    /*
+    * Create the attribute node.
+    */
     if (attr->ns != NULL) {
-	ns = xsltGetPlainNamespace(ctxt, attr->parent, attr->ns, target);
+	xmlNsPtr ns = NULL;
+	const xmlChar *prefix = attr->ns->prefix;
+	
+	/*
+	* Process namespace semantics
+	*
+	* RESTRUCTURE TODO: This is the same code as in
+	*  xsltAttributeInternal() (attributes.c), but I currently
+	*  don't want to add yet another ns-lookup function.
+	*/
+	if ((targetElem->ns != NULL) &&
+	    (targetElem->ns->prefix != NULL) &&
+	    xmlStrEqual(targetElem->ns->href, attr->ns->href))
+	{
+	    ns = targetElem->ns;
+	    goto namespace_finished;
+	}
+	if (prefix != NULL) {
+	    /*
+	    * Search by ns-prefix.
+	    */
+	    ns = xmlSearchNs(targetElem->doc, targetElem, prefix);
+	    if ((ns != NULL) &&
+		(xmlStrEqual(ns->href, attr->ns->href)))
+	    {
+		goto namespace_finished;
+	    }
+	}
+	/*
+	* Fallback to a search by ns-name.
+	*/	
+	ns = xmlSearchNsByHref(targetElem->doc, targetElem, attr->ns->href);
+	if ((ns != NULL) && (ns->prefix != NULL)) {
+	    goto namespace_finished;
+	}
+	/*
+	* OK, we need to declare the namespace on the target element.
+	*/
+	if (prefix) {
+	    if (targetElem->nsDef != NULL) {
+		ns = targetElem->nsDef;
+		do {
+		    if ((ns->prefix) && xmlStrEqual(ns->prefix, prefix)) {
+			/*
+			* The prefix aready occupied.
+			*/
+			break;
+		    }
+		    ns = ns->next;
+		} while (ns != NULL);
+		if (ns == NULL) {
+		    ns = xmlNewNs(targetElem, attr->ns->href, prefix);
+		    goto namespace_finished;
+		}
+	    }
+	}
+	/*
+	* Generate a new prefix.
+	*/
+	{
+	    const xmlChar *basepref = prefix;
+	    xmlChar pref[30];
+	    int counter = 0;
+	    
+	    if (prefix != NULL)
+		basepref = prefix;
+	    else
+		basepref = xmlStrdup(BAD_CAST "ns");
+	    
+	    do {
+		snprintf((char *) pref, 30, "%s_%d",
+		    basepref, counter++);
+		ns = xmlSearchNs(targetElem->doc,
+		    (xmlNodePtr) attr, BAD_CAST pref);
+		if (counter > 1000) {
+		    xsltTransformError(ctxt, NULL, (xmlNodePtr) attr,
+			"Namespace fixup error: Failed to compute a "
+			"new unique ns-prefix for the copied attribute "
+			"{%s}%s'.\n", attr->ns->href, attr->name);
+		    ns = NULL;
+		    break;
+		}
+	    } while (ns != NULL);
+	    if (basepref != prefix)
+		xmlFree((xmlChar *)basepref);
+	    ns = xmlNewNs(targetElem, attr->ns->href, BAD_CAST pref);
+	}
+
+namespace_finished:
+
+	if (ns == NULL) {
+	    xsltTransformError(ctxt, NULL, (xmlNodePtr) attr,
+		"Namespace fixup error: Failed to acquire an in-scope "
+		"namespace binding of the copied attribute '{%s}%s'.\n",
+		attr->ns->href, attr->name);
+	    /*
+	    * TODO: Should we just stop here?
+	    */
+	}
+	attrCopy = xmlSetNsProp(targetElem, ns, attr->name, NULL);
     } else {
-	ns = NULL;
+	attrCopy = xmlSetNsProp(targetElem, NULL, attr->name, NULL);
     }
-    val = xmlNodeListGetString(attr->doc, attr->children, 1);
-    ret = xmlSetNsProp(target, ns, attr->name, val);
-    if (val != NULL)
-	xmlFree(val);
-    return(ret);
+    if (attrCopy == NULL)	
+	return(NULL);    
+    /*
+    * NOTE: This was optimized according to bug #342695.
+    * TODO: Can this further be optimized, if source and target
+    *  share the same dict and attr->children is just 1 text node
+    *  which is in the dict? How probable is such a case?
+    */
+    value = xmlNodeListGetString(attr->doc, attr->children, 1);
+    if (value != NULL) {
+	txtNode = xmlNewDocText(targetElem->doc, NULL);
+	if (txtNode == NULL)
+	    return(NULL);
+	if ((targetElem->doc != NULL) &&
+	    (targetElem->doc->dict != NULL))
+	{
+	    txtNode->content =
+		(xmlChar *) xmlDictLookup(targetElem->doc->dict,
+		    BAD_CAST value, -1);
+	    xmlFree(value);	    
+	} else
+	    txtNode->content = value;
+	attrCopy->children = txtNode;
+    }
+    /*
+    * URGENT TODO: Do we need to create an empty text node if the value
+    *  is the empty string?
+    */    
+
+#else /* not XSLT_REFACTORED */
+
+    value = xmlNodeListGetString(attr->doc, attr->children, 1);
+    if (attr->ns != NULL) {
+	xmlNsPtr ns;
+	ns = xsltGetPlainNamespace(ctxt, attr->parent, attr->ns, targetElem);
+	attrCopy = xmlSetNsProp(targetElem, ns, attr->name, value);
+    } else {
+	attrCopy = xmlSetNsProp(targetElem, NULL, attr->name, value);
+    }
+    if (value != NULL)
+	xmlFree(value);
+
+#endif /* not XSLT_REFACTORED */
+
+    return(attrCopy);
 }
 
 /**
@@ -851,6 +1024,11 @@
  *
  * Make a copy of the element node @node
  * and insert it as last child of @insert
+ * Intended *only* for copying literal result elements and
+ * text-nodes.
+ * Called from:
+ *   xsltApplyOneTemplateInt()
+ *   xsltCopy()
  *
  * Returns a pointer to the new node, or NULL in case of error
  */
@@ -933,7 +1111,12 @@
  *
  * Do a copy of a namespace list. If @node is non-NULL the
  * new namespaces are added automatically.
+ * Called by:
+ *   xsltCopyTree()
  *
+ * TODO: What is the exact difference between this function
+ *  and xsltCopyNamespaceList() in "namespaces.c"?
+ *
  * Returns: a new xmlNsPtr, or NULL in case of error.
  */
 static xmlNsPtr
@@ -988,7 +1171,8 @@
  * Make a copy of the full tree under the element node @node
  * and insert it as last child of @insert
  * For literal result element, some of the namespaces may not be copied
- * over according to section 7.1 .
+ * over according to section 7.1.
+ * TODO: Why is this a public function?
  *
  * Returns a pointer to the new tree, or NULL in case of error
  */
@@ -1036,9 +1220,8 @@
         case XML_XINCLUDE_START:
         case XML_XINCLUDE_END:
             return(NULL);
-    }
-    if ((node->name != NULL) && (node->name[0] == ' ') &&
-	(xmlStrEqual(node->name, (const xmlChar *) " fake node libxslt"))) {
+    }    
+    if (XSLT_IS_RES_TREE_FRAG(node)) {
 	if (node->children != NULL)
 	    copy = xsltCopyTreeList(ctxt, node->children, insert, 0);
 	else
@@ -1063,7 +1246,11 @@
 	    (node->type == XML_ATTRIBUTE_NODE)) {
 	    xmlNsPtr *nsList, *cur, ns;
 	    /*
-	     * must add in any new namespaces in scope for the node
+	     * Must add any new namespaces in scope for the node.
+	     * TODO: Since we try to reuse existing in-scope ns-decls by
+	     *  using xmlSearchNsByHref(), this will eventually change
+	     *  the prefix of an original ns-binding; thus it might
+	     *  break QNames in element/attribute content.
 	     */
 	    nsList = xmlGetNsList(node->doc, node);
 	    if (nsList != NULL) {
@@ -1076,9 +1263,15 @@
 		}
 		xmlFree(nsList);
 	    }
-	    if (node->ns != NULL)
-		copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy);
-	    else if ((insert->type == XML_ELEMENT_NODE) && (insert->ns != NULL)) {
+	    if (node->ns != NULL) {
+		/*
+		* This will map  copy->ns to one of the newly created
+		* in-scope ns-decls.
+		*/
+		copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy);		
+	    } else if ((insert->type == XML_ELEMENT_NODE) &&
+		(insert->ns != NULL))
+	    {
 		xmlNsPtr defaultNs;
 
 		defaultNs = xmlSearchNs(insert->doc, insert, NULL);
@@ -1127,8 +1320,9 @@
     xmlNodePtr child;
     int ret = 0;
     
-    if ((ctxt == NULL) || (node == NULL) || (inst == NULL))
-	return(ret);
+    if ((ctxt == NULL) || (node == NULL) || (inst == NULL) ||
+	(inst->children == NULL))
+	return(0);
 
     child = inst->children;
     while (child != NULL) {
@@ -1465,8 +1659,278 @@
     }
 }
 
+#ifdef XSLT_REFACTORED
+/**
+* xsltTransLREUndeclareDefaultNs:
+* @ctxt:  the transformation context
+* @cur:  the literal result element
+* @ns:  the namespace
+* @out:  the output node (or its parent)
+*
+*
+* Find a matching (prefix and ns-name) ns-declaration
+*  for the given @ns in the result tree.
+* If none is found then a new ns-declaration will be
+*  added to @out. If, in this case, the given prefix is already
+*  in use, then a ns-declaration with a modified ns-prefix
+*  be we created.
+*
+* Returns the acquired ns-declaration
+*         or NULL in case of an API or internal error.
+*/
+static int
+xsltTransLREUndeclareResultDefaultNs(xsltTransformContextPtr ctxt,
+				     xmlNodePtr cur,
+				     xmlNodePtr resultElem)
+{
+    xmlNsPtr ns;
+    /*
+    * OPTIMIZE TODO: This all could be optimized by keeping track of
+    *  the ns-decls currently in-scope via a specialized context.
+    */
+    /*
+    * Search on the result element itself.
+    */
+    if (resultElem->nsDef != NULL) {
+	ns = resultElem->nsDef;
+	do {
+	    if (ns->prefix == NULL) {
+		if ((ns->href != NULL) && (ns->href[0] != 0)) {
+		    /*
+		    * Raise a namespace normalization error.
+		    */
+		    xsltTransformError(ctxt, NULL, cur,
+			"Namespace normalization error: Cannot undeclare "
+			"the default namespace, since the default namespace "
+			"'%s' is already declared on the result element.\n",
+			ns->href);
+		    return(1);
+		} else {
+		    /*
+		    * The default namespace was undeclared on the
+		    * result element.
+		    */
+		    return(0);
+		}
+		break;
+	    }
+	    ns = ns->next;
+	} while (ns != NULL);
+    }
 
+    if ((resultElem->parent != NULL) &&
+	(resultElem->parent->type == XML_ELEMENT_NODE))
+    {
+	/*
+	* The parent element is in no namespace, so assume
+	* that there is no default namespace in scope.
+	*/
+	if (resultElem->parent->ns == NULL)
+	    return(0);
+
+	ns = xmlSearchNs(resultElem->doc, resultElem->parent,
+	    NULL);
+	/*
+	* Fine if there's no default ns is scope, or if the
+	* default ns was undeclared.
+	*/
+	if ((ns == NULL) || (ns->href == NULL) || (ns->href[0] == 0))
+	    return(0);
+
+	/*
+	* Undeclare the default namespace.
+	*/
+	ns = xmlNewNs(resultElem, BAD_CAST "", NULL);
+	/* TODO: Check result */	
+	return(0);
+    }
+    return(0);
+}
+
 /**
+* xsltTransLREAcquireResultInScopeNs:
+* @ctxt: the transformation context
+* @cur: the literal result element (in the stylesheet)
+* @literalNs: the namespace (in the stylsheet)
+* @resultElem: the generated result element
+*
+*
+* Find a matching (prefix and ns-name) ns-declaration
+*  for the given @ns in the result tree.
+* If none is found then a new ns-declaration will be
+*  added to @out. If, in this case, the given prefix is already
+*  in use, then a ns-declaration with a modified ns-prefix
+*  be we created.
+*
+* Returns the acquired ns-declaration
+*         or NULL in case of an API or internal error.
+*/
+static xmlNsPtr
+xsltTransLREAcquireResultInScopeNs(xsltTransformContextPtr ctxt,
+				   xmlNodePtr cur,
+				   xmlNsPtr literalNs,
+				   xmlNodePtr resultElem)
+{    
+    xmlNsPtr ns;
+    int prefixOccupied = 0;
+
+    if ((ctxt == NULL) || (cur == NULL) || (resultElem == NULL))
+	return(NULL);
+    
+    /*
+    * OPTIMIZE TODO: This all could be optimized by keeping track of
+    *  the ns-decls currently in-scope via a specialized context.
+    */
+    /*
+    * NOTE: Namespace exclusion and ns-aliasing is performed at
+    * compilation-time in the refactored code; so this need not be done
+    * here.
+    */
+    /*
+    * First: search on the result element itself.
+    */
+    if (resultElem->nsDef != NULL) {
+	ns = resultElem->nsDef;
+	do {
+	    if ((ns->prefix == NULL) == (literalNs->prefix == NULL)) {
+		if (literalNs->prefix == NULL) {
+		    if (xmlStrEqual(ns->href, literalNs->href))
+			return(ns);
+		    prefixOccupied = 1;
+		    break;
+		} else if ((ns->prefix[0] == literalNs->prefix[0]) &&
+		     xmlStrEqual(ns->prefix, literalNs->prefix))
+		{
+		    if (xmlStrEqual(ns->href, literalNs->href))
+			return(ns);
+		    prefixOccupied = 1;
+		    break;
+		}
+	    }
+	    ns = ns->next;
+	} while (ns != NULL);
+    }
+    if (prefixOccupied) {
+	/*
+	* If the ns-prefix is occupied by an other ns-decl on the
+	* result element, then this means:
+	* 1) The desired prefix is shadowed
+	* 2) There's no way around changing the prefix	
+	*
+	* Try a desperate search for an in-scope ns-decl
+	* with a matching ns-name before we use the last option,
+	* which is to recreate the ns-decl with a modified prefix.
+	*/
+	ns = xmlSearchNsByHref(resultElem->doc, resultElem, literalNs->href);
+	if (ns != NULL)
+	    return(ns);
+
+	/*
+	* Fallback to changing the prefix.
+	*/    
+    } else if ((resultElem->parent != NULL) &&
+	(resultElem->parent->type == XML_ELEMENT_NODE)) {
+	/*
+	* Try to find a matching ns-decl in the ancestor-axis.
+	*
+	* Check the common case: The parent element of the current
+	* result element is in the same namespace (with an equal ns-prefix).
+	*/     
+	if ((resultElem->parent->ns != NULL) &&
+	    ((resultElem->parent->ns->prefix == NULL) ==
+	     (literalNs->prefix == NULL)))
+	{
+	    ns = resultElem->parent->ns;
+	    
+	    if (literalNs->prefix == NULL) {
+		if (xmlStrEqual(ns->href, literalNs->href))
+		    return(ns);
+	    } else if ((ns->prefix[0] == literalNs->prefix[0]) &&
+		xmlStrEqual(ns->prefix, literalNs->prefix) &&
+		xmlStrEqual(ns->href, literalNs->href))
+	    {
+		return(ns);
+	    }
+	}
+	/*
+	* Lookup the remaining in-scope namespaces.
+	*/    
+	ns = xmlSearchNs(resultElem->doc, resultElem->parent,
+	    literalNs->prefix);
+	if ((ns != NULL) && xmlStrEqual(ns->href, literalNs->href))
+	    return(ns);
+	ns = NULL;
+	/*
+	* Either no matching ns-prefix was found or the namespace is
+	* shadowed.
+	* Create a new ns-decl on the current result element.
+	*
+	* SPEC TODO: Hmm, we could also try to reuse an in-scope
+	*  namespace with a matching ns-name but a different
+	*  ns-prefix.
+	*  What has higher precedence? 
+	*  1) If keeping the prefix: create a new ns-decl.
+	*  2) If reusal: first lookup ns-names; then fallback
+	*     to creation of a new ns-decl.
+	* REVISIT TODO: this currently uses case 2) since this
+	*  is the way it used to be before refactoring.
+	*/
+	ns = xmlSearchNsByHref(resultElem->doc, resultElem,
+	    literalNs->href);
+	if (ns != NULL)
+	    return(ns);
+	/*
+	* Create the ns-decl on the current result element.
+	*/
+	ns = xmlNewNs(resultElem, literalNs->href, literalNs->prefix);
+	/* TODO: check errors */
+	return(ns);
+    } else if ((resultElem->parent == NULL) ||
+	(resultElem->parent->type != XML_ELEMENT_NODE))
+    {
+	/*
+	* This is the root of the tree.
+	*/
+	ns = xmlNewNs(resultElem, literalNs->href, literalNs->prefix);
+	/* TODO: Check result */
+	return(ns);
+    }
+    /*
+    * Fallback: we need to generate a new prefix and declare the namespace
+    * on the result element.
+    */
+    {
+	xmlChar prefix[30];
+	int counter = 0;
+	
+	/*
+	* Comment copied from xslGetNamespace():
+	*  "For an element node, if we don't find it, or it's the default
+	*  and this element already defines a default (bug 165560), we
+	*  need to create it."
+	*/		
+	do {
+	    snprintf((char *) prefix, 30, "%s_%d",
+		literalNs->prefix, counter++);
+	    ns = xmlSearchNs(resultElem->doc, resultElem, BAD_CAST prefix);
+	    if (counter > 1000) {
+		xsltTransformError(ctxt, NULL, cur,
+		    "Internal error in xsltTransLREAcquireInScopeNs(): "		    
+		    "Failed to compute a unique ns-prefix for the "
+		    "result element");
+		return(NULL);
+	    }
+	} while (ns != NULL);
+	ns = xmlNewNs(resultElem, literalNs->href, BAD_CAST prefix);
+	/* TODO: Check result */
+	return(ns);
+    }
+    return(NULL);    
+}
+
+#endif /* XSLT_REFACTORED */
+
+/**
  * xsltApplyOneTemplate:
  * @ctxt:  a XSLT process context
  * @node:  the node in the source tree.
@@ -1513,6 +1977,9 @@
     xmlNodePtr oldInst = NULL;
     int oldBase;
     xmlDocPtr tmpRVT = NULL;
+#ifdef XSLT_REFACTORED
+    xsltStylePreCompPtr info;
+#endif
 
     int level = 0;
 
@@ -1615,7 +2082,7 @@
         if (insert == NULL) {
 #ifdef WITH_XSLT_DEBUG_PROCESS
             XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
-                             "xsltApplyOneTemplate: insert == NULL !\n"));
+                             "xsltApplyOneTemplateInt: insert == NULL !\n"));
 #endif
             goto error;
         }
@@ -1624,6 +2091,411 @@
             xslHandleDebugger(cur, node, templ, ctxt);
 #endif
 
+#ifdef XSLT_REFACTORED
+	if (cur->type == XML_ELEMENT_NODE) {
+	    info = (xsltStylePreCompPtr) cur->psvi;
+	    /*
+	    * We expect a compiled representation on:
+	    * 1) XSLT instructions of this XSLT version (1.0)
+	    *    (with a few exceptions)
+	    * 2) Literal result elements
+	    * 3) Extension instructions
+	    * 4) XSLT instructions of future XSLT versions
+	    *    (forwards-compatible mode).
+	    */
+	    if (info == NULL) {
+		/*
+		* Handle the rare cases where we don't expect a compiled
+		* representation on an XSLT element.
+		*/
+		if (IS_XSLT_ELEM_FAST(cur) && IS_XSLT_NAME(cur, "message")) {
+		    xsltMessage(ctxt, node, cur);
+		    goto skip_children;
+		}		    		 
+		/*
+		* Something really went wrong:
+		*/
+		xsltTransformError(ctxt, NULL, cur,
+		    "Internal error in xsltApplyOneTemplateInt(): "
+		    "The element '%s' in the stylesheet has no compiled "
+		    "representation.\n",
+		    cur->name);
+                goto skip_children;
+            }
+
+	    if (info->type == XSLT_FUNC_LITERAL_RESULT_ELEMENT) {
+		xsltStyleItemLRElementInfoPtr lrInfo =
+		    (xsltStyleItemLRElementInfoPtr) info;
+		/*
+		* Literal result elements
+		* --------------------------------------------------------
+		*/
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE,
+		    xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltApplyOneTemplateInt: copy literal result "
+		    "element '%s'\n", cur->name));
+#endif
+		/*
+		* Copy the raw element-node.
+		* OLD: if ((copy = xsltCopyNode(ctxt, cur, insert)) == NULL)
+		*   goto error;
+		*/		
+		copy = xmlDocCopyNode(cur, insert->doc, 0);
+		if (copy == NULL) {
+		    xsltTransformError(ctxt, NULL, cur,
+			"Internal error in xsltApplyOneTemplateInt(): "
+			"Failed to copy literal result element '%s'.\n",
+			cur->name);
+		    goto error;
+		} else {
+		    /*
+		    * Add the element-node to the result tree.
+		    */
+		    copy->doc = ctxt->output;
+		    xmlAddChild(insert, copy);
+		    /*
+		    * Create effective namespaces declarations.
+		    * OLD: xsltCopyNamespaceList(ctxt, copy, cur->nsDef);
+		    */
+		    if (lrInfo->effectiveNs != NULL) {
+			xsltEffectiveNsPtr effNs = lrInfo->effectiveNs;
+			xmlNsPtr ns, lastns = NULL;
+
+			while (effNs != NULL) {
+			    /*
+			    * Avoid generating redundant namespace
+			    * declarations; thus lookup if there is already
+			    * such a ns-decl in the result.
+			    */			    
+			    ns = xmlSearchNs(copy->doc, copy, effNs->prefix);
+			    if ((ns != NULL) &&
+				(xmlStrEqual(ns->href, effNs->nsName)))
+			    {
+				effNs = effNs->next;
+				continue;			    
+			    }
+			    ns = xmlNewNs(copy, effNs->nsName, effNs->prefix);
+			    if (ns == NULL) {
+				xsltTransformError(ctxt, NULL, cur,
+				    "Internal error in xsltApplyOneTemplateInt(): "
+				    "Failed to copy a namespace declaration.\n");
+				goto error;
+			    }
+								
+			    if (lastns == NULL)
+				copy->nsDef = ns;
+			    else
+				lastns->next =ns;
+			    lastns = ns;
+
+			    effNs = effNs->next;
+			}
+			
+		    }
+		    /*
+		    * NOTE that we don't need to apply ns-alising: this was
+		    *  already done at compile-time.
+		    */
+		    if (cur->ns != NULL) {
+			/*
+			* If there's no such ns-decl in the result tree,
+			* then xsltGetNamespace() will create a ns-decl
+			* on the copied node.
+			*/
+			/*
+			* REVISIT TODO: Changed to use
+			*  xsltTransLREAcquireInScopeNs() instead of
+			*  xsltGetNamespace().
+			*  OLD: copy->ns = xsltGetNamespace(ctxt, cur,
+			*                     cur->ns, copy);
+			*/
+			copy->ns = xsltTransLREAcquireResultInScopeNs(ctxt,
+			    cur, cur->ns, copy);
+		    } else {
+			/*
+			* Undeclare the default namespace if needed.
+			* This can be skipped, if:
+			* 1) If the result element has no ns-decls, in which
+			*    case the result element abviously does not
+			*    declare a default namespace.
+			* 2) AND there's either no parent, or the parent
+			*   is in no namespace; this means there's no
+			*   default namespace is scope to care about.
+			*
+			* REVISIT TODO: This might result in massive
+			*  generation of ns-decls if nodes in a default
+			*  namespaces are mixed with nodes in no namespace.
+			*  
+			*/
+			if (copy->nsDef ||
+			    ((insert != NULL) && (insert->ns != NULL)))
+			    xsltTransLREUndeclareResultDefaultNs(ctxt,
+				cur, copy);
+#if 0
+			defaultNs = xmlSearchNs(insert->doc, insert, NULL);
+			if ((defaultNs != NULL) && (defaultNs->href != NULL))
+			    xmlNewNs(copy, BAD_CAST "", NULL);
+#endif
+		    }
+		}
+		/*
+		* SPEC XSLT 2.0 "Each attribute of the literal result
+		*  element, other than an attribute in the XSLT namespace,
+		*  is processed to produce an attribute for the element in
+		*  the result tree."
+		* TODO: Refactor this, since it still uses ns-aliasing.
+		*/
+		if (cur->properties != NULL) {
+		    xsltAttrListTemplateProcess(ctxt, copy, cur->properties);
+		}
+		/*
+		* OLD-COMMENT: "Add extra namespaces inherited from the
+		*   current template if we are in the first level children
+		*   and this is a "real" template.
+		*
+		* SPEC XSLT 2.0:
+		*  "The following namespaces are designated as excluded
+		*   namespaces:
+		*  - The XSLT namespace URI
+		*      (http://www.w3.org/1999/XSL/Transform)
+		*  - A namespace URI declared as an extension namespace
+		*  - A namespace URI designated by using an
+		*      [xsl:]exclude-result-prefixes
+		*
+		* TODO:
+		*  XSLT 1.0
+		*   1) Supply all in-scope namespaces
+		*   2) Skip excluded namespaces (see above)
+		*   3) Apply namespace aliasing
+		*
+		*  XSLT 2.0 (will generate
+		*            redundant namespaces in some cases):
+		*   1) Supply all in-scope namespaces
+		*   2) Skip excluded namespaces if *not* target-namespace
+		*      of an namespace alias
+		*   3) Apply namespace aliasing
+		*
+		* NOTE: See bug #341325.
+		*/
+#if 0		
+		if ((templ != NULL) && (oldInsert == insert) &&
+		    (ctxt->templ != NULL) &&
+		    (ctxt->templ->inheritedNs != NULL)) {
+		    int i;
+		    xmlNsPtr ns, ret;
+		    
+		    for (i = 0; i < ctxt->templ->inheritedNsNr; i++) {
+			const xmlChar *URI = NULL;
+			xsltStylesheetPtr style;
+
+			ns = ctxt->templ->inheritedNs[i];
+			/*
+			* Apply namespace aliasing.
+			*
+			* TODO: Compute the effective value of namespace
+			*  aliases at compilation-time in order to avoid
+			*  the lookup in the import-tree here.
+			*/
+			style = ctxt->style;
+			while (style != NULL) {
+			    if (style->nsAliases != NULL)
+				URI = (const xmlChar *) 
+				    xmlHashLookup(style->nsAliases, ns->href);
+			    if (URI != NULL)
+				break;
+			    
+			    style = xsltNextImport(style);
+			}
+			if (URI == UNDEFINED_DEFAULT_NS) {
+			    xmlNsPtr defaultNs;
+
+			    defaultNs = xmlSearchNs(cur->doc, cur, NULL);
+			    if (defaultNs == NULL) {
+				/*
+				* TODO: Should not happen; i.e., it is
+				*  an error at compilation-time if there's
+				*  no default namespace in scope if
+				*  "#default" is used.
+				*/
+				continue;
+			    } else
+				URI = defaultNs->href;
+			}
+			
+			if (URI == NULL) {
+			    /*
+			    * There was no matching namespace-alias, so
+			    * just create a matching ns-decl if not
+			    * already in scope.
+			    */
+			    ret = xmlSearchNs(copy->doc, copy, ns->prefix);
+			    if ((ret == NULL) ||
+				(!xmlStrEqual(ret->href, ns->href)))
+				xmlNewNs(copy, ns->href, ns->prefix);
+			} else if (!xmlStrEqual(URI, XSLT_NAMESPACE)) {
+			    ret = xmlSearchNs(copy->doc, copy, ns->prefix);
+			    if ((ret == NULL) ||
+				(!xmlStrEqual(ret->href, URI))) {
+				/*
+				* Here we create a namespace
+				* declaration with the literal namespace
+				* prefix and with the target namespace name.
+				* TODO: We should consider to fix this and
+				*  use the *target* namespace prefix, not the
+				*  literal one (see bug #341325).
+				*/
+				xmlNewNs(copy, URI, ns->prefix);
+			    }
+			}
+		    }
+		    if (copy->ns != NULL) {
+			/*
+			* Fix the node namespace if needed
+			*/
+			copy->ns = xsltGetNamespace(ctxt, copy, copy->ns, copy);
+		    }
+		}
+#endif
+	    } else if (IS_XSLT_ELEM_FAST(cur)) {
+		/*
+		* XSLT instructions
+		* --------------------------------------------------------
+		*/
+		if (info->type == XSLT_FUNC_UNKOWN_FORWARDS_COMPAT) {
+		    /*
+		    * We hit an unknown XSLT element.
+		    * Try to apply one of the fallback cases.
+		    */		
+		    ctxt->insert = insert;
+		    if (!xsltApplyFallbacks(ctxt, node, cur)) {
+			xsltTransformError(ctxt, NULL, cur,
+			    "The is no fallback behaviour defined for "
+			    "the unknown XSLT element '%s'.\n",
+			    cur->name);
+		    }			
+		    ctxt->insert = oldInsert;
+		    goto skip_children;
+		}
+		/*
+		* Execute the XSLT instruction.
+		*/
+		if (info->func != NULL) {
+		    ctxt->insert = insert;
+		    info->func(ctxt, node, cur, (xsltElemPreCompPtr) info);
+		    ctxt->insert = oldInsert;
+		    goto skip_children;
+		}
+		/*
+		* Some XSLT instructions need custom execution.
+		*/		 
+		if (info->type == XSLT_FUNC_VARIABLE) {
+		    if (level != 0) {
+			/*
+			* Build a new subframe and skip all the nodes
+			* at that level.
+			*/
+			ctxt->insert = insert;
+			xsltApplyOneTemplateInt(ctxt, node, cur, NULL, NULL, 0);
+			while (cur->next != NULL)
+			    cur = cur->next;
+			ctxt->insert = oldInsert;
+		    } else {
+			xsltParseStylesheetVariable(ctxt, cur);
+		    }
+		} else if (info->type == XSLT_FUNC_PARAM) {
+		    xsltParseStylesheetParam(ctxt, cur);
+		} else if (info->type == XSLT_FUNC_MESSAGE) {
+		    /*
+		    * TODO: Won't be hit, since we don't compile xsl:message.
+		    */
+		    xsltMessage(ctxt, node, cur);
+		} else {
+		    xsltGenericError(xsltGenericErrorContext,
+			"Internal error in xsltApplyOneTemplateInt(): "
+			"Don't know how to process the XSLT element "
+			"'%s'.\n", cur->name);			
+		}
+		goto skip_children;
+
+	    } else {
+		xsltTransformFunction func;
+		/*
+		* Extension intructions (elements)
+		* --------------------------------------------------------
+		*/				
+		if (cur->psvi == xsltExtMarker) {
+		    /*
+		    * The xsltExtMarker was set during the compilation
+		    * of extension instructions if there was no registered
+		    * handler for this specific extension function at
+		    * compile-time.
+		    * Libxslt will now lookup if a handler is
+		    * registered in the context of this transformation.
+		    */
+		    func = (xsltTransformFunction)
+			xsltExtElementLookup(ctxt, cur->name, cur->ns->href);
+		} else
+		    func = ((xsltElemPreCompPtr) cur->psvi)->func;
+		
+		if (func == NULL) {
+		    /*
+		    * No handler available.
+		    * Try to execute fallback behaviour via xsl:fallback.
+		    */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE,
+			xsltGenericDebug(xsltGenericDebugContext,
+			    "xsltApplyOneTemplate: unknown extension %s\n",
+			    cur->name));
+#endif
+		    ctxt->insert = insert;
+		    if (!xsltApplyFallbacks(ctxt, node, cur)) {
+			xsltTransformError(ctxt, NULL, cur,
+			    "Unknown extension instruction '{%s}%s'.\n",
+			    cur->ns->href, cur->name);
+		    }			
+		    ctxt->insert = oldInsert;		    
+		} else {
+		    /*
+		    * Execute the handler-callback.
+		    */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+			"xsltApplyOneTemplate: extension construct %s\n",
+			cur->name));
+#endif		    
+		    ctxt->insert = insert;
+		    func(ctxt, node, cur, cur->psvi);
+		    ctxt->insert = oldInsert;
+		}
+		goto skip_children;
+	    }
+
+	} else if (XSLT_IS_TEXT_NODE(cur)) {
+	    /*
+	    * Text
+	    * ------------------------------------------------------------
+	    */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+            if (cur->name == xmlStringTextNoenc) {
+                XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE,
+		    xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltApplyOneTemplateInt: copy unescaped text '%s'\n",
+		    cur->content));
+            } else {
+                XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE,
+		    xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltApplyOneTemplateInt: copy text '%s'\n",
+		    cur->content));
+            }
+#endif
+            if (xsltCopyText(ctxt, insert, cur, ctxt->internalized) == NULL)
+		goto error;	    
+	}
+
+#else /* XSLT_REFACTORED */
+
         if (IS_XSLT_ELEM(cur)) {
             /*
              * This is an XSLT node
@@ -1681,6 +2553,7 @@
             goto skip_children;
         } else if ((cur->type == XML_TEXT_NODE) ||
                    (cur->type == XML_CDATA_SECTION_NODE)) {
+
             /*
              * This text comes from the stylesheet
              * For stylesheets, the set of whitespace-preserving
@@ -1774,7 +2647,7 @@
             /*
              * Add extra namespaces inherited from the current template
              * if we are in the first level children and this is a
-	     * "real" template.
+	     * "real" template.	     
              */
             if ((templ != NULL) && (oldInsert == insert) &&
                 (ctxt->templ != NULL) && (ctxt->templ->inheritedNs != NULL)) {
@@ -1795,7 +2668,7 @@
 		      
 		      style = xsltNextImport(style);
 		    }
-
+		    		    
 		    if (URI == UNDEFINED_DEFAULT_NS) {
 		      xmlNsPtr dflt;
 		      dflt = xmlSearchNs(cur->doc, cur, NULL);
@@ -1825,9 +2698,10 @@
 		}
             }
         }
+#endif /* else of XSLT_REFACTORED */
 
         /*
-         * Skip to next node, in document order.
+         * Descend into content in document order.
          */
         if (cur->children != NULL) {
             if (cur->children->type != XML_ENTITY_DECL) {
@@ -1838,10 +2712,13 @@
                 continue;
             }
         }
-      skip_children:
+
+skip_children:
 	/*
-	If xslt:message just processed, might have terminate='yes'
-	If so, break out of while to clean up processing.
+	* If xslt:message was just processed, we might have hit a
+	* terminate='yes'; if so, then break the loop and clean up.
+	* TODO: Do we need to check this also before trying to descend
+	*  into the content?
 	*/
 	if (ctxt->state == XSLT_STATE_STOPPED)
 	    break;
@@ -2462,7 +3339,7 @@
  * @inst:  the xslt copy node
  * @comp:  precomputed information
  *
- * Process the xslt copy node on the source node
+ * Execute the xsl:copy instruction on the source node.
  */
 void
 xsltCopy(xsltTransformContextPtr ctxt, xmlNodePtr node,
@@ -2473,7 +3350,7 @@
     xsltStylePreCompPtr comp = castedComp;
 #endif
     xmlNodePtr copy, oldInsert;
-
+   
     oldInsert = ctxt->insert;
     if (ctxt->insert != NULL) {
 	switch (node->type) {
@@ -2499,8 +3376,12 @@
 	    case XML_HTML_DOCUMENT_NODE:
 		break;
 	    case XML_ELEMENT_NODE:
-		if (xmlStrEqual(node->name, BAD_CAST " fake node libxslt"))
-		    return;
+		/*
+		* NOTE: The "fake" is a doc-node, not an element node.
+		* OLD:
+		*   if (xmlStrEqual(node->name, BAD_CAST " fake node libxslt"))
+		*    return;
+		*/		
 
 #ifdef WITH_XSLT_DEBUG_PROCESS
 		XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext,
@@ -2781,6 +3662,10 @@
 	if (comp->use != NULL) {
 	    xsltApplyAttributeSet(ctxt, node, inst, comp->use);
 	} else {
+	    /*
+	    * BUG TODO: use-attribute-sets is not a value template.
+	    *  use-attribute-sets = qnames
+	    */
 	    attributes = xsltEvalAttrValueTemplate(ctxt, inst,
 		       (const xmlChar *)"use-attribute-sets", NULL);
 	    if (attributes != NULL) {
@@ -2908,12 +3793,12 @@
 
 /**
  * xsltCopyOf:
- * @ctxt:  a XSLT process context
- * @node:  the node in the source tree.
- * @inst:  the xslt copy-of node
- * @comp:  precomputed information
+ * @ctxt:  an XSLT transformation context
+ * @node:  the current node in the source tree
+ * @inst:  the element node of the XSLT copy-of instruction 
+ * @comp:  precomputed information of the XSLT copy-of instruction
  *
- * Process the xslt copy-of node on the source node
+ * Process the XSLT copy-of instruction.
  */
 void
 xsltCopyOf(xsltTransformContextPtr ctxt, xmlNodePtr node,
@@ -2938,20 +3823,41 @@
 	return;
     }
 
+     /*
+    * SPEC XSLT 1.0:
+    *  "The xsl:copy-of element can be used to insert a result tree
+    *  fragment into the result tree, without first converting it to
+    *  a string as xsl:value-of does (see [7.6.1 Generating Text with
+    *  xsl:value-of]). The required select attribute contains an
+    *  expression. When the result of evaluating the expression is a
+    *  result tree fragment, the complete fragment is copied into the
+    *  result tree. When the result is a node-set, all the nodes in the
+    *  set are copied in document order into the result tree; copying
+    *  an element node copies the attribute nodes, namespace nodes and
+    *  children of the element node as well as the element node itself;
+    *  a root node is copied by copying its children. When the result
+    *  is neither a node-set nor a result tree fragment, the result is
+    *  converted to a string and then inserted into the result tree,
+    *  as with xsl:value-of.
+    */
+
 #ifdef WITH_XSLT_DEBUG_PROCESS
     XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext,
 	 "xsltCopyOf: select %s\n", comp->select));
 #endif
 
+    /*
+    * Set up the XPath evaluation context.
+    */
     oldProximityPosition = ctxt->xpathCtxt->proximityPosition;
     oldContextSize = ctxt->xpathCtxt->contextSize;
     oldNsNr = ctxt->xpathCtxt->nsNr;
     oldNamespaces = ctxt->xpathCtxt->namespaces;
     ctxt->xpathCtxt->node = node;
 #ifdef XSLT_REFACTORED
-    if (comp->inScopeNS != NULL) {
-	ctxt->xpathCtxt->namespaces = comp->inScopeNS->list;
-	ctxt->xpathCtxt->nsNr = comp->inScopeNS->number;
+    if (comp->inScopeNs != NULL) {
+	ctxt->xpathCtxt->namespaces = comp->inScopeNs->list;
+	ctxt->xpathCtxt->nsNr = comp->inScopeNs->number;
     } else {
 	ctxt->xpathCtxt->namespaces = NULL;
 	ctxt->xpathCtxt->nsNr = 0;
@@ -2960,57 +3866,79 @@
     ctxt->xpathCtxt->namespaces = comp->nsList;
     ctxt->xpathCtxt->nsNr = comp->nsNr;
 #endif
+    /*
+    * Evaluate the "select" expression.
+    */
     res = xmlXPathCompiledEval(comp->comp, ctxt->xpathCtxt);
+    /*
+    * Revert the XPath evaluation context to previous state.
+    */
     ctxt->xpathCtxt->proximityPosition = oldProximityPosition;
     ctxt->xpathCtxt->contextSize = oldContextSize;
     ctxt->xpathCtxt->nsNr = oldNsNr;
     ctxt->xpathCtxt->namespaces = oldNamespaces;
+
     if (res != NULL) {
 	if (res->type == XPATH_NODESET) {
+	    /*
+	    * Node-set
+	    * --------
+	    */
 #ifdef WITH_XSLT_DEBUG_PROCESS
 	    XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext,
 		 "xsltCopyOf: result is a node set\n"));
 #endif
 	    list = res->nodesetval;
 	    if (list != NULL) {
-		/* the list is already sorted in document order by XPath */
-		/* append everything in this order under ctxt->insert */
+		xmlNodePtr cur;
+		/*
+		* The list is already sorted in document order by XPath.
+		* Append everything in this order under ctxt->insert.
+		*/
 		for (i = 0;i < list->nodeNr;i++) {
-		    if (list->nodeTab[i] == NULL)
+		    cur = list->nodeTab[i];
+		    if (cur == NULL)
 			continue;
-		    if ((list->nodeTab[i]->type == XML_DOCUMENT_NODE) ||
-			(list->nodeTab[i]->type == XML_HTML_DOCUMENT_NODE)) {
-			xsltCopyTreeList(ctxt, list->nodeTab[i]->children,
-				         ctxt->insert, 0);
-		    } else if (list->nodeTab[i]->type == XML_ATTRIBUTE_NODE) {
-			xsltCopyProp(ctxt, ctxt->insert, 
-				     (xmlAttrPtr) list->nodeTab[i]);
+		    if ((cur->type == XML_DOCUMENT_NODE) ||
+			(cur->type == XML_HTML_DOCUMENT_NODE))
+		    {
+			xsltCopyTreeList(ctxt, cur->children, ctxt->insert, 0);
+		    } else if (cur->type == XML_ATTRIBUTE_NODE) {
+			xsltCopyProp(ctxt, ctxt->insert, (xmlAttrPtr) cur);
 		    } else {
-			xsltCopyTree(ctxt, list->nodeTab[i], ctxt->insert, 0);
+			xsltCopyTree(ctxt, cur, ctxt->insert, 0);
 		    }
 		}
 	    }
 	} else if (res->type == XPATH_XSLT_TREE) {
+	    /*
+	    * Result tree fragment
+	    * --------------------
+	    */
 #ifdef WITH_XSLT_DEBUG_PROCESS
 	    XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext,
 		 "xsltCopyOf: result is a result tree fragment\n"));
 #endif
+	    /*
+	    * TODO: Is list->nodeTab[0] is an xmlDocPtr?
+	    */
 	    list = res->nodesetval;
 	    if ((list != NULL) && (list->nodeTab != NULL) &&
 		(list->nodeTab[0] != NULL) &&
-		(IS_XSLT_REAL_NODE(list->nodeTab[0]))) {
+		(IS_XSLT_REAL_NODE(list->nodeTab[0])))
+	    {
 		xsltCopyTreeList(ctxt, list->nodeTab[0]->children,
 			         ctxt->insert, 0);
 	    }
 	} else {
-	    /* convert to a string */
+	    /* Convert to a string. */
 	    res = xmlXPathConvertString(res);
 	    if ((res != NULL) && (res->type == XPATH_STRING)) {
 #ifdef WITH_XSLT_DEBUG_PROCESS
 		XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext,
 		     "xsltCopyOf: result %s\n", res->stringval));
 #endif
-		/* append content as text node */
+		/* Append content as text node. */
 		xsltCopyTextString(ctxt, ctxt->insert, res->stringval, 0);
 	    }
 	}
@@ -3065,9 +3993,9 @@
     oldNamespaces = ctxt->xpathCtxt->namespaces;
     ctxt->xpathCtxt->node = node;
 #ifdef XSLT_REFACTORED
-    if (comp->inScopeNS != NULL) {
-	ctxt->xpathCtxt->namespaces = comp->inScopeNS->list;
-	ctxt->xpathCtxt->nsNr = comp->inScopeNS->number;
+    if (comp->inScopeNs != NULL) {
+	ctxt->xpathCtxt->namespaces = comp->inScopeNs->list;
+	ctxt->xpathCtxt->nsNr = comp->inScopeNs->number;
     } else {
 	ctxt->xpathCtxt->namespaces = NULL;
 	ctxt->xpathCtxt->nsNr = 0;
@@ -3232,7 +4160,11 @@
 	*   structure. Avoid to "search" for params dynamically
 	*   in the XML tree every time.
 	*/
+#ifdef XSLT_REFACTORED
+	if (IS_XSLT_ELEM_FAST(cur)) {
+#else
 	if (IS_XSLT_ELEM(cur)) {
+#endif
 	    if (IS_XSLT_NAME(cur, "with-param")) {
 		param = xsltParseStylesheetCallerParam(ctxt, cur);
 		if (param != NULL) {
@@ -3345,9 +4277,9 @@
 
 	ctxt->xpathCtxt->node = node;
 #ifdef XSLT_REFACTORED
-	if (comp->inScopeNS != NULL) {
-	    ctxt->xpathCtxt->namespaces = comp->inScopeNS->list;
-	    ctxt->xpathCtxt->nsNr = comp->inScopeNS->number;
+	if (comp->inScopeNs != NULL) {
+	    ctxt->xpathCtxt->namespaces = comp->inScopeNs->list;
+	    ctxt->xpathCtxt->nsNr = comp->inScopeNs->number;
 	} else {
 	    ctxt->xpathCtxt->namespaces = NULL;
 	    ctxt->xpathCtxt->nsNr = 0;
@@ -3374,8 +4306,9 @@
 		if ((list != NULL) && (ctxt->document->keys != NULL)) {
 		    if ((list->nodeNr != 0) &&
 		        (list->nodeTab[0]->doc != NULL) &&
-		        (xmlStrEqual((xmlChar *)list->nodeTab[0]->doc->name,
-			   (const xmlChar *) " fake node libxslt")) &&
+
+		        XSLT_IS_RES_TREE_FRAG(list->nodeTab[0]->doc) &&
+
 			(list->nodeTab[0]->doc->_private == NULL)) {
 			    list->nodeTab[0]->doc->_private = xsltNewDocument(
 			    	ctxt, list->nodeTab[0]->doc);
@@ -3500,7 +4433,11 @@
 #endif
 #endif
         if (ctxt->state == XSLT_STATE_STOPPED) break;
+#ifdef XSLT_REFACTORED
+	if (IS_XSLT_ELEM_FAST(cur)) {
+#else
         if (IS_XSLT_ELEM(cur)) {
+#endif
             if (IS_XSLT_NAME(cur, "with-param")) {
                 param = xsltParseStylesheetCallerParam(ctxt, cur);
 		if (param != NULL) {
@@ -3620,13 +4557,23 @@
 	     "xsl:choose: empty content not allowed\n");
 	goto error;
     }
-    if (((!IS_XSLT_ELEM(replacement)) || (!IS_XSLT_NAME(replacement, "when")))
+#ifdef XSLT_REFACTORED
+    if (((!IS_XSLT_ELEM_FAST(replacement)) ||
+#else
+    if (((!IS_XSLT_ELEM(replacement)) ||
+#endif
+	(!IS_XSLT_NAME(replacement, "when")))
 	    && (!xmlIsBlankNode(replacement))) {
 	xsltTransformError(ctxt, NULL, inst,
 	     "xsl:choose: xsl:when expected first\n");
 	goto error;
     }
-    while ((IS_XSLT_ELEM(replacement) && (IS_XSLT_NAME(replacement, "when")))
+#ifdef XSLT_REFACTORED
+    while ((IS_XSLT_ELEM_FAST(replacement) &&
+#else
+    while ((IS_XSLT_ELEM(replacement) &&
+#endif    
+	(IS_XSLT_NAME(replacement, "when")))
 	    || xmlIsBlankNode(replacement)) {
 #ifdef XSLT_REFACTORED
 	xsltStyleItemWhenPtr wcomp =
@@ -3669,9 +4616,9 @@
 	oldNamespaces = ctxt->xpathCtxt->namespaces;
   	ctxt->xpathCtxt->node = node;
 #ifdef XSLT_REFACTORED
-	if (wcomp->inScopeNS != NULL) {
-	    ctxt->xpathCtxt->namespaces = wcomp->inScopeNS->list;
-	    ctxt->xpathCtxt->nsNr = wcomp->inScopeNS->number;
+	if (wcomp->inScopeNs != NULL) {
+	    ctxt->xpathCtxt->namespaces = wcomp->inScopeNs->list;
+	    ctxt->xpathCtxt->nsNr = wcomp->inScopeNs->number;
 	} else {
 	    ctxt->xpathCtxt->namespaces = NULL;
 	    ctxt->xpathCtxt->nsNr = 0;
@@ -3715,7 +4662,12 @@
 	res = NULL;
 	replacement = replacement->next;
     }
-    if (IS_XSLT_ELEM(replacement) && (IS_XSLT_NAME(replacement, "otherwise"))) {
+#ifdef XSLT_REFACTORED
+    if (IS_XSLT_ELEM_FAST(replacement) &&
+#else
+    if (IS_XSLT_ELEM(replacement) &&
+#endif	
+	(IS_XSLT_NAME(replacement, "otherwise"))) {
 #ifdef WITH_DEBUGGER
         if (xslDebugStatus != XSLT_DEBUG_NONE)
 #ifdef XSLT_REFACTORED
@@ -3791,9 +4743,9 @@
     oldNamespaces = ctxt->xpathCtxt->namespaces;
     ctxt->xpathCtxt->node = node;
 #ifdef XSLT_REFACTORED
-    if (comp->inScopeNS != NULL) {
-	ctxt->xpathCtxt->namespaces = comp->inScopeNS->list;
-	ctxt->xpathCtxt->nsNr = comp->inScopeNS->number;
+    if (comp->inScopeNs != NULL) {
+	ctxt->xpathCtxt->namespaces = comp->inScopeNs->list;
+	ctxt->xpathCtxt->nsNr = comp->inScopeNs->number;
     } else {
 	ctxt->xpathCtxt->namespaces = NULL;
 	ctxt->xpathCtxt->nsNr = 0;
@@ -3886,9 +4838,9 @@
     oldNamespaces = ctxt->xpathCtxt->namespaces;
     ctxt->xpathCtxt->node = node;
 #ifdef XSLT_REFACTORED
-    if (comp->inScopeNS != NULL) {
-	ctxt->xpathCtxt->namespaces = comp->inScopeNS->list;
-	ctxt->xpathCtxt->nsNr = comp->inScopeNS->number;
+    if (comp->inScopeNs != NULL) {
+	ctxt->xpathCtxt->namespaces = comp->inScopeNs->list;
+	ctxt->xpathCtxt->nsNr = comp->inScopeNs->number;
     } else {
 	ctxt->xpathCtxt->namespaces = NULL;
 	ctxt->xpathCtxt->nsNr = 0;
@@ -3933,7 +4885,12 @@
      * handle and skip the xsl:sort
      */
     replacement = inst->children;
-    while (IS_XSLT_ELEM(replacement) && (IS_XSLT_NAME(replacement, "sort"))) {
+#ifdef XSLT_REFACTORED
+    while (IS_XSLT_ELEM_FAST(replacement) &&
+#else
+    while (IS_XSLT_ELEM(replacement) &&
+#endif
+	(IS_XSLT_NAME(replacement, "sort"))) {
 	if (nbsorts >= XSLT_MAX_SORT) {
 	    xsltGenericError(xsltGenericErrorContext,
 		"xsl:for-each: too many sorts\n");
@@ -4139,6 +5096,45 @@
     return;
 }
 
+#ifdef XSLT_REFACTORED_KEYCOMP
+static int
+xsltCountKeys(xsltTransformContextPtr ctxt)
+{
+    xsltStylesheetPtr style;
+    xsltKeyDefPtr keyd;
+
+    if (ctxt == NULL)
+	return(-1);    
+
+    /*
+    * Do we have those nastly templates with a key() in the match pattern?
+    */
+    ctxt->hasTemplKeyPatterns = 0;
+    style = ctxt->style;
+    while (style != NULL) {
+	if (style->keyMatch != NULL) {
+	    ctxt->hasTemplKeyPatterns = 1;
+	    break;
+	}
+	style = xsltNextImport(style);
+    }
+    /*
+    * Count number of key declarations.
+    */
+    ctxt->nbKeys = 0;
+    style = ctxt->style;
+    while (style != NULL) {
+	keyd = style->keys;
+	while (keyd) {
+	    ctxt->nbKeys++;
+	    keyd = keyd->next;
+	}
+	style = xsltNextImport(style);
+    }        
+    return(ctxt->nbKeys);
+}
+#endif /* XSLT_REFACTORED_KEYCOMP */
+
 /**
  * xsltApplyStylesheetInternal:
  * @style:  a parsed XSLT stylesheet
@@ -4333,6 +5329,9 @@
     if (params != NULL)
         xsltEvalUserParams(ctxt, params);
     xsltEvalGlobalVariables(ctxt);
+#ifdef XSLT_REFACTORED_KEYCOMP    
+    xsltCountKeys(ctxt);
+#endif
     ctxt->node = (xmlNodePtr) doc;
     varsPush(ctxt, NULL);
     ctxt->varsBase = ctxt->varsNr - 1;
@@ -4399,6 +5398,10 @@
             }
             if (tmp == root) {
                 ctxt->type = XSLT_OUTPUT_HTML;
+		/*
+		* REVISIT TODO: XML_HTML_DOCUMENT_NODE is set after the
+		*  transformation on the doc, but functions like
+		*/
                 res->type = XML_HTML_DOCUMENT_NODE;
                 if (((doctypePublic != NULL) || (doctypeSystem != NULL))) {
                     res->intSubset = xmlCreateIntSubset(res, doctype,

Modified: packages/libxslt/branches/upstream/current/libxslt/variables.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/variables.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/variables.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -36,16 +36,21 @@
 #define WITH_XSLT_DEBUG_VARIABLE
 #endif
 
+#ifdef XSLT_REFACTORED
+const xmlChar *xsltDocFragFake = (const xmlChar *) " fake node libxslt";
+#endif
+
 /************************************************************************
  *									*
- *			Result Value Tree interfaces			*
+ *  Result Value Tree (Result Tree Fragment) interfaces			*
  *									*
  ************************************************************************/
 /**
  * xsltCreateRVT:
  * @ctxt:  an XSLT transformation context
  *
- * Create a result value tree
+ * Create a Result Value Tree
+ * (the XSLT 1.0 term for this is "Result Tree Fragment") 
  *
  * Returns the result value tree or NULL in case of error
  */
@@ -54,6 +59,10 @@
 {
     xmlDocPtr container;
 
+    /*
+    * Question: Why is this function public?
+    * Answer: It is called by the EXSLT module.
+    */    
     if (ctxt == NULL) return(NULL);
 
     container = xmlNewDoc(NULL);
@@ -66,7 +75,7 @@
                      "reusing transformation dict for RVT\n");
 #endif
 
-    container->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt");
+    XSLT_MARK_RES_TREE_FRAG(container);
     container->doc = container;
     container->parent = NULL;
     return(container);
@@ -75,9 +84,10 @@
 /**
  * xsltRegisterTmpRVT:
  * @ctxt:  an XSLT transformation context
- * @RVT:  a result value tree
+ * @RVT:  a result value tree (Result Tree Fragment)
  *
- * Register the result value tree for destruction at the end of the context
+ * Register the result value tree (XSLT 1.0 term: Result Tree Fragment)
+ * for destruction at the end of the context
  *
  * Returns 0 in case of success and -1 in case of error.
  */
@@ -96,9 +106,10 @@
 /**
  * xsltRegisterPersistRVT:
  * @ctxt:  an XSLT transformation context
- * @RVT:  a result value tree
+ * @RVT:  a result value tree (Result Tree Fragment)
  *
- * Register the result value tree for destruction at the end of the processing
+ * Register the result value tree (XSLT 1.0 term: Result Tree Fragment)
+ * for destruction at the end of the processing
  *
  * Returns 0 in case of success and -1 in case of error.
  */
@@ -118,7 +129,8 @@
  * xsltFreeRVTs:
  * @ctxt:  an XSLT transformation context
  *
- * Free all the registered result value tree of the transformation
+ * Free all the registered result value tree (Result Tree Fragment)
+ * of the transformation
  */
 void
 xsltFreeRVTs(xsltTransformContextPtr ctxt)
@@ -467,9 +479,9 @@
 	if (precomp != NULL) {
 	    ctxt->inst = precomp->inst;
 #ifdef XSLT_REFACTORED
-	    if (precomp->inScopeNS != NULL) {
-		ctxt->xpathCtxt->namespaces = precomp->inScopeNS->list;
-		ctxt->xpathCtxt->nsNr = precomp->inScopeNS->number;
+	    if (precomp->inScopeNs != NULL) {
+		ctxt->xpathCtxt->namespaces = precomp->inScopeNs->list;
+		ctxt->xpathCtxt->nsNr = precomp->inScopeNs->number;
 	    } else {
 		ctxt->xpathCtxt->namespaces = NULL;
 		ctxt->xpathCtxt->nsNr = 0;
@@ -606,6 +618,14 @@
 #else
     precomp = elem->comp;
 #endif
+
+    /*
+    * OPTIMIZE TODO: We should consider if instantiating global vars/params
+    *  on a on-demand basis would be better. The vars/params don't
+    *  need to be evaluated if never called; and in the case of
+    *  global params, if values for such params are provided by the
+    *  user.
+    */
     if (elem->select != NULL) {
 	xmlXPathCompExprPtr comp = NULL;
 
@@ -628,9 +648,9 @@
 	if (precomp != NULL) {
 	    ctxt->inst = precomp->inst;
 #ifdef XSLT_REFACTORED
-	    if (precomp->inScopeNS != NULL) {
-		ctxt->xpathCtxt->namespaces = precomp->inScopeNS->list;
-		ctxt->xpathCtxt->nsNr = precomp->inScopeNS->number;
+	    if (precomp->inScopeNs != NULL) {
+		ctxt->xpathCtxt->namespaces = precomp->inScopeNs->list;
+		ctxt->xpathCtxt->nsNr = precomp->inScopeNs->number;
 	    } else {
 		ctxt->xpathCtxt->namespaces = NULL;
 		ctxt->xpathCtxt->nsNr = 0;
@@ -1389,10 +1409,12 @@
 /**
  * xsltParseStylesheetCallerParam:
  * @ctxt:  the XSLT transformation context
- * @cur:  the "param" element
+ * @cur:  the "xsl:with-param" element
  *
  * parse an XSLT transformation param declaration, compute
  * its value but doesn't record it.
+ * NOTE that this is also called with an *xsl:param* element
+ * from exsltFuncFunctionFunction(). 
  *
  * Returns the new xsltStackElemPtr or NULL
  */
@@ -1417,19 +1439,19 @@
 #endif     
     if (comp == NULL) {
 	xsltTransformError(ctxt, NULL, cur,
-	    "xsl:param : compilation error\n");
+	    "xsl:with-param : compilation error\n");
 	return(NULL);
     }
 
     if (comp->name == NULL) {
 	xsltTransformError(ctxt, NULL, cur,
-	    "xsl:param : missing name attribute\n");
+	    "xsl:with-param : missing name attribute\n");
 	return(NULL);
     }
 
 #ifdef WITH_XSLT_DEBUG_VARIABLE
     XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
-	    "Handling param %s\n", comp->name));
+	    "Handling xsl:with-param %s\n", comp->name));
 #endif
 
     if (comp->select == NULL) {
@@ -1467,11 +1489,15 @@
 
     if ((cur == NULL) || (style == NULL))
 	return;
-
-    xsltStylePreCompute(style, cur);
+    
 #ifdef XSLT_REFACTORED
+    /*
+    * Note that xsltStylePreCompute() will be called from
+    * xslt.c only.
+    */
     comp = (xsltStyleItemVariablePtr) cur->psvi;
 #else
+    xsltStylePreCompute(style, cur);
     comp = (xsltStylePreCompPtr) cur->psvi;
 #endif
     if (comp == NULL) {
@@ -1486,8 +1512,15 @@
 	return;
     }
 
+    /*
+    * Parse the content (a sequence constructor) of xsl:variable.
+    */
     if (cur->children != NULL) {
+#ifdef XSLT_REFACTORED	
+        xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children);
+#else
         xsltParseTemplateContent(style, cur);
+#endif
     }
 #ifdef WITH_XSLT_DEBUG_VARIABLE
     xsltGenericDebug(xsltGenericDebugContext,
@@ -1518,11 +1551,15 @@
 
     if ((cur == NULL) || (style == NULL))
 	return;
-
-    xsltStylePreCompute(style, cur);
+    
 #ifdef XSLT_REFACTORED
+    /*
+    * Note that xsltStylePreCompute() will be called from
+    * xslt.c only.
+    */
     comp = (xsltStyleItemParamPtr) cur->psvi;
 #else
+    xsltStylePreCompute(style, cur);
     comp = (xsltStylePreCompPtr) cur->psvi;
 #endif    
     if (comp == NULL) {
@@ -1537,8 +1574,15 @@
 	return;
     }
 
+    /*
+    * Parse the content (a sequence constructor) of xsl:param.
+    */
     if (cur->children != NULL) {
+#ifdef XSLT_REFACTORED	
+        xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children);
+#else
         xsltParseTemplateContent(style, cur);
+#endif
     }
 
 #ifdef WITH_XSLT_DEBUG_VARIABLE

Modified: packages/libxslt/branches/upstream/current/libxslt/xslt.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/xslt.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/xslt.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -27,6 +27,7 @@
 #include <libxml/xmlerror.h>
 #include <libxml/parserInternals.h>
 #include <libxml/xpathInternals.h>
+#include <libxml/xpath.h>
 #include "xslt.h"
 #include "xsltInternals.h"
 #include "pattern.h"
@@ -51,7 +52,32 @@
 const int xsltLibxsltVersion = LIBXSLT_VERSION;
 const int xsltLibxmlVersion = LIBXML_VERSION;
 
+#ifdef XSLT_REFACTORED
+
+const xmlChar *xsltConstNamespaceNameXSLT= (const xmlChar *) XSLT_NAMESPACE;
+
 /*
+* xsltLiteralResultMarker:
+* Marker for Literal result elements, in order to avoid multiple attempts
+* to recognize such elements in the stylesheet's tree.
+* This marker is set on node->psvi during the initial traversal
+* of a stylesheet's node tree.
+*
+const xmlChar *xsltLiteralResultMarker =
+    (const xmlChar *) "Literal Result Element";
+*/
+
+/*
+* xsltXSLTTextMarker:
+* Marker for xsl:text elements. Used to recognize xsl:text elements
+* for post-processing of the stylesheet's tree, where those
+* elements are removed from the tree.
+*/
+const xmlChar *xsltXSLTTextMarker = (const xmlChar *) "XSLT Text Element";
+
+#endif
+
+/*
  * Harmless but avoiding a problem when compiling against a
  * libxml <= 2.3.11 without LIBXML_DEBUG_ENABLED
  */
@@ -75,11 +101,39 @@
     (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
 
 /**
+ * xsltParseContentError:
+ *
+ * @style: the stylesheet
+ * @node: the node where the error occured
+ *
+ * Compile-time error function.
+ */
+static void
+xsltParseContentError(xsltStylesheetPtr style,
+		       xmlNodePtr node)
+{
+    if ((style == NULL) || (node == NULL))
+	return;
+
+    if (IS_XSLT_ELEM(node))
+	xsltTransformError(NULL, style, node,
+	    "The XSLT-element '%s' is not allowed at this position.\n",
+	    node->name);
+    else
+	xsltTransformError(NULL, style, node,
+	    "The element '%s' is not allowed at this position.\n",
+	    node->name);
+    style->errors++;
+}
+
+#ifdef XSLT_REFACTORED
+#else
+/**
  * exclPrefixPush:
  * @style: the transformation stylesheet
- * @value:  the excluded prefix to push on the stack
+ * @value:  the excluded namespace name to push on the stack
  *
- * Push an excluded prefix on the stack
+ * Push an excluded namespace name on the stack
  *
  * Returns the new index in the stack or 0 in case of error
  */
@@ -135,6 +189,7 @@
     style->exclPrefixTab[style->exclPrefixNr] = 0;
     return (ret);
 }
+#endif
 
 /************************************************************************
  *									*
@@ -270,7 +325,7 @@
 
 /**
  * xsltDecimalFormatGetByName:
- * @sheet: the XSLT stylesheet
+ * @style: the XSLT stylesheet
  * @name: the decimal-format name to find
  *
  * Find decimal-format by name
@@ -278,21 +333,21 @@
  * Returns the xsltDecimalFormatPtr
  */
 xsltDecimalFormatPtr
-xsltDecimalFormatGetByName(xsltStylesheetPtr sheet, xmlChar *name)
+xsltDecimalFormatGetByName(xsltStylesheetPtr style, xmlChar *name)
 {
     xsltDecimalFormatPtr result = NULL;
 
     if (name == NULL)
-	return sheet->decimalFormat;
+	return style->decimalFormat;
 
-    while (sheet != NULL) {
-	for (result = sheet->decimalFormat->next;
+    while (style != NULL) {
+	for (result = style->decimalFormat->next;
 	     result != NULL;
 	     result = result->next) {
 	    if (xmlStrEqual(name, result->name))
 		return result;
 	}
-	sheet = xsltNextImport(sheet);
+	style = xsltNextImport(style);
     }
     return result;
 }
@@ -331,9 +386,12 @@
     if (template == NULL)
 	return;
     if (template->match) xmlFree(template->match);
-    if (template->name) xmlFree(template->name);
-    if (template->nameURI) xmlFree(template->nameURI);
 /*
+*   NOTE: @name and @nameURI are put into the string dict now.
+*   if (template->name) xmlFree(template->name);
+*   if (template->nameURI) xmlFree(template->nameURI);
+*/
+/*
     if (template->mode) xmlFree(template->mode);
     if (template->modeURI) xmlFree(template->modeURI);
  */
@@ -359,69 +417,310 @@
     }
 }
 
+#ifdef XSLT_REFACTORED
+
+static void
+xsltFreeNsAliasList(xsltNsAliasPtr item)
+{
+    xsltNsAliasPtr tmp;
+    
+    while (item) {
+	tmp = item;
+	item = item->next;
+	xmlFree(tmp);
+    } 
+    return;
+}
+
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+static void
+xsltFreeNamespaceMap(xsltNsMapPtr item)
+{
+    xsltNsMapPtr tmp;
+    
+    while (item) {
+	tmp = item;
+	item = item->next;
+	xmlFree(tmp);
+    } 
+    return;
+}
+
+static xsltNsMapPtr
+xsltNewNamespaceMapItem(xsltCompilerCtxtPtr cctxt,
+			xmlDocPtr doc,
+			xmlNsPtr ns,
+			xmlNodePtr elem)
+{
+    xsltNsMapPtr ret;
+
+    if ((cctxt == NULL) || (doc == NULL) || (ns == NULL))
+	return(NULL);
+
+    ret = (xsltNsMapPtr) xmlMalloc(sizeof(xsltNsMap));
+    if (ret == NULL) {
+	xsltTransformError(NULL, cctxt->style, elem,
+	    "Internal error: (xsltNewNamespaceMapItem) "
+	    "memory allocation failed.\n");
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(xsltNsMap));
+    ret->doc = doc;
+    ret->ns = ns;
+    ret->origNsName = ns->href;
+    /*
+    * Store the item at current stylesheet-level.
+    */
+    if (cctxt->psData->nsMap != NULL)
+	ret->next = cctxt->psData->nsMap;
+    cctxt->psData->nsMap = ret;
+
+    return(ret);
+}
+#endif /* XSLT_REFACTORED_XSLT_NSCOMP */
+
 /**
- * xsltNewStylesheet:
+ * xsltCompilerCtxtFree:
  *
- * Create a new XSLT Stylesheet
- *
- * Returns the newly allocated xsltStylesheetPtr or NULL in case of error
+ * Free an XSLT compiler context. 
  */
-xsltStylesheetPtr
-xsltNewStylesheet(void) {
-    xsltStylesheetPtr cur;
-#ifdef XSLT_REFACTORED
-    xsltCompilerCtxtPtr cctxt;
+static void
+xsltCompilationCtxtFree(xsltCompilerCtxtPtr cctxt)
+{    
+    if (cctxt == NULL)
+	return;
+#ifdef WITH_XSLT_DEBUG_PARSING
+    xsltGenericDebug(xsltGenericDebugContext,
+	"Freeing compilation context\n");
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### Max inodes: %d\n", cctxt->maxNodeInfos);
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### Max LREs  : %d\n", cctxt->maxLREs);
 #endif
+    /*
+    * Free node-infos.
+    */
+    if (cctxt->inodeList != NULL) {
+	xsltCompilerNodeInfoPtr tmp, cur = cctxt->inodeList;
+	while (cur != NULL) {
+	    tmp = cur;
+	    cur = cur->next;
+	    xmlFree(tmp);
+	}
+    }
+    if (cctxt->tmpList != NULL)
+	xsltPointerListFree(cctxt->tmpList);
+#ifdef XSLT_REFACTORED_XPATHCOMP
+    if (cctxt->xpathCtxt != NULL)
+	xmlXPathFreeContext(cctxt->xpathCtxt);
+#endif
+    if (cctxt->nsAliases != NULL)
+	xsltFreeNsAliasList(cctxt->nsAliases);
 
-    cur = (xsltStylesheetPtr) xmlMalloc(sizeof(xsltStylesheet));
-    if (cur == NULL) {
-	xsltTransformError(NULL, NULL, NULL,
-		"xsltNewStylesheet : malloc failed\n");
+    xmlFree(cctxt);
+}
+
+/**
+ * xsltCompilerCreate:
+ *
+ * Creates an XSLT compiler context.
+ *
+ * Returns the pointer to the created xsltCompilerCtxt or
+ *         NULL in case of an internal error.
+ */
+static xsltCompilerCtxtPtr
+xsltCompilationCtxtCreate(xsltStylesheetPtr style) {
+    xsltCompilerCtxtPtr ret;
+
+    ret = (xsltCompilerCtxtPtr) xmlMalloc(sizeof(xsltCompilerCtxt));
+    if (ret == NULL) {
+	xsltTransformError(NULL, style, NULL,
+	    "xsltCompilerCreate: allocation of compiler "
+	    "context failed.\n");
 	return(NULL);
     }
-    memset(cur, 0, sizeof(xsltStylesheet));
-#ifdef XSLT_REFACTORED
+    memset(ret, 0, sizeof(xsltCompilerCtxt));
+
+    ret->errSeverity = XSLT_ERROR_SEVERITY_ERROR;
+    ret->tmpList = xsltPointerListCreate(20);
+    if (ret->tmpList == NULL) {
+	goto internal_err;
+    }
+#ifdef XSLT_REFACTORED_XPATHCOMP
     /*
-    * Create the compiler context.
+    * Create the XPath compilation context in order
+    * to speed up precompilation of XPath expressions.
     */
-    cctxt = (xsltCompilerCtxtPtr) xmlMalloc(sizeof(xsltCompilerCtxt));
-    if (cctxt == NULL) {
-	xmlFree(cur);
+    ret->xpathCtxt = xmlXPathNewContext(NULL);
+    if (ret->xpathCtxt == NULL)
+	goto internal_err;
+#endif
+    
+    return(ret);
+
+internal_err:
+    xsltCompilationCtxtFree(ret);
+    return(NULL);
+}
+
+static void
+xsltLREEffectiveNsNodesFree(xsltEffectiveNsPtr first)
+{
+    xsltEffectiveNsPtr tmp;
+
+    while (first != NULL) {
+	tmp = first;
+	first = first->nextInStore;
+	xmlFree(tmp);
+    }
+}
+
+static void
+xsltFreePrincipalStylesheetData(xsltPrincipalStylesheetDataPtr data)
+{
+    if (data == NULL)
+	return;
+
+    if (data->inScopeNamespaces != NULL) {
+	int i;
+	xsltNsListContainerPtr nsi;
+	xsltPointerListPtr list =
+	    (xsltPointerListPtr) data->inScopeNamespaces;
+
+	for (i = 0; i < list->number; i++) {
+	    /*
+	    * REVISIT TODO: Free info of in-scope namespaces.
+	    */
+	    nsi = (xsltNsListContainerPtr) list->items[i];
+	    if (nsi->list != NULL)
+		xmlFree(nsi->list);
+	    xmlFree(nsi);
+	}
+	xsltPointerListFree(list);
+	data->inScopeNamespaces = NULL;
+    }
+
+    if (data->exclResultNamespaces != NULL) {
+	int i;
+	xsltPointerListPtr list = (xsltPointerListPtr)
+	    data->exclResultNamespaces;	
+	
+	for (i = 0; i < list->number; i++)
+	    xsltPointerListFree((xsltPointerListPtr) list->items[i]);
+	
+	xsltPointerListFree(list);
+	data->exclResultNamespaces = NULL;
+    }
+
+    if (data->extElemNamespaces != NULL) {
+	xsltPointerListPtr list = (xsltPointerListPtr)
+	    data->extElemNamespaces;
+	int i;
+
+	for (i = 0; i < list->number; i++)
+	    xsltPointerListFree((xsltPointerListPtr) list->items[i]);
+
+	xsltPointerListFree(list);
+	data->extElemNamespaces = NULL;
+    }
+    if (data->effectiveNs) {
+	xsltLREEffectiveNsNodesFree(data->effectiveNs);
+	data->effectiveNs = NULL;
+    }
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    xsltFreeNamespaceMap(data->nsMap);
+#endif
+    xmlFree(data);
+}
+
+static xsltPrincipalStylesheetDataPtr
+xsltNewPrincipalStylesheetData(void)
+{
+    xsltPrincipalStylesheetDataPtr ret;
+
+    ret = (xsltPrincipalStylesheetDataPtr)
+	xmlMalloc(sizeof(xsltPrincipalStylesheetData));
+    if (ret == NULL) {
 	xsltTransformError(NULL, NULL, NULL,
-		"xsltNewStylesheet : malloc of compilation context failed\n");
+	    "xsltNewPrincipalStylesheetData: memory allocation failed.\n");
 	return(NULL);
     }
-    memset(cctxt, 0, sizeof(xsltCompilerCtxt));
-    cur->compCtxt = (void *) cctxt;
-    cctxt->sheet = cur;
-#endif
+    memset(ret, 0, sizeof(xsltPrincipalStylesheetData));
+    
     /*
-    * TODO: This here seems to be the best place where to create
-    *   the compilation context, right?
+    * Global list of in-scope namespaces.
+    */    
+    ret->inScopeNamespaces = xsltPointerListCreate(-1);
+    if (ret->inScopeNamespaces == NULL)
+	goto internal_err;
+    /*
+    * Global list of excluded result ns-decls.
     */
-    	    
-    cur->omitXmlDeclaration = -1;
-    cur->standalone = -1;
-    cur->decimalFormat = xsltNewDecimalFormat(NULL);
-    cur->indent = -1;
-    cur->errors = 0;
-    cur->warnings = 0;
-    cur->exclPrefixNr = 0;
-    cur->exclPrefixMax = 0;
-    cur->exclPrefixTab = NULL;
-    cur->extInfos = NULL;
-    cur->extrasNr = 0;
-    cur->internalized = 1;
-    cur->literal_result = 0;
-    cur->dict = xmlDictCreate();
+    ret->exclResultNamespaces = xsltPointerListCreate(-1);
+    if (ret->exclResultNamespaces == NULL)
+	goto internal_err;
+    /*
+    * Global list of extension instruction namespace names.
+    */    
+    ret->extElemNamespaces = xsltPointerListCreate(-1);
+    if (ret->extElemNamespaces == NULL)
+	goto internal_err;
+
+    return(ret);
+
+internal_err:
+
+    return(NULL);
+}
+
+#endif
+
+/**
+ * xsltNewStylesheet:
+ *
+ * Create a new XSLT Stylesheet
+ *
+ * Returns the newly allocated xsltStylesheetPtr or NULL in case of error
+ */
+xsltStylesheetPtr
+xsltNewStylesheet(void) {
+    xsltStylesheetPtr ret = NULL;    
+
+    ret = (xsltStylesheetPtr) xmlMalloc(sizeof(xsltStylesheet));
+    if (ret == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltNewStylesheet : malloc failed\n");
+	goto internal_err;
+    }
+    memset(ret, 0, sizeof(xsltStylesheet));
+
+    ret->omitXmlDeclaration = -1;
+    ret->standalone = -1;
+    ret->decimalFormat = xsltNewDecimalFormat(NULL);
+    ret->indent = -1;
+    ret->errors = 0;
+    ret->warnings = 0;
+    ret->exclPrefixNr = 0;
+    ret->exclPrefixMax = 0;
+    ret->exclPrefixTab = NULL;
+    ret->extInfos = NULL;
+    ret->extrasNr = 0;
+    ret->internalized = 1;
+    ret->literal_result = 0;
+    ret->dict = xmlDictCreate();
 #ifdef WITH_XSLT_DEBUG
     xsltGenericDebug(xsltGenericDebugContext,
-                     "creating dictionary for stylesheet\n");
+	"creating dictionary for stylesheet\n");
 #endif
 
     xsltInit();
 
-    return(cur);
+    return(ret);
+
+internal_err:
+    if (ret != NULL)
+	xsltFreeStylesheet(ret);
+    return(NULL);
 }
 
 /**
@@ -495,149 +794,194 @@
 
 /**
  * xsltFreeStylesheetList:
- * @sheet:  an XSLT stylesheet list
+ * @style:  an XSLT stylesheet list
  *
- * Free up the memory allocated by the list @sheet
+ * Free up the memory allocated by the list @style
  */
 static void
-xsltFreeStylesheetList(xsltStylesheetPtr sheet) {
+xsltFreeStylesheetList(xsltStylesheetPtr style) {
     xsltStylesheetPtr next;
 
-    while (sheet != NULL) {
-	next = sheet->next;
-	xsltFreeStylesheet(sheet);
-	sheet = next;
+    while (style != NULL) {
+	next = style->next;
+	xsltFreeStylesheet(style);
+	style = next;
     }
 }
 
-#ifdef XSLT_REFACTORED
 /**
- * xsltFreeInScopeNamespaces:
- * @sheet:  an XSLT stylesheet
+ * xsltCleanupStylesheetTree:
  *
- * Frees the list of in-scope namespace lists.
+ * @doc: the document-node
+ * @node: the element where the stylesheet is rooted at
+ *
+ * Actually @node need not be the document-element, but
+ * currently Libxslt does not support embedeed stylesheets.
+ *
+ * Returns 0 if OK, -1 on API or internal errors.
  */
-static void
-xsltFreeInScopeNamespaces(xsltStylesheetPtr sheet)
-{
-    if (sheet->inScopeNamespaces == NULL)
-	return;
-    else {
-	int i;
-	xsltNsListPtr nsi;
-	xsltPointerListPtr list = sheet->inScopeNamespaces;
+static int
+xsltCleanupStylesheetTree(xmlDocPtr doc, xmlNodePtr rootElem)
+{    
+#if 0 /* TODO: Currently disabled, since probably not needed. */
+    xmlNodePtr cur;
 
-	for (i = 0; i < list->number; i++) {
+    if ((doc == NULL) || (rootElem == NULL) ||
+	(rootElem->type != XML_ELEMENT_NODE) ||
+	(doc != rootElem->doc))
+	return(-1);
+
+    /*
+    * Cleanup was suggested by Aleksey Sanin:
+    * Clear the PSVI field to avoid problems if the
+    * node-tree of the stylesheet is intended to be used for
+    * further processing by the user (e.g. for compiling it
+    * once again - although not recommended).
+    */
+
+    cur = rootElem;
+    while (cur != NULL) {
+	if (cur->type == XML_ELEMENT_NODE) {
 	    /*
-	    * REVISIT TODO: Free info of in-scope namespaces.
+	    * Clear the PSVI field.
 	    */
-	    nsi = (xsltNsListPtr) list->items[i];
-	    if (nsi->list != NULL)
-		xmlFree(nsi->list);
-	    xmlFree(nsi);
+	    cur->psvi = NULL;
+	    if (cur->children) {
+		cur = cur->children;
+		continue;
+	    }
 	}
-	xsltPointerListFree(list);
-	sheet->inScopeNamespaces = NULL;
-    }
-    return;
-}
 
-static void
-xsltCompilerCtxtFree(xsltCompilerCtxtPtr cctxt)
-{    
-    if (cctxt == NULL)
-	return;
-    /*
-    * Free node-infos.
-    */
-    if (cctxt->inodeList != NULL) {
-	xsltCompilerNodeInfoPtr tmp, cur = cctxt->inodeList;
-	while (cur != NULL) {
-	    tmp = cur;
+leave_node:
+	if (cur == rootElem)
+	    break;
+	if (cur->next != NULL)
 	    cur = cur->next;
-	    xmlFree(tmp);
+	else {
+	    cur = cur->parent;
+	    if (cur == NULL)
+		break;
+	    goto leave_node;
 	}
     }
-    xmlFree(cctxt);
+#endif /* #if 0 */
+    return(0);
 }
-#endif
 
 /**
  * xsltFreeStylesheet:
- * @sheet:  an XSLT stylesheet
+ * @style:  an XSLT stylesheet
  *
- * Free up the memory allocated by @sheet
+ * Free up the memory allocated by @style
  */
 void
-xsltFreeStylesheet(xsltStylesheetPtr sheet)
+xsltFreeStylesheet(xsltStylesheetPtr style)
 {
-    if (sheet == NULL)
+    if (style == NULL)
         return;
-
-    xsltFreeKeys(sheet);
-    xsltFreeExts(sheet);
-    xsltFreeTemplateHashes(sheet);
-    xsltFreeDecimalFormatList(sheet);
-    xsltFreeTemplateList(sheet->templates);
-    xsltFreeAttributeSetsHashes(sheet);
-    xsltFreeNamespaceAliasHashes(sheet);
+    
 #ifdef XSLT_REFACTORED
-    if (sheet->inScopeNamespaces != NULL)
-	xsltFreeInScopeNamespaces(sheet);
-#endif
-    xsltFreeStyleDocuments(sheet);
-    xsltFreeStylePreComps(sheet);
-    xsltShutdownExts(sheet);
-    if (sheet->doc != NULL)
-        xmlFreeDoc(sheet->doc);
-    if (sheet->variables != NULL)
-        xsltFreeStackElemList(sheet->variables);
-    if (sheet->cdataSection != NULL)
-        xmlHashFree(sheet->cdataSection, NULL);
-    if (sheet->stripSpaces != NULL)
-        xmlHashFree(sheet->stripSpaces, NULL);
-    if (sheet->nsHash != NULL)
-        xmlHashFree(sheet->nsHash, NULL);
+    /*
+    * Start with a cleanup of the main stylesheet's doc.
+    */
+    if ((style->principal == style) && (style->doc))
+	xsltCleanupStylesheetTree(style->doc,
+	    xmlDocGetRootElement(style->doc));
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    /*
+    * Restore changed ns-decls before freeing the document.
+    */
+    if ((style->doc != NULL) &&
+	XSLT_HAS_INTERNAL_NSMAP(style))
+    {
+	xsltRestoreDocumentNamespaces(XSLT_GET_INTERNAL_NSMAP(style),
+	    style->doc);	
+    }
+#endif /* XSLT_REFACTORED_XSLT_NSCOMP */
+#else
+    /*
+    * Start with a cleanup of the main stylesheet's doc.
+    */
+    if ((style->parent == NULL) && (style->doc))
+	xsltCleanupStylesheetTree(style->doc,
+	    xmlDocGetRootElement(style->doc));
+#endif /* XSLT_REFACTORED */
 
-    if (sheet->exclPrefixTab != NULL)
-        xmlFree(sheet->exclPrefixTab);
-    if (sheet->method != NULL)
-        xmlFree(sheet->method);
-    if (sheet->methodURI != NULL)
-        xmlFree(sheet->methodURI);
-    if (sheet->version != NULL)
-        xmlFree(sheet->version);
-    if (sheet->encoding != NULL)
-        xmlFree(sheet->encoding);
-    if (sheet->doctypePublic != NULL)
-        xmlFree(sheet->doctypePublic);
-    if (sheet->doctypeSystem != NULL)
-        xmlFree(sheet->doctypeSystem);
-    if (sheet->mediaType != NULL)
-        xmlFree(sheet->mediaType);
-    if (sheet->attVTs)
-        xsltFreeAVTList(sheet->attVTs);
+    xsltFreeKeys(style);
+    xsltFreeExts(style);
+    xsltFreeTemplateHashes(style);
+    xsltFreeDecimalFormatList(style);
+    xsltFreeTemplateList(style->templates);
+    xsltFreeAttributeSetsHashes(style);
+    xsltFreeNamespaceAliasHashes(style);
+    xsltFreeStylePreComps(style);
+    /*
+    * Free documents of all included stylsheet modules of this
+    * stylesheet level.
+    */
+    xsltFreeStyleDocuments(style);
+    /*
+    * TODO: Best time to shutdown extension stuff?
+    */
+    xsltShutdownExts(style);
+       
+    if (style->variables != NULL)
+        xsltFreeStackElemList(style->variables);
+    if (style->cdataSection != NULL)
+        xmlHashFree(style->cdataSection, NULL);
+    if (style->stripSpaces != NULL)
+        xmlHashFree(style->stripSpaces, NULL);
+    if (style->nsHash != NULL)
+        xmlHashFree(style->nsHash, NULL);
+    if (style->exclPrefixTab != NULL)
+        xmlFree(style->exclPrefixTab);
+    if (style->method != NULL)
+        xmlFree(style->method);
+    if (style->methodURI != NULL)
+        xmlFree(style->methodURI);
+    if (style->version != NULL)
+        xmlFree(style->version);
+    if (style->encoding != NULL)
+        xmlFree(style->encoding);
+    if (style->doctypePublic != NULL)
+        xmlFree(style->doctypePublic);
+    if (style->doctypeSystem != NULL)
+        xmlFree(style->doctypeSystem);
+    if (style->mediaType != NULL)
+        xmlFree(style->mediaType);
+    if (style->attVTs)
+        xsltFreeAVTList(style->attVTs);
+    if (style->imports != NULL)
+        xsltFreeStylesheetList(style->imports);
 
-    if (sheet->imports != NULL)
-        xsltFreeStylesheetList(sheet->imports);
 #ifdef XSLT_REFACTORED
     /*
-    * TODO: Just a paranoid cleanup, in case the compilation
-    *   context was not freed after the compilation.
+    * If this is the principal stylesheet, then
+    * free its internal data.
     */
-    if (sheet->compCtxt != NULL) {
-	xsltCompilerCtxtFree((xsltCompilerCtxtPtr) sheet->compCtxt);
+    if (style->principal == style) {
+	if (style->principalData) {
+	    xsltFreePrincipalStylesheetData(style->principalData);
+	    style->principalData = NULL;
+	}
+    }    
+#endif
+    /*
+    * Better to free the main document of this stylesheet level
+    * at the end - so here.
+    */
+    if (style->doc != NULL) {	
+        xmlFreeDoc(style->doc);
     }
-#endif
 
 #ifdef WITH_XSLT_DEBUG
     xsltGenericDebug(xsltGenericDebugContext,
                      "freeing dictionary from stylesheet\n");
 #endif
-    xmlDictFree(sheet->dict);
+    xmlDictFree(style->dict);
 
-    memset(sheet, -1, sizeof(xsltStylesheet));
-    xmlFree(sheet);
+    memset(style, -1, sizeof(xsltStylesheet));
+    xmlFree(style);
 }
 
 /************************************************************************
@@ -646,6 +990,11 @@
  *									*
  ************************************************************************/
 
+#ifdef XSLT_REFACTORED
+    /*
+    * This is now performed in an optimized way in xsltParseXSLTTemplate.
+    */
+#else
 /**
  * xsltGetInheritedNsList:
  * @style:  the stylesheet
@@ -676,7 +1025,7 @@
     *  	<xsl:stylesheet ...    
     * </doc>
     * Will have foo="urn:test:foo" in the list.
-    * Is this a bug?
+    * Is this OK?
     */
 
     if ((style == NULL) || (template == NULL) || (node == NULL) ||
@@ -688,6 +1037,7 @@
             while (cur != NULL) {
 		if (xmlStrEqual(cur->href, XSLT_NAMESPACE))
 		    goto skip_ns;
+
 		if ((cur->prefix != NULL) &&
 		    (xsltCheckExtPrefix(style, cur->prefix)))
 		    goto skip_ns;
@@ -751,6 +1101,7 @@
     }
     return (nbns);
 }
+#endif /* else of XSLT_REFACTORED */
 
 /**
  * xsltParseStylesheetOutput:
@@ -842,7 +1193,7 @@
         } else {
 	    xsltTransformError(NULL, style, cur,
                              "invalid value for standalone: %s\n", prop);
-            if (style != NULL) style->warnings++;
+            style->errors++;
         }
         xmlFree(prop);
     }
@@ -856,7 +1207,7 @@
         } else {
 	    xsltTransformError(NULL, style, cur,
                              "invalid value for indent: %s\n", prop);
-            if (style != NULL) style->warnings++;
+            style->errors++;
         }
         xmlFree(prop);
     }
@@ -871,7 +1222,7 @@
 	    xsltTransformError(NULL, style, cur,
                              "invalid value for omit-xml-declaration: %s\n",
                              prop);
-            if (style != NULL) style->warnings++;
+            style->errors++;
         }
         xmlFree(prop);
     }
@@ -894,34 +1245,51 @@
             while ((*end != 0) && (!IS_BLANK(*end)))
                 end++;
             element = xmlStrndup(element, end - element);
-            if (element) {
-		const xmlChar *URI;
+            if (element) {		
 #ifdef WITH_XSLT_DEBUG_PARSING
                 xsltGenericDebug(xsltGenericDebugContext,
                                  "add cdata section output element %s\n",
                                  element);
 #endif
+		if (xmlValidateQName(BAD_CAST element, 0) != 0) {
+		    xsltTransformError(NULL, style, cur,
+			"Attribute 'cdata-section-elements': The value "
+			"'%s' is not a valid QName.\n", element);
+		    xmlFree(element);
+		    style->errors++;
+		} else {
+		    const xmlChar *URI;
 
-		URI = xsltGetQNameURI(cur, &element);
-		if (element == NULL) {
-		    if (style != NULL) style->errors++;
-		} else {
-		    xmlNsPtr ns;
-		    
-		    xmlHashAddEntry2(style->cdataSection, element, URI,
-			             (void *) "cdata");
-		    /*
-		     * if prefix is NULL, we must check whether it's
-		     * necessary to also put in the name of the default
-		     * namespace.
-		     */
-		    if (URI == NULL) {
-		        ns = xmlSearchNs(style->doc, cur, NULL);
-			if (ns != NULL)  
-			    xmlHashAddEntry2(style->cdataSection, element,
-			        ns->href, (void *) "cdata");
+		    URI = xsltGetQNameURI(cur, &element);
+		    if (element == NULL) {
+			/*
+			* TODO: We'll report additionally an error
+			*  via the stylesheet's error handling.			
+			*/
+			xsltTransformError(NULL, style, cur,
+			    "Attribute 'cdata-section-elements': The value "
+			    "'%s' is not a valid QName.\n", element);
+			style->errors++;
+		    } else {
+			xmlNsPtr ns;
+			
+			/*
+			* XSLT-1.0 "Each QName is expanded into an
+			*  expanded-name using the namespace declarations in
+			*  effect on the xsl:output element in which the QName
+			*  occurs; if there is a default namespace, it is used
+			*  for QNames that do not have a prefix"
+			* NOTE: Fix of bug #339570.
+			*/
+			if (URI == NULL) {
+			    ns = xmlSearchNs(style->doc, cur, NULL);
+			    if (ns != NULL)
+				URI = ns->href;
+			}		   
+			xmlHashAddEntry2(style->cdataSection, element, URI,
+			    (void *) "cdata");
+			xmlFree(element);
 		    }
-		    xmlFree(element);
 		}
             }
             element = end;
@@ -935,6 +1303,9 @@
 	    xmlFree(style->mediaType);
 	style->mediaType = prop;
     }
+    if (cur->children != NULL) {
+	xsltParseContentError(style, cur->children);
+    }
 }
 
 /**
@@ -1046,6 +1417,9 @@
 	if (format->patternSeparator != NULL) xmlFree(format->patternSeparator);
 	format->patternSeparator  = prop;
     }
+    if (cur->children != NULL) {
+	xsltParseContentError(style, cur->children);
+    }
 }
 
 /**
@@ -1106,23 +1480,27 @@
 	element = end;
     }
     xmlFree(elements);
+    if (cur->children != NULL) {
+	xsltParseContentError(style, cur->children);
+    }
 }
 
+#ifdef XSLT_REFACTORED
+#else
 /**
  * xsltParseStylesheetExtPrefix:
  * @style:  the XSLT stylesheet
  * @template:  the "extension-element-prefixes" prefix
  *
  * parse an XSLT stylesheet's "extension-element-prefix" attribute value
- * and register the namespaces of extension elements.
+ * and register the namespaces of extension instruction.
  * SPEC "A namespace is designated as an extension namespace by using
  *   an extension-element-prefixes attribute on:
  *   1) an xsl:stylesheet element
- *   2) TODO: an xsl:extension-element-prefixes attribute on a
+ *   2) an xsl:extension-element-prefixes attribute on a
  *      literal result element 
- *   3) TODO: an extension element."
+ *   3) an extension instruction."
  */
-
 static void
 xsltParseStylesheetExtPrefix(xsltStylesheetPtr style, xmlNodePtr cur,
 			     int isXsltElem) {
@@ -1137,7 +1515,7 @@
 	prefixes = xmlGetNsProp(cur,
 	    (const xmlChar *)"extension-element-prefixes", NULL);
     } else {
-	/* For literal result elements and extension elements. */
+	/* For literal result elements and extension instructions. */
 	prefixes = xmlGetNsProp(cur,
 	    (const xmlChar *)"extension-element-prefixes", XSLT_NAMESPACE);
     }
@@ -1178,6 +1556,7 @@
     }
     xmlFree(prefixes);
 }
+#endif /* else of XSLT_REFACTORED */
 
 /**
  * xsltParseStylesheetStripSpace:
@@ -1237,8 +1616,13 @@
 	element = end;
     }
     xmlFree(elements);
+    if (cur->children != NULL) {
+	xsltParseContentError(style, cur->children);
+    }
 }
 
+#ifdef XSLT_REFACTORED
+#else
 /**
  * xsltParseStylesheetExcludePrefix:
  * @style:  the XSLT stylesheet
@@ -1307,55 +1691,584 @@
     xmlFree(prefixes);
     return(nb);
 }
+#endif /* else of XSLT_REFACTORED */
 
 #ifdef XSLT_REFACTORED
 
-static xsltCompilerNodeInfoPtr
+/*
+* xsltTreeEnsureXMLDecl:
+* @doc: the doc
+* 
+* BIG NOTE:
+*  This was copy&pasted from Libxml2's xmlTreeEnsureXMLDecl() in "tree.c".
+* Ensures that there is an XML namespace declaration on the doc.
+* 
+* Returns the XML ns-struct or NULL on API and internal errors.
+*/
+static xmlNsPtr
+xsltTreeEnsureXMLDecl(xmlDocPtr doc)
+{
+    if (doc == NULL)
+	return (NULL);
+    if (doc->oldNs != NULL)
+	return (doc->oldNs);
+    {
+	xmlNsPtr ns;
+	ns = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
+	if (ns == NULL) {
+	    xmlGenericError(xmlGenericErrorContext,
+		"xsltTreeEnsureXMLDecl: Failed to allocate "
+		"the XML namespace.\n");	
+	    return (NULL);
+	}
+	memset(ns, 0, sizeof(xmlNs));
+	ns->type = XML_LOCAL_NAMESPACE;
+	/*
+	* URGENT TODO: revisit this.
+	*/
+#ifdef LIBXML_NAMESPACE_DICT
+	if (doc->dict)
+	    ns->href = xmlDictLookup(doc->dict, XML_XML_NAMESPACE, -1);
+	else
+	    ns->href = xmlStrdup(XML_XML_NAMESPACE);
+#else
+	ns->href = xmlStrdup(XML_XML_NAMESPACE); 
+#endif
+	ns->prefix = xmlStrdup((const xmlChar *)"xml");
+	doc->oldNs = ns;
+	return (ns);
+    }
+}
+
+/*
+* xsltTreeAcquireStoredNs:
+* @doc: the doc
+* @nsName: the namespace name
+* @prefix: the prefix
+* 
+* BIG NOTE:
+*  This was copy&pasted from Libxml2's xmlDOMWrapStoreNs() in "tree.c".
+* Creates or reuses an xmlNs struct on doc->oldNs with
+* the given prefix and namespace name.
+* 
+* Returns the aquired ns struct or NULL in case of an API
+*         or internal error.
+*/
+static xmlNsPtr
+xsltTreeAcquireStoredNs(xmlDocPtr doc,
+			const xmlChar *nsName,
+			const xmlChar *prefix)
+{
+    xmlNsPtr ns;
+
+    if (doc == NULL)
+	return (NULL);
+    if (doc->oldNs != NULL)
+	ns = doc->oldNs;
+    else
+	ns = xsltTreeEnsureXMLDecl(doc);
+    if (ns == NULL)
+	return (NULL);
+    if (ns->next != NULL) {
+	/* Reuse. */
+	ns = ns->next;
+	while (ns != NULL) {
+	    if ((ns->prefix == NULL) != (prefix == NULL)) {
+		/* NOP */
+	    } else if (prefix == NULL) {
+		if (xmlStrEqual(ns->href, nsName))
+		    return (ns);
+	    } else {
+		if ((ns->prefix[0] == prefix[0]) &&
+		     xmlStrEqual(ns->prefix, prefix) &&
+		     xmlStrEqual(ns->href, nsName))
+		    return (ns);
+		
+	    }
+	    if (ns->next == NULL)
+		break;
+	    ns = ns->next;
+	}
+    }
+    /* Create. */
+    ns->next = xmlNewNs(NULL, nsName, prefix);
+    return (ns->next);
+}
+
+/**
+ * xsltLREBuildEffectiveNs:
+ *
+ * Apply ns-aliasing on the namespace of the given @elem and
+ * its attributes.
+ */
+static int
+xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt,
+			xmlNodePtr elem)
+{
+    xmlNsPtr ns;
+    xsltNsAliasPtr alias;
+
+    if ((cctxt == NULL) || (elem == NULL))
+	return(-1);
+    if ((cctxt->nsAliases == NULL) || (! cctxt->hasNsAliases))
+	return(0);
+
+    alias = cctxt->nsAliases;    		
+    while (alias != NULL) {
+	if ( /* If both namespaces are NULL... */
+	    ( (elem->ns == NULL) &&
+	    ((alias->literalNs == NULL) ||
+	    (alias->literalNs->href == NULL)) ) ||
+	    /* ... or both namespace are equal */
+	    ( (elem->ns != NULL) &&
+	    (alias->literalNs != NULL) &&
+	    xmlStrEqual(elem->ns->href, alias->literalNs->href) ) )
+	{
+	    if ((alias->targetNs != NULL) &&
+		(alias->targetNs->href != NULL))
+	    {
+		/*
+		* Convert namespace.
+		*/
+		if (elem->doc == alias->docOfTargetNs) {
+		    /*
+		    * This is the nice case: same docs.
+		    * This will eventually assign a ns-decl which
+		    * is shadowed, but this has no negative effect on
+		    * the generation of the result tree.
+		    */
+		    elem->ns = alias->targetNs;
+		} else {
+		    /*
+		    * This target xmlNs originates from a different
+		    * stylesheet tree. Try to locate it in the
+		    * in-scope namespaces.
+		    * OPTIMIZE TODO: Use the compiler-node-info inScopeNs.
+		    */
+		    ns = xmlSearchNs(elem->doc, elem,
+			alias->targetNs->prefix);		    
+		    /*
+		    * If no matching ns-decl found, then assign a
+		    * ns-decl stored in xmlDoc.
+		    */
+		    if ((ns == NULL) ||
+			(! xmlStrEqual(ns->href, alias->targetNs->href)))
+		    {
+			/*
+			* BIG NOTE: The use of xsltTreeAcquireStoredNs()
+			*  is not very efficient, but currently I don't
+			*  see an other way of *safely* changing a node's
+			*  namespace, since the xmlNs struct in
+			*  alias->targetNs might come from an other
+			*  stylesheet tree. So we need to anchor it in the
+			*  current document, without adding it to the tree,
+			*  which would otherwise change the in-scope-ns
+			*  semantic of the tree.
+			*/
+			ns = xsltTreeAcquireStoredNs(elem->doc,
+			    alias->targetNs->href,
+			    alias->targetNs->prefix);
+			
+			if (ns == NULL) {
+			    xsltTransformError(NULL, cctxt->style, elem,
+				"Internal error in "
+				"xsltLREBuildEffectiveNs(): "
+				"failed to acquire a stored "
+				"ns-declaration.\n");
+			    cctxt->style->errors++;
+			    return(-1);
+			    
+			}
+		    }
+		    elem->ns = ns;
+		}		   
+	    } else {
+		/*
+		* Move into or leave in the NULL namespace.
+		*/
+		elem->ns = NULL;
+	    }
+	    break;
+	}
+	alias = alias->next;
+    }
+    /*
+    * Same with attributes of literal result elements.
+    */
+    if (elem->properties != NULL) {
+	xmlAttrPtr attr = elem->properties;
+	
+	while (attr != NULL) {
+	    if (attr->ns == NULL) {
+		attr = attr->next;
+		continue;
+	    }
+	    alias = cctxt->nsAliases;
+	    while (alias != NULL) {
+		if ( /* If both namespaces are NULL... */
+		    ( (elem->ns == NULL) &&
+		    ((alias->literalNs == NULL) ||
+		    (alias->literalNs->href == NULL)) ) ||
+		    /* ... or both namespace are equal */
+		    ( (elem->ns != NULL) &&
+		    (alias->literalNs != NULL) &&
+		    xmlStrEqual(elem->ns->href, alias->literalNs->href) ) )
+		{
+		    if ((alias->targetNs != NULL) &&
+			(alias->targetNs->href != NULL))
+		    {		    
+			if (elem->doc == alias->docOfTargetNs) {
+			    elem->ns = alias->targetNs;
+			} else {
+			    ns = xmlSearchNs(elem->doc, elem,
+				alias->targetNs->prefix);
+			    if ((ns == NULL) ||
+				(! xmlStrEqual(ns->href, alias->targetNs->href)))
+			    {
+				ns = xsltTreeAcquireStoredNs(elem->doc,
+				    alias->targetNs->href,
+				    alias->targetNs->prefix);
+				
+				if (ns == NULL) {
+				    xsltTransformError(NULL, cctxt->style, elem,
+					"Internal error in "
+					"xsltLREBuildEffectiveNs(): "
+					"failed to acquire a stored "
+					"ns-declaration.\n");
+				    cctxt->style->errors++;
+				    return(-1);
+				    
+				}
+			    }
+			    elem->ns = ns;
+			}
+		    } else {
+		    /*
+		    * Move into or leave in the NULL namespace.
+			*/
+			elem->ns = NULL;
+		    }
+		    break;
+		}
+		alias = alias->next;
+	    }
+	    
+	    attr = attr->next;
+	}
+    }
+    return(0);
+}
+
+/**
+ * xsltLREBuildEffectiveNsNodes:
+ *
+ * Computes the effective namespaces nodes for a literal result
+ * element.
+ * @effectiveNs is the set of effective ns-nodes
+ *  on the literal result element, which will be added to the result
+ *  element if not already existing in the result tree.
+ *  This means that excluded namespaces (via exclude-result-prefixes,
+ *  extension-element-prefixes and the XSLT namespace) not added
+ *  to the set.
+ *  Namespace-aliasing was applied on the @effectiveNs.
+ */
+static int
+xsltLREBuildEffectiveNsNodes(xsltCompilerCtxtPtr cctxt,
+			     xsltStyleItemLRElementInfoPtr item,
+			     xmlNodePtr elem,
+			     int isLRE)
+{
+    xmlNsPtr ns, tmpns;
+    xsltEffectiveNsPtr effNs, lastEffNs = NULL;
+    int i, j, holdByElem;
+    xsltPointerListPtr extElemNs = cctxt->inode->extElemNs;
+    xsltPointerListPtr exclResultNs = cctxt->inode->exclResultNs;
+
+    if ((cctxt == NULL) || (cctxt->inode == NULL) || (elem == NULL) ||
+	(item == NULL) || (item->effectiveNs != NULL))
+	return(-1);
+
+    if (item->inScopeNs == NULL)    
+	return(0);
+
+    extElemNs = cctxt->inode->extElemNs;
+    exclResultNs = cctxt->inode->exclResultNs;
+
+    for (i = 0; i < item->inScopeNs->number; i++) {
+	ns = item->inScopeNs->list[i];
+	/*
+	* Skip namespaces designated as excluded namespaces
+	* -------------------------------------------------
+	*
+	* XSLT-20 TODO: In XSLT 2.0 we need to keep namespaces
+	*  which are target namespaces of namespace-aliases
+	*  regardless if designated as excluded.
+	*
+	* Exclude the XSLT namespace.
+	*/
+	if (xmlStrEqual(ns->href, XSLT_NAMESPACE))
+	    goto skip_ns;
+	
+	/*
+	* Exclude excluded result namespaces.
+	*/
+	if (exclResultNs) {
+	    for (j = 0; j < exclResultNs->number; j++)
+		if (xmlStrEqual(ns->href, BAD_CAST exclResultNs->items[j]))
+		    goto skip_ns;
+	}
+	/*
+	* Exclude extension-element namespaces.
+	*/
+	if (extElemNs) {
+	    for (j = 0; j < extElemNs->number; j++)
+		if (xmlStrEqual(ns->href, BAD_CAST extElemNs->items[j]))
+		    goto skip_ns;
+	}
+	/*
+	* OPTIMIZE TODO: This information may not be needed.
+	*/
+	if (isLRE && (elem->nsDef != NULL)) {
+	    holdByElem = 0;
+	    tmpns = elem->nsDef;
+	    do {
+		if (tmpns == ns) {
+		    holdByElem = 1;
+		    break;
+		}
+		tmpns = tmpns->next;
+	    } while (tmpns != NULL);	    
+	} else
+	    holdByElem = 0;
+	/*
+	* Apply namespace aliasing
+	* ------------------------
+	* 
+	* NOTE: The ns-aliasing machanism is non-cascading.
+	*  (checked with Saxon, Xalan and MSXML .NET).
+	* URGENT TODO: is style->nsAliases the effective list of
+	*  ns-aliases, or do we need to lookup the whole
+	*  import-tree?
+	* TODO: Get rid of import-tree lookup.
+	*/
+	if (cctxt->hasNsAliases) {
+	    xsltNsAliasPtr alias = cctxt->nsAliases;
+	    do {
+		/*
+		* TODO: What to do with xmlns="" ?
+		*/
+		if ((alias->literalNs != NULL) &&
+		    (xmlStrEqual(alias->literalNs->href, ns->href)))
+		{
+		    /*
+		    * Recognized as an namespace alias; convert it to
+		    * the target namespace.
+		    */
+		    ns = alias->literalNs;
+		    break;
+		}
+		alias = alias->next;
+	    } while (alias != NULL);		
+	}
+	
+	/*
+	* Add the effective namespace declaration.
+	*/
+	effNs = (xsltEffectiveNsPtr) xmlMalloc(sizeof(xsltEffectiveNs));
+	if (effNs == NULL) {
+	    xsltTransformError(NULL, cctxt->style, elem,
+		"Internal error in xsltLREBuildEffectiveNs(): "
+		"failed to allocate memory.\n");
+	    cctxt->style->errors++;
+	    return(-1);
+	}
+	if (cctxt->psData->effectiveNs == NULL) {
+	    cctxt->psData->effectiveNs = effNs;
+	    effNs->nextInStore = NULL;	 
+	} else {
+	    effNs->nextInStore = cctxt->psData->effectiveNs;
+	    cctxt->psData->effectiveNs = effNs;
+	}
+
+	effNs->next = NULL;
+	effNs->prefix = ns->prefix;
+	effNs->nsName = ns->href;
+	effNs->holdByElem = holdByElem;
+	
+	if (lastEffNs == NULL)
+	    item->effectiveNs = effNs;
+	else
+	    lastEffNs->next = effNs;
+	lastEffNs = effNs;
+	
+skip_ns:
+	{}
+    }
+    return(0);
+}
+
+
+/**
+ * xsltLREInfoCreate:
+ *
+ * @isLRE: indicates if the given @elem is a literal result element
+ *
+ * Creates a new info for a literal result element.
+ */
+static int
+xsltLREInfoCreate(xsltCompilerCtxtPtr cctxt,
+		  xmlNodePtr elem,
+		  int isLRE)
+{
+    xsltStyleItemLRElementInfoPtr item;
+
+    if ((cctxt == NULL) || (cctxt->inode == NULL))
+	return(-1);
+
+    item = (xsltStyleItemLRElementInfoPtr)
+	xmlMalloc(sizeof(xsltStyleItemLRElementInfo));
+    if (item == NULL) {
+	xsltTransformError(NULL, cctxt->style, NULL,
+	    "Internal error in xsltLREInfoCreate(): "
+	    "memory allocation failed.\n");
+	cctxt->style->errors++;
+	return(-1);
+    }
+    memset(item, 0, sizeof(xsltStyleItemLRElementInfo));
+    item->type = XSLT_FUNC_LITERAL_RESULT_ELEMENT;
+    /*
+    * Store it in the stylesheet.
+    */
+    item->next = cctxt->style->preComps;
+    cctxt->style->preComps = (xsltElemPreCompPtr) item;
+    /*
+    * @inScopeNs are used for execution of XPath expressions
+    *  in AVTs.
+    */
+    item->inScopeNs = cctxt->inode->inScopeNs;
+    
+    if (elem)
+	xsltLREBuildEffectiveNsNodes(cctxt, item, elem, isLRE);
+
+    cctxt->inode->litResElemInfo = item;
+    cctxt->inode->nsChanged = 0;
+    cctxt->maxLREs++;
+    return(0);
+}
+
+/*
+* xsltCompilerNodePush:
+*
+* @cctxt: the compilation context
+* @node: the node to be pushed (this can also be the doc-node)
+*
+* Returns the current node info structure or
+*         NULL in case of an internal error.
+*/
+xsltCompilerNodeInfoPtr
 xsltCompilerNodePush(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
 {    
+    xsltCompilerNodeInfoPtr inode, iprev;
+
     if ((cctxt->inode != NULL) && (cctxt->inode->next != NULL)) {	
-	cctxt->inode = cctxt->inode->next;
+	inode = cctxt->inode->next;
     } else if ((cctxt->inode == NULL) && (cctxt->inodeList != NULL)) {
-	cctxt->inode = cctxt->inodeList;	
+	inode = cctxt->inodeList;	
     } else {
 	/*
 	* Create a new node-info.
 	*/
-	cctxt->inode = (xsltCompilerNodeInfoPtr)
+	inode = (xsltCompilerNodeInfoPtr)
 	    xmlMalloc(sizeof(xsltCompilerNodeInfo));
-	if (cctxt->inode == NULL) {
-	    xsltTransformError(NULL, cctxt->sheet, NULL,
+	if (inode == NULL) {
+	    xsltTransformError(NULL, cctxt->style, NULL,
 		"xsltCompilerNodePush: malloc failed.\n");
 	    return(NULL);
 	}
-	memset(cctxt->inode, 0, sizeof(xsltCompilerNodeInfo));
+	memset(inode, 0, sizeof(xsltCompilerNodeInfo));
 	if (cctxt->inodeList == NULL)
-	    cctxt->inodeList = cctxt->inode;
+	    cctxt->inodeList = inode;
 	else {
-	    cctxt->inodeLast->next = cctxt->inode;
-	    cctxt->inode->prev = cctxt->inodeLast;
+	    cctxt->inodeLast->next = inode;
+	    inode->prev = cctxt->inodeLast;
 	}
-	cctxt->inodeLast = cctxt->inode;
-    }
-    /*
-    * REVISIT TODO: Keep the reset always complete.
-    */
+	cctxt->inodeLast = inode;
+	cctxt->maxNodeInfos++;	
+	if (cctxt->inode == NULL) {
+	    cctxt->inode = inode;
+	    /*
+	    * Create an initial literal result element info for
+	    * the root of the stylesheet.
+	    */
+	    xsltLREInfoCreate(cctxt, NULL, 0);
+	} 
+    }       
     cctxt->depth++;
-    cctxt->inode->depth = cctxt->depth;
-    cctxt->inode->templ = NULL;
-    cctxt->inode->item = NULL;
-    cctxt->inode->node = node;
+    cctxt->inode = inode;
     /*
-    * Inherit the list of in-scope namespaces.
+    * REVISIT TODO: Keep the reset always complete.    
+    * NOTE: Be carefull with the @node, since it might be
+    *  a doc-node.
     */
-    if (cctxt->inode->prev != NULL)
-	cctxt->inode->inScopeNS = cctxt->inode->prev->inScopeNS;
-    else
-	cctxt->inode->inScopeNS = NULL;
+    inode->node = node;
+    inode->depth = cctxt->depth;
+    inode->templ = NULL;
+    inode->category = XSLT_ELEMENT_CATEGORY_XSLT;
+    inode->type = 0;
+    inode->item = NULL;
+    inode->curChildType = 0;
+    inode->extContentHandled = 0;
+    inode->isRoot = 0;
     
-    return(cctxt->inode);
+    if (inode->prev != NULL) {
+	iprev = inode->prev;
+	/*
+	* Inherit the following information:
+	* ---------------------------------
+	*
+	* In-scope namespaces
+	*/
+	inode->inScopeNs = iprev->inScopeNs;
+	/*
+	* Info for literal result elements
+	*/
+	inode->litResElemInfo = iprev->litResElemInfo;
+	inode->nsChanged = iprev->nsChanged;
+	/*
+	* Excluded result namespaces
+	*/
+	inode->exclResultNs = iprev->exclResultNs;
+	/*
+	* Extension instruction namespaces
+	*/
+	inode->extElemNs = iprev->extElemNs;
+	/*
+	* Whitespace preservation
+	*/
+	inode->preserveWhitespace = iprev->preserveWhitespace;
+	/*
+	* Forwards-compatible mode
+	*/
+	inode->forwardsCompat = iprev->forwardsCompat;	
+    } else {
+	inode->inScopeNs = NULL;
+	inode->exclResultNs = NULL;
+	inode->extElemNs = NULL;
+	inode->preserveWhitespace = 0;
+	inode->forwardsCompat = 0;
+    }
+    
+    return(inode);
 }
 
+/*
+* xsltCompilerNodePop:
+*
+* @cctxt: the compilation context
+* @node: the node to be pushed (this can also be the doc-node)
+*
+* Pops the current node info.
+*/
 static void
 xsltCompilerNodePop(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
 {    
@@ -1363,47 +2276,959 @@
 	xmlGenericError(xmlGenericErrorContext,
 	    "xsltCompilerNodePop: Top-node mismatch.\n");
 	return;
-    }    	
-    if (cctxt->inode->node != node)
+    }
+    /*
+    * NOTE: Be carefull with the @node, since it might be
+    *  a doc-node.
+    */
+    if (cctxt->inode->node != node) {
 	xmlGenericError(xmlGenericErrorContext,
 	"xsltCompilerNodePop: Node mismatch.\n");
-    if (cctxt->inode->depth != cctxt->depth)
+	goto mismatch;
+    }
+    if (cctxt->inode->depth != cctxt->depth) {
 	xmlGenericError(xmlGenericErrorContext,
 	"xsltCompilerNodePop: Depth mismatch.\n");
+	goto mismatch;
+    }
     cctxt->depth--;
     cctxt->inode = cctxt->inode->prev;
+    if (cctxt->inode != NULL)
+	cctxt->inode->curChildType = 0;
+    return;
+
+mismatch:
+    {
+	const xmlChar *nsName = NULL, *name = NULL;
+	const xmlChar *infnsName = NULL, *infname = NULL;
+	
+	if (node) {
+	    if (node->type == XML_ELEMENT_NODE) {
+		name = node->name;
+		if (node->ns != NULL)
+		    nsName = node->ns->href;
+		else
+		    nsName = BAD_CAST "";
+	    } else {
+		name = BAD_CAST "#document";
+		nsName = BAD_CAST "";
+	    }
+	} else
+	    name = BAD_CAST "Not given";
+
+	if (cctxt->inode->node) {
+	    if (node->type == XML_ELEMENT_NODE) {
+		infname = cctxt->inode->node->name;
+		if (cctxt->inode->node->ns != NULL)
+		    infnsName = cctxt->inode->node->ns->href;
+		else
+		    infnsName = BAD_CAST "";
+	    } else {
+		infname = BAD_CAST "#document";
+		infnsName = BAD_CAST "";
+	    }
+	} else
+	    infname = BAD_CAST "Not given";
+
+	
+	xmlGenericError(xmlGenericErrorContext,
+	    "xsltCompilerNodePop: Given   : '%s' URI '%s'\n",
+	    name, nsName);
+	xmlGenericError(xmlGenericErrorContext,
+	    "xsltCompilerNodePop: Expected: '%s' URI '%s'\n",
+	    infname, infnsName);
+    }
 }
 
+/*
+* xsltCompilerBuildInScopeNsList:
+*
+* Create and store the list of in-scope namespaces for the given
+* node in the stylesheet. If there are no changes in the in-scope
+* namespaces then the last ns-info of the ancestor axis will be returned.
+* Compilation-time only.
+*
+* Returns the ns-info or NULL if there are no namespaces in scope.
+*/
+static xsltNsListContainerPtr
+xsltCompilerBuildInScopeNsList(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{
+    xsltNsListContainerPtr nsi = NULL;
+    xmlNsPtr *list = NULL;
+    /*
+    * Create a new ns-list for this position in the node-tree.
+    * xmlGetNsList() will return NULL, if there are no ns-decls in the
+    * tree. Note that the ns-decl for the XML namespace is not added
+    * to the resulting list; the XPath module handles the XML namespace
+    * internally.
+    */
+    list = xmlGetNsList(node->doc, node);
+    if (list == NULL)
+	return(NULL);
+    /*
+    * Create the info-structure.
+    */
+    nsi = (xsltNsListContainerPtr) xmlMalloc(sizeof(xsltNsListContainer));
+    if (nsi == NULL) {	
+	xsltTransformError(NULL, cctxt->style, NULL,
+	    "xsltCompilerBuildInScopeNsList: malloc failed.\n");
+	goto internal_err;
+    }
+    memset(nsi, 0, sizeof(xsltNsListContainer));
+    nsi->list = list;
+    /*
+    * Eval the number of ns-decls; this is used to speed up
+    * XPath-context initialization.
+    */
+    while (list[nsi->number] != NULL)
+	nsi->number++;
+    /*
+    * Store the ns-list in the stylesheet.
+    */
+    if (xsltPointerListAddSize(
+	(xsltPointerListPtr)cctxt->psData->inScopeNamespaces,
+	(void *) nsi, 5) == -1)
+    {	
+	xmlFree(nsi);
+	nsi = NULL;
+	xsltTransformError(NULL, cctxt->style, NULL,
+	    "xsltCompilerBuildInScopeNsList: failed to add ns-info.\n");
+	goto internal_err;
+    }
+    /*
+    * Notify of change in status wrt namespaces.
+    */
+    if (cctxt->inode != NULL)
+	cctxt->inode->nsChanged = 1;
+
+    return(nsi);
+
+internal_err:
+    if (list != NULL)
+	xmlFree(list);    
+    cctxt->style->errors++;
+    return(NULL);
+}
+
+static int
+xsltParseNsPrefixList(xsltCompilerCtxtPtr cctxt,
+		      xsltPointerListPtr list,
+		      xmlNodePtr node,
+		      const xmlChar *value)
+{
+    xmlChar *cur, *end;
+    xmlNsPtr ns;
+    
+    if ((cctxt == NULL) || (value == NULL) || (list == NULL))
+	return(-1);
+
+    list->number = 0;
+
+    cur = (xmlChar *) value;
+    while (*cur != 0) {
+	while (IS_BLANK(*cur)) cur++;
+	if (*cur == 0)
+	    break;
+	end = cur;
+	while ((*end != 0) && (!IS_BLANK(*end))) end++;
+	cur = xmlStrndup(cur, end - cur);
+	if (cur == NULL) {
+	    cur = end;
+	    continue;
+	}		
+	/*
+	* TODO: Export and use xmlSearchNsByPrefixStrict()
+	*   in Libxml2, tree.c, since xmlSearchNs() is in most
+	*   cases not efficient and in some cases not correct.
+	*
+	* XSLT-2 TODO: XSLT 2.0 allows an additional "#all" value.
+	*/
+	if ((cur[0] == '#') &&
+	    xmlStrEqual(cur, (const xmlChar *)"#default"))
+	    ns = xmlSearchNs(cctxt->style->doc, node, NULL);
+	else
+	    ns = xmlSearchNs(cctxt->style->doc, node, cur);	    
+
+	if (ns == NULL) {
+	    /*
+	    * TODO: Better to report the attr-node, otherwise
+	    *  the user won't know which attribute was invalid.
+	    */
+	    xsltTransformError(NULL, cctxt->style, node,
+		"No namespace binding in scope for prefix '%s'.\n", cur);
+	    /*
+	    * XSLT-1.0: "It is an error if there is no namespace
+	    *  bound to the prefix on the element bearing the
+	    *  exclude-result-prefixes or xsl:exclude-result-prefixes
+	    *  attribute."
+	    */
+	    cctxt->style->errors++;
+	} else {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"resolved prefix '%s'\n", cur);
 #endif
+	    /*
+	    * Note that we put the namespace name into the dict.
+	    */
+	    if (xsltPointerListAddSize(list,
+		(void *) xmlDictLookup(cctxt->style->dict,
+		ns->href, -1), 5) == -1)
+	    {
+		xmlFree(cur);
+		goto internal_err;
+	    }
+	}
+	xmlFree(cur);
+		
+	cur = end;
+    }
+    return(0);
 
+internal_err:
+    cctxt->style->errors++;
+    return(-1);
+}
+
 /**
- * xsltPrecomputeStylesheet:
- * @style:  the XSLT stylesheet
- * @cur:  the current child list
+ * xsltCompilerUtilsCreateMergedList:
+ * @dest: the destination list (optional)
+ * @first: the first list
+ * @second: the second list (optional)
  *
- * Clean-up the stylesheet content from unwanted ignorable blank nodes
- * and run the preprocessing of all XSLT constructs.
+ * Appends the content of @second to @first into @destination.
+ * If @destination is NULL a new list will be created.
  *
- * and process xslt:text
- *
- * URGENT TODO: In order to avoid separation of the parsing of the stylesheet's
- *   node-tree, this should either only strip whitespace-only text-nodes,
- *   or it should be merged completely with the stylesheet-parsing
- *   functions (e.g. xsltParseStylesheetTop()).
+ * Returns the merged list of items or NULL if there's nothing to merge.
  */
+static xsltPointerListPtr
+xsltCompilerUtilsCreateMergedList(xsltPointerListPtr first,
+			    xsltPointerListPtr second)
+{
+    xsltPointerListPtr ret;
+    size_t num;
+
+    if (first)
+	num = first->number;
+    else
+	num = 0;
+    if (second)
+	num += second->number;    
+    if (num == 0)
+	return(NULL);
+    ret = xsltPointerListCreate(num);
+    if (ret == NULL)
+	return(NULL);
+    /*
+    * Copy contents.
+    */
+    if ((first != NULL) &&  (first->number != 0)) {
+	memcpy(ret->items, first->items,
+	    first->number * sizeof(void *));
+	if ((second != NULL) && (second->number != 0))
+	    memcpy(ret->items + first->number, second->items,
+		second->number * sizeof(void *));
+    } else if ((second != NULL) && (second->number != 0))
+	memcpy(ret->items, (void *) second->items,
+	    second->number * sizeof(void *));
+    ret->number = num;
+    return(ret);
+}
+
+/*
+* xsltParseExclResultPrefixes:
+*
+* Create and store the list of in-scope namespaces for the given
+* node in the stylesheet. If there are no changes in the in-scope
+* namespaces then the last ns-info of the ancestor axis will be returned.
+* Compilation-time only.
+*
+* Returns the ns-info or NULL if there are no namespaces in scope.
+*/
+static xsltPointerListPtr
+xsltParseExclResultPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node,
+			    xsltPointerListPtr def,
+			    int instrCategory)
+{    
+    xsltPointerListPtr list = NULL;
+    xmlChar *value = NULL;
+
+    if ((cctxt == NULL) || (node == NULL))
+	return(NULL);
+    
+    if (instrCategory == XSLT_ELEMENT_CATEGORY_XSLT)
+	value = xmlGetNsProp(node, BAD_CAST "exclude-result-prefixes", NULL);
+    else
+	value = xmlGetNsProp(node, BAD_CAST "exclude-result-prefixes",
+	    XSLT_NAMESPACE);
+
+    if (value == NULL)
+	return(def);
+
+    if (xsltParseNsPrefixList(cctxt, cctxt->tmpList, node,
+	BAD_CAST value) != 0)
+	goto exit;
+    if (cctxt->tmpList->number == 0)	
+	goto exit;    
+    /*
+    * Merge the list with the inherited list.
+    */
+    list = xsltCompilerUtilsCreateMergedList(def, cctxt->tmpList);
+    if (list == NULL)
+	goto exit;    
+    /*
+    * Store the list in the stylesheet/compiler context.
+    */
+    if (xsltPointerListAddSize(
+	cctxt->psData->exclResultNamespaces, list, 5) == -1)
+    {
+	xsltPointerListFree(list);
+	list = NULL;
+	goto exit;
+    }
+    /*
+    * Notify of change in status wrt namespaces.
+    */
+    if (cctxt->inode != NULL)
+	cctxt->inode->nsChanged = 1;
+
+exit:
+    if (value != NULL)
+	xmlFree(value);
+    if (list != NULL)
+	return(list);
+    else
+	return(def);
+}
+
+/*
+* xsltParseExtElemPrefixes:
+*
+* Create and store the list of in-scope namespaces for the given
+* node in the stylesheet. If there are no changes in the in-scope
+* namespaces then the last ns-info of the ancestor axis will be returned.
+* Compilation-time only.
+*
+* Returns the ns-info or NULL if there are no namespaces in scope.
+*/
+static xsltPointerListPtr
+xsltParseExtElemPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node,
+			 xsltPointerListPtr def,
+			 int instrCategory)
+{    
+    xsltPointerListPtr list = NULL;
+    xmlAttrPtr attr;
+    xmlChar *value;
+    int i;
+
+    if ((cctxt == NULL) || (node == NULL))
+	return(NULL);
+
+    if (instrCategory == XSLT_ELEMENT_CATEGORY_XSLT)
+	attr = xmlHasNsProp(node, BAD_CAST "extension-element-prefixes", NULL);
+    else
+	attr = xmlHasNsProp(node, BAD_CAST "extension-element-prefixes",
+	    XSLT_NAMESPACE);
+    if (attr == NULL)	
+	return(def);
+
+    if ((attr->children != NULL) &&	
+	(attr->children->content != NULL))
+	value = attr->children->content;
+    else {
+	xsltTransformError(NULL, cctxt->style, node,
+	    "Attribute 'extension-element-prefixes': Invalid value.\n");
+	cctxt->style->errors++;
+	return(def);
+    }
+
+
+    if (xsltParseNsPrefixList(cctxt, cctxt->tmpList, node,
+	BAD_CAST value) != 0)
+	goto exit;
+
+    if (cctxt->tmpList->number == 0)
+	goto exit;    
+    /*
+    * REVISIT: Register the extension namespaces.
+    */
+    for (i = 0; i < cctxt->tmpList->number; i++)
+	xsltRegisterExtPrefix(cctxt->style, NULL,
+	BAD_CAST cctxt->tmpList->items[i]);
+    /*
+    * Merge the list with the inherited list.
+    */
+    list = xsltCompilerUtilsCreateMergedList(def, cctxt->tmpList);
+    if (list == NULL)
+	goto exit;
+    /*
+    * Store the list in the stylesheet.
+    */
+    if (xsltPointerListAddSize(
+	cctxt->psData->extElemNamespaces, list, 5) == -1)
+    {
+	xsltPointerListFree(list);
+	list = NULL;
+	goto exit;
+    }
+    /*
+    * Notify of change in status wrt namespaces.
+    */
+    if (cctxt->inode != NULL)
+	cctxt->inode->nsChanged = 1;
+
+exit:
+    if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) {
+	/*
+	* Remove the XSLT attribute from the literal result element.
+	*/
+	xmlUnlinkNode((xmlNodePtr) attr);
+	xmlFreeProp(attr);
+    }
+    if (list != NULL)
+	return(list);
+    else
+	return(def);
+}
+
+
+/*
+* xsltParseAttrXSLTVersion:
+*
+* @cctxt: the compilation context
+* @node: the element-node
+* @isXsltElem: whether this is an XSLT element
+*
+* Parses the attribute xsl:version.
+*
+* Returns 1 if there was such an attribute, 0 if not and
+*         -1 if an internal or API error occured.
+*/
+static int
+xsltParseAttrXSLTVersion(xsltCompilerCtxtPtr cctxt, xmlNodePtr node,			 
+			 int instrCategory)
+{
+    xmlChar *value;
+    xmlAttrPtr attr;
+
+    if ((cctxt == NULL) || (node == NULL))
+	return(-1);
+
+    if (instrCategory == XSLT_ELEMENT_CATEGORY_XSLT)
+	attr = xmlHasNsProp(node, BAD_CAST "version", NULL);
+    else
+	attr = xmlHasNsProp(node, BAD_CAST "version", XSLT_NAMESPACE);
+
+    if (attr == NULL)	
+	return(0);
+
+    if ((attr->children != NULL) &&	
+	(attr->children->content != NULL))
+	value = attr->children->content;
+    else {
+	xsltTransformError(NULL, cctxt->style, node,
+	    "Attribute 'version': Invalid value.\n");
+	cctxt->style->errors++;
+	return(1);
+    }
+    
+    if (! xmlStrEqual(value, (const xmlChar *)"1.0")) {
+	cctxt->inode->forwardsCompat = 1;
+	/*
+	* TODO: To what extent do we support the
+	*  forwards-compatible mode?
+	*/
+	/*
+	* Report this only once per compilation episode.
+	*/
+	if (! cctxt->hasForwardsCompat) {
+	    cctxt->hasForwardsCompat = 1;
+	    cctxt->errSeverity = XSLT_ERROR_SEVERITY_WARNING;
+	    xsltTransformError(NULL, cctxt->style, node,
+		"Warning: the attribute xsl:version specifies a value "
+		"different from '1.0'. Switching to forwards-compatible "
+		"mode. Only features of XSLT 1.0 are supported by this "
+		"processor.\n");
+	    cctxt->style->warnings++;
+	    cctxt->errSeverity = XSLT_ERROR_SEVERITY_ERROR;
+	}	
+    } else {
+	cctxt->inode->forwardsCompat = 0;
+    }
+
+    if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) {
+	/*
+	* Remove the XSLT attribute from the literal result element.
+	*/
+	xmlUnlinkNode((xmlNodePtr) attr);
+	xmlFreeProp(attr);
+    }
+    return(1);
+}
+
+#if 0
+static int
+xsltParseRemoveXSLTAttrs(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{
+    if (node->properties == NULL)
+	return(0);
+    else {
+	xmlAttrPtr tmpattr, attr = node->properties;
+	do {	    
+	    if (IS_XSLT_ATTR_FAST(attr)) {
+		tmpattr = attr;
+		attr = attr->next;
+		xmlUnlinkNode((xmlNodePtr) tmpattr);
+		xmlFreeProp(tmpattr);
+	    } else
+		attr = attr->next;
+	} while (attr != NULL);
+    }
+}
+#endif
+
+static int
+xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{
+    xmlNodePtr deleteNode, cur, txt, textNode = NULL;
+    xmlDocPtr doc;
+    xsltStylesheetPtr style;
+    int internalize = 0, findSpaceAttr;
+    int xsltStylesheetElemDepth;
+    xmlAttrPtr attr;
+    xmlChar *value;
+    const xmlChar *name, *nsNameXSLT = NULL;
+    int strictWhitespace, inXSLText = 0;
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    xsltNsMapPtr nsMapItem;
+#endif
+
+    if ((cctxt == NULL) || (cctxt->style == NULL) ||
+	(node == NULL) || (node->type != XML_ELEMENT_NODE))
+        return(-1);
+
+    doc = node->doc;
+    if (doc == NULL)
+	goto internal_err;
+
+    style = cctxt->style;
+    if ((style->dict != NULL) && (doc->dict == style->dict))
+	internalize = 1;
+    else
+        style->internalized = 0;
+
+    /*
+    * Init value of xml:space. Since this might be an embedded
+    * stylesheet, this is needed to be performed on the element
+    * where the stylesheet is rooted at, taking xml:space of
+    * ancestors into account.
+    */
+    if (! cctxt->simplified)
+	xsltStylesheetElemDepth = cctxt->depth +1;
+    else
+	xsltStylesheetElemDepth = 0;
+
+    if (xmlNodeGetSpacePreserve(node) != 1)
+	cctxt->inode->preserveWhitespace = 0;
+    else
+	cctxt->inode->preserveWhitespace = 1; 
+    
+    /*
+    * Eval if we should keep the old incorrect behaviour.
+    */
+    strictWhitespace = (cctxt->strict != 0) ? 1 : 0;
+
+    nsNameXSLT = xsltConstNamespaceNameXSLT;
+
+    deleteNode = NULL;
+    cur = node;
+    while (cur != NULL) {
+	if (deleteNode != NULL)	{
+
+#ifdef WITH_XSLT_DEBUG_BLANKS
+	    xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltParsePreprocessStylesheetTree: removing node\n");
+#endif
+	    xmlUnlinkNode(deleteNode);
+	    xmlFreeNode(deleteNode);
+	    deleteNode = NULL;
+	}
+	if (cur->type == XML_ELEMENT_NODE) {
+	    
+	    /*
+	    * Clear the PSVI field.
+	    */
+	    cur->psvi = NULL;
+
+	    xsltCompilerNodePush(cctxt, cur);
+
+	    inXSLText = 0;
+	    textNode = NULL;	    
+	    findSpaceAttr = 1;	    
+	    cctxt->inode->stripWhitespace = 0;
+	    /*
+	    * TODO: I'd love to use a string pointer comparison here :-/
+	    */
+	    if (IS_XSLT_ELEM(cur)) {
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+		if (cur->ns->href != nsNameXSLT) {
+		    nsMapItem = xsltNewNamespaceMapItem(cctxt,
+			doc, cur->ns, cur);
+		    if (nsMapItem == NULL)
+			goto internal_err;
+		    cur->ns->href = nsNameXSLT;
+		}
+#endif
+
+		if (cur->name == NULL)
+		    goto process_attributes;
+		/*
+		* Mark the XSLT element for later recognition.
+		* TODO: Using the marker is still too dangerous, since if
+		*   the parsing mechanism leaves out an XSLT element, then
+		*   this might hit the transformation-mechanism, which
+		*   will break if it doesn't expect such a marker.
+		*/
+		/* cur->psvi = (void *) xsltXSLTElemMarker; */
+
+		/*
+		* XSLT 2.0: "Any whitespace text node whose parent is
+		* one of the following elements is removed from the "
+		* tree, regardless of any xml:space attributes:..."
+		* xsl:apply-imports, 
+		* xsl:apply-templates,
+		* xsl:attribute-set,
+		* xsl:call-template, 
+		* xsl:choose,
+		* xsl:stylesheet, xsl:transform.
+		* XSLT 2.0: xsl:analyze-string,
+		*           xsl:character-map,
+		*           xsl:next-match		
+		*
+		* TODO: I'd love to use a string pointer comparison here :-/
+		*/		
+		name = cur->name;
+		switch (*name) {
+		    case 't':
+			if ((name[0] == 't') && (name[1] == 'e') &&
+			    (name[2] == 'x') && (name[3] == 't') &&
+			    (name[4] == 0))
+			{
+			    /*
+			    * Process the xsl:text element.
+			    * ----------------------------
+			    * Mark it for later recognition.
+			    */
+			    cur->psvi = (void *) xsltXSLTTextMarker;
+			    /*
+			    * For stylesheets, the set of
+			    * whitespace-preserving element names
+			    * consists of just xsl:text.
+			    */
+			    findSpaceAttr = 0;
+			    cctxt->inode->preserveWhitespace = 1;
+			    inXSLText = 1;
+			}			    
+			break;
+		    case 'c':
+			if (xmlStrEqual(name, BAD_CAST "choose") ||
+			    xmlStrEqual(name, BAD_CAST "call-template"))
+			    cctxt->inode->stripWhitespace = 1;
+			break;
+		    case 'a':
+			if (xmlStrEqual(name, BAD_CAST "apply-templates") ||
+			    xmlStrEqual(name, BAD_CAST "apply-imports") ||
+			    xmlStrEqual(name, BAD_CAST "attribute-set"))
+
+			    cctxt->inode->stripWhitespace = 1;
+			break;
+		    default:
+			if (xsltStylesheetElemDepth == cctxt->depth) {
+			    /*
+			    * This is a xsl:stylesheet/xsl:transform.
+			    */
+			    cctxt->inode->stripWhitespace = 1;
+			    break;
+			}
+
+			if ((cur->prev != NULL) &&
+			    (cur->prev->type == XML_TEXT_NODE))
+			{
+			    /*
+			    * XSLT 2.0 : "Any whitespace text node whose
+			    *  following-sibling node is an xsl:param or
+			    *  xsl:sort element is removed from the tree,
+			    *  regardless of any xml:space attributes."
+			    */
+			    if (((*name == 'p') || (*name == 's')) &&
+				(xmlStrEqual(name, BAD_CAST "param") ||
+				 xmlStrEqual(name, BAD_CAST "sort")))
+			    {
+				do {
+				    if (IS_BLANK_NODE(cur->prev)) {
+					txt = cur->prev;
+					xmlUnlinkNode(txt);
+					xmlFreeNode(txt);
+				    } else {
+					/*
+					* This will result in a content
+					* error, when hitting the parsing
+					* functions.
+					*/
+					break;
+				    }
+				} while (cur->prev);				    
+			    }
+			}
+			break;
+		}
+	    }
+
+process_attributes:
+	    /*
+	    * Process attributes.
+	    * ------------------
+	    */
+	    if (cur->properties != NULL) {
+		if (cur->children == NULL)
+		    findSpaceAttr = 0;
+		attr = cur->properties;
+		do {
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+		    if ((attr->ns) && (attr->ns->href != nsNameXSLT) &&
+			xmlStrEqual(attr->ns->href, nsNameXSLT))
+		    {			
+			nsMapItem = xsltNewNamespaceMapItem(cctxt,
+			    doc, attr->ns, cur);
+			if (nsMapItem == NULL)
+			    goto internal_err;
+			attr->ns->href = nsNameXSLT;
+		    }		    
+#endif
+		    if (internalize) {
+			/*
+			* Internalize the attribute's value; the goal is to
+			* speed up operations and minimize used space by
+			* compiled stylesheets.
+			*/
+			txt = attr->children;
+			/*
+			* NOTE that this assumes only one
+			*  text-node in the attribute's content.
+			*/
+			if ((txt != NULL) && (txt->content != NULL) &&
+			    (!xmlDictOwns(style->dict, txt->content)))
+			{
+			    value = (xmlChar *) xmlDictLookup(style->dict,
+				txt->content, -1);
+			    xmlNodeSetContent(txt, NULL);
+			    txt->content = value;
+			}
+		    }
+		    /*
+		    * Process xml:space attributes.
+		    * ----------------------------
+		    */
+		    if ((findSpaceAttr != 0) &&
+			(attr->ns != NULL) &&
+			(attr->name != NULL) &&
+			(attr->name[0] == 's') &&			
+			(attr->ns->prefix != NULL) &&
+			(attr->ns->prefix[0] == 'x') &&
+			(attr->ns->prefix[1] == 'm') &&
+			(attr->ns->prefix[2] == 'l') &&
+			(attr->ns->prefix[3] == 0))
+		    {
+			value = xmlGetNsProp(cur, BAD_CAST "space",
+			    XML_XML_NAMESPACE);
+			if (value != NULL) {
+			    if (xmlStrEqual(value, BAD_CAST "preserve")) {
+				cctxt->inode->preserveWhitespace = 1;				
+			    } else if (xmlStrEqual(value, BAD_CAST "default")) {
+				cctxt->inode->preserveWhitespace = 0;
+			    } else {
+				/* Invalid value for xml:space. */
+				xsltTransformError(NULL, style, cur,
+				    "Attribute xml:space: Invalid value.\n");
+				cctxt->style->warnings++;
+			    }
+			    findSpaceAttr = 0;
+			    xmlFree(value);
+			}
+			
+		    }
+		    attr = attr->next;
+		} while (attr != NULL);
+	    }
+	    /*
+	    * We'll descend into the children of element nodes only.
+	    */
+	    if (cur->children != NULL) {
+		cur = cur->children;
+		continue;
+	    }
+	} else if ((cur->type == XML_TEXT_NODE) ||
+		(cur->type == XML_CDATA_SECTION_NODE))
+	{
+	    /*
+	    * Merge adjacent text/CDATA-section-nodes
+	    * ---------------------------------------	    
+	    * In order to avoid breaking of existing stylesheets,
+	    * if the old behaviour is wanted (strictWhitespace == 0),
+	    * then we *won't* merge adjacent text-nodes
+	    * (except in xsl:text); this will ensure that whitespace-only
+	    * text nodes are (incorrectly) not stripped in some cases.
+	    * 
+	    * Example:               : <foo>  <!-- bar -->zoo</foo>
+	    * Corrent (strict) result: <foo>  zoo</foo>
+	    * Incorrect (old) result : <foo>zoo</foo>
+	    *    
+	    * NOTE that we *will* merge adjacent text-nodes if
+	    * they are in xsl:text.
+	    * Example, the following:
+	    * <xsl:text>  <!-- bar -->zoo<xsl:text>
+	    * will result in both cases in:
+	    * <xsl:text>  zoo<xsl:text>
+	    */
+	    cur->type = XML_TEXT_NODE;
+	    if ((strictWhitespace != 0) || (inXSLText != 0)) {
+		/*
+		* New behaviour; merge nodes.
+		*/
+		if (textNode == NULL)
+		    textNode = cur;
+		else {
+		    if (cur->content != NULL)
+			xmlNodeAddContent(textNode, cur->content);
+		    deleteNode = cur;
+		}
+		if ((cur->next == NULL) ||
+		    (cur->next->type == XML_ELEMENT_NODE))
+		    goto end_of_text;
+		else
+		    goto next_sibling;
+	    } else {
+		/*
+		* Old behaviour.
+		*/
+		if (textNode == NULL)
+		    textNode = cur;
+		goto end_of_text;
+	    }	    	   
+	} else if ((cur->type == XML_COMMENT_NODE) ||
+	    (cur->type == XML_PI_NODE))
+	{	    
+	    /*
+	    * Remove processing instructions and comments.
+	    */
+	    deleteNode = cur;
+	    if ((cur->next == NULL) ||
+		(cur->next->type == XML_ELEMENT_NODE))
+		goto end_of_text;
+	    else
+		goto next_sibling;
+	} else {
+	    textNode = NULL;
+	    /*
+	    * Invalid node-type for this data-model.
+	    */
+	    xsltTransformError(NULL, style, cur,
+		"Invalid type of node for the XSLT data model.\n");
+	    cctxt->style->errors++;
+	    goto next_sibling;
+	}
+
+end_of_text:
+	if (textNode) {
+	    value = textNode->content;
+	    /*
+	    * At this point all adjacent text/CDATA-section nodes
+	    * have been merged.
+	    *
+	    * Strip whitespace-only text-nodes.
+	    * (cctxt->inode->stripWhitespace)
+	    */
+	    if ((value == NULL) || (*value == 0) ||
+		(((cctxt->inode->stripWhitespace) ||
+		  (! cctxt->inode->preserveWhitespace)) &&
+		 IS_BLANK(*value) &&
+		 xsltIsBlank(value)))
+	    {		
+		if (textNode != cur) {
+		    xmlUnlinkNode(textNode);
+		    xmlFreeNode(textNode);
+		} else
+		    deleteNode = textNode;
+		textNode = NULL;
+		goto next_sibling;
+	    }
+	    /*
+	    * Convert CDATA-section nodes to text-nodes.
+	    * TODO: Can this produce problems?
+	    */
+	    if (textNode->type != XML_TEXT_NODE) {
+		textNode->type = XML_TEXT_NODE;
+		textNode->name = xmlStringText;
+	    }
+	    if (internalize &&
+		(textNode->content != NULL) &&
+		(!xmlDictOwns(style->dict, textNode->content)))
+	    {
+		/*
+		* Internalize the string.
+		*/
+		value = (xmlChar *) xmlDictLookup(style->dict,
+		    textNode->content, -1);
+		xmlNodeSetContent(textNode, NULL);
+		textNode->content = value;
+	    }
+	    textNode = NULL;
+	    /*
+	    * Note that "disable-output-escaping" of the xsl:text
+	    * element will be applied at a later level, when
+	    * XSLT elements are processed.
+	    */
+	}
+
+next_sibling:
+	if (cur->type == XML_ELEMENT_NODE) {
+	    xsltCompilerNodePop(cctxt, cur);
+	}
+	if (cur == node)
+	    break;
+	if (cur->next != NULL) {
+	    cur = cur->next;
+	} else {
+	    cur = cur->parent;
+	    inXSLText = 0;
+	    goto next_sibling;
+	};
+    }
+    if (deleteNode != NULL) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+	 "xsltParsePreprocessStylesheetTree: removing node\n");
+#endif
+	xmlUnlinkNode(deleteNode);
+	xmlFreeNode(deleteNode);
+    }
+    return(0);
+
+internal_err:
+    return(-1);
+}
+
+#endif /* XSLT_REFACTORED */
+
+#ifdef XSLT_REFACTORED
+#else
 static void
-xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) {
-    xmlNodePtr delete;
+xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur)
+{
+    xmlNodePtr deleteNode;
     int internalize = 0;
-#ifdef XSLT_REFACTORED
-    xsltCompilerCtxtPtr cctxt;
-#endif
 
-    if ((style == NULL) || (cur == NULL)
-#ifdef XSLT_REFACTORED
-	||(style->compCtxt == NULL)
-#endif
-	)
+    if ((style == NULL) || (cur == NULL))
         return;
 
     if ((cur->doc != NULL) && (style->dict != NULL) &&
@@ -1411,43 +3236,37 @@
 	internalize = 1;
     else
         style->internalized = 0;
-#ifdef XSLT_REFACTORED
-    cctxt = (xsltCompilerCtxtPtr) style->compCtxt;    
-#endif
     /*
      * This content comes from the stylesheet
      * For stylesheets, the set of whitespace-preserving
      * element names consists of just xsl:text.
      */
-    delete = NULL;
+    deleteNode = NULL;
     while (cur != NULL) {
-	if (delete != NULL) {
+	if (deleteNode != NULL) {
 #ifdef WITH_XSLT_DEBUG_BLANKS
 	    xsltGenericDebug(xsltGenericDebugContext,
 	     "xsltPrecomputeStylesheet: removing ignorable blank node\n");
 #endif
-	    xmlUnlinkNode(delete);
-	    xmlFreeNode(delete);
-	    delete = NULL;
+	    xmlUnlinkNode(deleteNode);
+	    xmlFreeNode(deleteNode);
+	    deleteNode = NULL;
 	}
 	if (cur->type == XML_ELEMENT_NODE) {
-	    int exclPrefixes;	    
-
-#ifdef XSLT_REFACTORED
-	    xsltCompilerNodePush(cctxt, cur);
-#endif
+	    int exclPrefixes;
 	    /*
 	     * Internalize attributes values.
 	     */
 	    if ((internalize) && (cur->properties != NULL)) {
-	        xmlAttrPtr prop = cur->properties;
+	        xmlAttrPtr attr = cur->properties;
 		xmlNodePtr txt;
 
-		while (prop != NULL) {
-		    txt = prop->children;
+		while (attr != NULL) {
+		    txt = attr->children;
 		    if ((txt != NULL) && (txt->type == XML_TEXT_NODE) &&
 		        (txt->content != NULL) &&
-			(!xmlDictOwns(style->dict, txt->content))) {
+			(!xmlDictOwns(style->dict, txt->content)))
+		    {
 			xmlChar *tmp;
 
 			/*
@@ -1462,35 +3281,11 @@
 			    txt->content = tmp;
 			}
 		    }
-		    prop = prop->next;
+		    attr = attr->next;
 		}
 	    }
-	    /*
-	    * TODO: "exclude-result-prefixes"
-	    *   SPEC 1.0:
-	    *   "exclude-result-prefixes" is only allowed on literal
-	    *   result elements and "xsl:exclude-result-prefixes" only
-	    *   on xsl:stylesheet/xsl:transform.
-	    *   SPEC 2.0:
-	    *   "There are a number of standard attributes
-	    *   that may appear on any XSLT element: specifically version,
-	    *   exclude-result-prefixes, extension-element-prefixes,
-	    *   xpath-default-namespace, default-collation, and use-when."
-	    */
 	    if (IS_XSLT_ELEM(cur)) {
 		exclPrefixes = 0;
-#ifdef XSLT_REFACTORED
-		if ((cctxt->depth == 0) && (cur->nsDef != NULL)) {
-		    /*
-		    * In every case, we need the in-scope namespaces of the
-		    * element, where the stylesheet is rooted at.
-		    * Otherwise we need to pre-compute the in-scope namespaces
-		    * only if there's a new ns-decl.
-		    */
-		    cctxt->inode->inScopeNS =
-			xsltCompilerGetInScopeNSInfo(cctxt, cur);
-		}
-#endif		
 		xsltStylePreCompute(style, cur);
 		if (IS_XSLT_NAME(cur, "text")) {
 		    for (;exclPrefixes > 0;exclPrefixes--)
@@ -1498,25 +3293,9 @@
 		    goto skip_children;
 		}
 	    } else {
-#ifdef XSLT_REFACTORED
-		if (cctxt->depth == 0)
-		    cctxt->inode->inScopeNS =
-			xsltCompilerGetInScopeNSInfo(cctxt, cur);
-#endif
 		exclPrefixes = xsltParseStylesheetExcludePrefix(style, cur, 0);
 	    }
-
-	    /*
-	     * Remove excluded prefixes
-	     * TODO BUG:
-	     *   This will incorrectly apply excluded-result-prefixes
-	     *   of the including stylesheet to the included stylesheet.
-	     *   We need to localize the list of excluded-prefixes for
-	     *   every processed stylesheet.
-	     * SPEC 1.0: "a subtree rooted at an xsl:stylesheet element
-	     *   does not include any stylesheets imported or included by
-	     *   children of that xsl:stylesheet element."
-	     */
+	    	     
 	    if ((cur->nsDef != NULL) && (style->exclPrefixNr > 0)) {
 		xmlNsPtr ns = cur->nsDef, prev = NULL, next;
 		xmlNodePtr root = NULL;
@@ -1553,7 +3332,6 @@
 		    }
 		}
 	    }
-
 	    /*
 	     * If we have prefixes locally, recurse and pop them up when
 	     * going back
@@ -1564,11 +3342,10 @@
 		    exclPrefixPop(style);
 		goto skip_children;
 	    }
-
 	} else if (cur->type == XML_TEXT_NODE) {
 	    if (IS_BLANK_NODE(cur)) {
 		if (xmlNodeGetSpacePreserve(cur) != 1) {
-		    delete = cur;
+		    deleteNode = cur;
 		}
 	    } else if ((cur->content != NULL) && (internalize) &&
 	               (!xmlDictOwns(style->dict, cur->content))) {
@@ -1585,7 +3362,7 @@
 	    }
 	} else if ((cur->type != XML_ELEMENT_NODE) &&
 		   (cur->type != XML_CDATA_SECTION_NODE)) {
-	    delete = cur;
+	    deleteNode = cur;
 	    goto skip_children;
 	}
 
@@ -1600,12 +3377,6 @@
 		continue;
 	    }
 	}
-#ifdef XSLT_REFACTORED
-	if (cur->type == XML_ELEMENT_NODE) {
-	    /* Leaving the scope of an element-node. */
-	    xsltCompilerNodePop(cctxt, cur);
-	}
-#endif
 
 skip_children:
 	if (cur->next != NULL) {
@@ -1627,16 +3398,16 @@
 	    }
 	} while (cur != NULL);
     }
-    if (delete != NULL) {
+    if (deleteNode != NULL) {
 #ifdef WITH_XSLT_DEBUG_PARSING
 	xsltGenericDebug(xsltGenericDebugContext,
 	 "xsltPrecomputeStylesheet: removing ignorable blank node\n");
 #endif
-	xmlUnlinkNode(delete);
-	xmlFreeNode(delete);
-	delete = NULL;
+	xmlUnlinkNode(deleteNode);
+	xmlFreeNode(deleteNode);
     }
 }
+#endif /* end of else XSLT_REFACTORED */
 
 /**
  * xsltGatherNamespaces:
@@ -1729,16 +3500,1007 @@
     }
 }
 
+#ifdef XSLT_REFACTORED
+
+static xsltStyleType
+xsltGetXSLTElementTypeByNode(xsltCompilerCtxtPtr cctxt,
+			     xmlNodePtr node)
+{
+    if ((node == NULL) || (node->type != XML_ELEMENT_NODE) ||
+	(node->name == NULL))
+	return(0);
+
+    if (node->name[0] == 'a') {
+	if (IS_XSLT_NAME(node, "apply-templates"))
+	    return(XSLT_FUNC_APPLYTEMPLATES);
+	else if (IS_XSLT_NAME(node, "attribute"))
+	    return(XSLT_FUNC_ATTRIBUTE);
+	else if (IS_XSLT_NAME(node, "apply-imports"))
+	    return(XSLT_FUNC_APPLYIMPORTS);
+	else if (IS_XSLT_NAME(node, "attribute-set"))
+	    return(0);
+
+    } else if (node->name[0] == 'c') {
+	if (IS_XSLT_NAME(node, "choose"))
+	    return(XSLT_FUNC_CHOOSE);
+	else if (IS_XSLT_NAME(node, "copy"))
+	    return(XSLT_FUNC_COPY);
+	else if (IS_XSLT_NAME(node, "copy-of"))
+	    return(XSLT_FUNC_COPYOF);
+	else if (IS_XSLT_NAME(node, "call-template"))
+	    return(XSLT_FUNC_CALLTEMPLATE);
+	else if (IS_XSLT_NAME(node, "comment"))
+	    return(XSLT_FUNC_COMMENT);
+
+    } else if (node->name[0] == 'd') {
+	if (IS_XSLT_NAME(node, "document"))
+	    return(XSLT_FUNC_DOCUMENT);
+	else if (IS_XSLT_NAME(node, "decimal-format"))
+	    return(0);
+
+    } else if (node->name[0] == 'e') {
+	if (IS_XSLT_NAME(node, "element"))
+	    return(XSLT_FUNC_ELEMENT);
+
+    } else if (node->name[0] == 'f') {
+	if (IS_XSLT_NAME(node, "for-each"))
+	    return(XSLT_FUNC_FOREACH);
+	else if (IS_XSLT_NAME(node, "fallback"))
+	    return(XSLT_FUNC_FALLBACK);
+
+    } else if (*(node->name) == 'i') {
+	if (IS_XSLT_NAME(node, "if"))
+	    return(XSLT_FUNC_IF);
+	else if (IS_XSLT_NAME(node, "include"))
+	    return(0);
+	else if (IS_XSLT_NAME(node, "import"))
+	    return(0);
+
+    } else if (*(node->name) == 'k') {
+	if (IS_XSLT_NAME(node, "key"))
+	    return(0);
+
+    } else if (*(node->name) == 'm') {
+	if (IS_XSLT_NAME(node, "message"))
+	    return(XSLT_FUNC_MESSAGE);
+
+    } else if (*(node->name) == 'n') {
+	if (IS_XSLT_NAME(node, "number"))
+	    return(XSLT_FUNC_NUMBER);
+	else if (IS_XSLT_NAME(node, "namespace-alias"))
+	    return(0);
+
+    } else if (*(node->name) == 'o') {
+	if (IS_XSLT_NAME(node, "otherwise"))
+	    return(XSLT_FUNC_OTHERWISE);
+	else if (IS_XSLT_NAME(node, "output"))
+	    return(0);
+
+    } else if (*(node->name) == 'p') {
+	if (IS_XSLT_NAME(node, "param"))
+	    return(XSLT_FUNC_PARAM);
+	else if (IS_XSLT_NAME(node, "processing-instruction"))
+	    return(XSLT_FUNC_PI);
+	else if (IS_XSLT_NAME(node, "preserve-space"))
+	    return(0);
+
+    } else if (*(node->name) == 's') {
+	if (IS_XSLT_NAME(node, "sort"))
+	    return(XSLT_FUNC_SORT);
+	else if (IS_XSLT_NAME(node, "strip-space"))
+	    return(0);
+	else if (IS_XSLT_NAME(node, "stylesheet"))
+	    return(0);
+
+    } else if (node->name[0] == 't') {
+	if (IS_XSLT_NAME(node, "text"))
+	    return(XSLT_FUNC_TEXT);
+	else if (IS_XSLT_NAME(node, "template"))
+	    return(0);
+	else if (IS_XSLT_NAME(node, "transform"))
+	    return(0);
+
+    } else if (*(node->name) == 'v') {
+	if (IS_XSLT_NAME(node, "value-of"))
+	    return(XSLT_FUNC_VALUEOF);
+	else if (IS_XSLT_NAME(node, "variable"))
+	    return(XSLT_FUNC_VARIABLE);
+
+    } else if (*(node->name) == 'w') {
+	if (IS_XSLT_NAME(node, "when"))
+	    return(XSLT_FUNC_WHEN);
+	if (IS_XSLT_NAME(node, "with-param"))
+	    return(XSLT_FUNC_WITHPARAM);
+    }
+    return(0);
+}
+
+int
+xsltParseAnyXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr elem)
+{
+    if ((cctxt == NULL) || (elem == NULL) ||
+	(elem->type != XML_ELEMENT_NODE))
+	return(-1);
+
+    elem->psvi = NULL;
+
+    if (! (IS_XSLT_ELEM_FAST(elem)))
+	return(-1);
+    /*
+    * Detection of handled content of extension instructions.
+    */
+    if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) {
+	cctxt->inode->extContentHandled = 1;
+    }
+    
+    xsltCompilerNodePush(cctxt, elem);
+    /*
+    * URGENT TODO: Find a way to speed up this annoying redundant
+    *  textual node-name and namespace comparison.
+    */
+    if (cctxt->inode->prev->curChildType != 0)
+	cctxt->inode->type = cctxt->inode->prev->curChildType;
+    else
+	cctxt->inode->type = xsltGetXSLTElementTypeByNode(cctxt, elem);    
+    /*
+    * Update the in-scope namespaces if needed.
+    */
+    if (elem->nsDef != NULL)
+	cctxt->inode->inScopeNs =
+	    xsltCompilerBuildInScopeNsList(cctxt, elem);
+    /*
+    * xsltStylePreCompute(): Precompute the XSLT-instruction.
+    *  This will compile the information found on the current
+    *  element's attributes. NOTE that this won't process the
+    *  children of the current element.
+    */
+    xsltStylePreCompute(cctxt->style, elem);
+    /*
+    * Validate the content model of the XSLT-element.
+    */
+    switch (cctxt->inode->type) {	
+	case XSLT_FUNC_APPLYIMPORTS:
+	    /* EMPTY */
+	    goto empty_content;
+	case XSLT_FUNC_APPLYTEMPLATES:
+	    /* <!-- Content: (xsl:sort | xsl:with-param)* --> */
+	    goto apply_templates;	    
+	case XSLT_FUNC_ATTRIBUTE:	    
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;
+	case XSLT_FUNC_CALLTEMPLATE:
+	    /* <!-- Content: xsl:with-param* --> */
+	    goto call_template;
+	case XSLT_FUNC_CHOOSE:	    
+	    /* <!-- Content: (xsl:when+, xsl:otherwise?) --> */
+	    goto choose;
+	case XSLT_FUNC_COMMENT:
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;	    
+	case XSLT_FUNC_COPY:
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;	    
+	case XSLT_FUNC_COPYOF:
+	    /* EMPTY */
+	    goto empty_content;	   
+	case XSLT_FUNC_DOCUMENT: /* Extra one */
+	    /* ?? template ?? */
+	    goto sequence_constructor;
+	case XSLT_FUNC_ELEMENT:
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;
+	case XSLT_FUNC_FALLBACK:
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;
+	case XSLT_FUNC_FOREACH:
+	    /* <!-- Content: (xsl:sort*, template) --> */
+	    goto for_each;
+	case XSLT_FUNC_IF:
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;
+	case XSLT_FUNC_OTHERWISE:
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;
+	case XSLT_FUNC_MESSAGE:
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;
+	case XSLT_FUNC_NUMBER:
+	    /* EMPTY */
+	    goto empty_content;
+	case XSLT_FUNC_PARAM:
+	    /*  <!-- Content: template --> */
+	    goto sequence_constructor;
+	case XSLT_FUNC_PI:
+	    /*  <!-- Content: template --> */
+	    goto sequence_constructor;
+	case XSLT_FUNC_SORT:
+	    /* EMPTY */
+	    goto empty_content;
+	case XSLT_FUNC_TEXT:
+	    /* <!-- Content: #PCDATA --> */
+	    goto text;
+	case XSLT_FUNC_VALUEOF:
+	    /* EMPTY */
+	    goto empty_content;
+	case XSLT_FUNC_VARIABLE:
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;
+	case XSLT_FUNC_WHEN:
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;
+	case XSLT_FUNC_WITHPARAM:
+	    /* <!-- Content: template --> */
+	    goto sequence_constructor;
+	default:
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"xsltParseXSLTNode: Unhandled XSLT element '%s'.\n",
+		elem->name);	    
+#endif
+	    xsltTransformError(NULL, cctxt->style, elem,
+		"xsltParseXSLTNode: Internal error; "
+		"unhandled XSLT element '%s'.\n", elem->name);
+	    cctxt->style->errors++;
+	    goto internal_err;
+    }
+
+apply_templates:
+    /* <!-- Content: (xsl:sort | xsl:with-param)* --> */
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	do {
+	    if (child->type == XML_ELEMENT_NODE) {
+		if (IS_XSLT_ELEM_FAST(child)) {
+		    if (xmlStrEqual(child->name, BAD_CAST "with-param")) {
+			cctxt->inode->curChildType = XSLT_FUNC_WITHPARAM;
+			xsltParseAnyXSLTElem(cctxt, child);
+		    } else if (xmlStrEqual(child->name, BAD_CAST "sort")) {
+			cctxt->inode->curChildType = XSLT_FUNC_SORT;
+			xsltParseAnyXSLTElem(cctxt, child);
+		    } else
+			xsltParseContentError(cctxt->style, child);
+		} else
+		    xsltParseContentError(cctxt->style, child);
+	    }
+	    child = child->next;
+	} while (child != NULL);
+    }    
+    goto exit;
+
+call_template:
+    /* <!-- Content: xsl:with-param* --> */
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	do {
+	    if (child->type == XML_ELEMENT_NODE) {
+		if (IS_XSLT_ELEM_FAST(child)) {
+		    xsltStyleType type;
+
+		    type = xsltGetXSLTElementTypeByNode(cctxt, child);
+		    if (type == XSLT_FUNC_WITHPARAM) {
+			cctxt->inode->curChildType = XSLT_FUNC_WITHPARAM;
+			xsltParseAnyXSLTElem(cctxt, child);
+		    } else {
+			xsltParseContentError(cctxt->style, child);
+		    }
+		} else
+		    xsltParseContentError(cctxt->style, child);
+	    }
+	    child = child->next;
+	} while (child != NULL);
+    }    
+    goto exit;
+
+text:
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	do {
+	    if ((child->type != XML_TEXT_NODE) &&
+		(child->type != XML_CDATA_SECTION_NODE))
+	    {
+		xsltTransformError(NULL, cctxt->style, elem,
+		    "The XSLT 'text' element must have only character "
+		    "data as content.\n");
+	    }
+	    child = child->next;
+	} while (child != NULL);
+    }
+    goto exit;
+
+empty_content:
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	/*
+	* Relaxed behaviour: we will allow whitespace-only text-nodes.
+	*/
+	do {
+	    if (((child->type != XML_TEXT_NODE) &&
+		 (child->type != XML_CDATA_SECTION_NODE)) ||
+		(! IS_BLANK_NODE(child)))
+	    {
+		xsltTransformError(NULL, cctxt->style, elem,
+		    "This XSLT element must have no content.\n");
+		cctxt->style->errors++;
+		break;
+	    }
+	    child = child->next;
+	} while (child != NULL);		
+    }
+    goto exit;
+
+choose:
+    /* <!-- Content: (xsl:when+, xsl:otherwise?) --> */
+    /*
+    * TODO: text-nodes in between are *not* allowed in XSLT 1.0.
+    *   The old behaviour did not check this.
+    * NOTE: In XSLT 2.0 they are stripped beforehand
+    *  if whitespace-only (regardless of xml:space).
+    */
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	int nbWhen = 0, nbOtherwise = 0, err = 0;
+	do {
+	    if (child->type == XML_ELEMENT_NODE) {
+		if (IS_XSLT_ELEM_FAST(child)) {
+		    xsltStyleType type;
+		
+		    type = xsltGetXSLTElementTypeByNode(cctxt, child);
+		    if (type == XSLT_FUNC_WHEN) {
+			nbWhen++;
+			if (nbOtherwise) {
+			    xsltParseContentError(cctxt->style, child);
+			    err = 1;
+			    break;
+			}
+			cctxt->inode->curChildType = XSLT_FUNC_WHEN;
+			xsltParseAnyXSLTElem(cctxt, child);
+		    } else if (type == XSLT_FUNC_OTHERWISE) {
+			if (! nbWhen) {
+			    xsltParseContentError(cctxt->style, child);
+			    err = 1;
+			    break;
+			}			
+			if (nbOtherwise) {
+			    xsltTransformError(NULL, cctxt->style, elem,
+				"The XSLT 'choose' element must not contain "
+				"more than one XSLT 'otherwise' element.\n");
+			    cctxt->style->errors++;
+			    err = 1;
+			    break;
+			}
+			nbOtherwise++;
+			cctxt->inode->curChildType = XSLT_FUNC_OTHERWISE;
+			xsltParseAnyXSLTElem(cctxt, child);
+		    } else
+			xsltParseContentError(cctxt->style, child);
+		} else
+		    xsltParseContentError(cctxt->style, child);
+	    } 
+	    /*
+		else
+		    xsltParseContentError(cctxt, child);
+	    */
+	    child = child->next;
+	} while (child != NULL);
+	if ((! err) && (! nbWhen)) {
+	    xsltTransformError(NULL, cctxt->style, elem,
+		"The XSLT element 'choose' must contain at least one "
+		"XSLT element 'when'.\n");
+		cctxt->style->errors++;
+	}	
+    }    
+    goto exit;
+
+for_each:
+    /* <!-- Content: (xsl:sort*, template) --> */
+    /*
+    * NOTE: Text-nodes before xsl:sort are *not* allowed in XSLT 1.0.
+    *   The old behaviour did not allow this, but it catched this
+    *   only at transformation-time.
+    *   In XSLT 2.0 they are stripped beforehand if whitespace-only
+    *   (regardless of xml:space).
+    */
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	/*
+	* Parse xsl:sort first.
+	*/
+	do {	    
+	    if ((child->type == XML_ELEMENT_NODE) &&
+		IS_XSLT_ELEM_FAST(child))
+	    {		
+		if (xsltGetXSLTElementTypeByNode(cctxt, child) ==
+		    XSLT_FUNC_SORT)
+		{		
+		    cctxt->inode->curChildType = XSLT_FUNC_SORT;
+		    xsltParseAnyXSLTElem(cctxt, child);
+		} else
+		    break;
+	    } else
+		break;
+	    child = child->next;
+	} while (child != NULL);
+	/*
+	* Parse the sequece constructor.
+	*/
+	if (child != NULL)
+	    xsltParseSequenceConstructor(cctxt, child);
+    }    
+    goto exit;
+
+sequence_constructor:
+    if (elem->children != NULL)
+	xsltParseSequenceConstructor(cctxt, elem->children);
+    
+exit:
+    xsltCompilerNodePop(cctxt, elem);
+    return(0);
+
+internal_err:
+    xsltCompilerNodePop(cctxt, elem);
+    return(-1);
+}
+
+static xsltStyleItemUknownPtr
+xsltForwardsCompatUnkownItemCreate(xsltCompilerCtxtPtr cctxt)
+{
+    xsltStyleItemUknownPtr item;
+
+    item = (xsltStyleItemUknownPtr) xmlMalloc(sizeof(xsltStyleItemUknown));
+    if (item == NULL) {
+	xsltTransformError(NULL, cctxt->style, NULL,
+	    "Internal error in xsltForwardsCompatUnkownItemCreate(): "
+	    "Failed to allocate memory.\n");
+	cctxt->style->errors++;
+	return(NULL);
+    }
+    memset(item, 0, sizeof(xsltStyleItemUknown));
+    item->type = XSLT_FUNC_UNKOWN_FORWARDS_COMPAT;
+    /*
+    * Store it in the stylesheet.
+    */
+    item->next = cctxt->style->preComps;
+    cctxt->style->preComps = (xsltElemPreCompPtr) item;
+    return(item);
+}
+
+static int
+xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt,
+			    xmlNodePtr node)
+{
+    if ((cctxt == NULL) || (node == NULL))
+	return(-1);
+
+    /*
+    * Detection of handled content of extension instructions.
+    */
+    if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) {
+	cctxt->inode->extContentHandled = 1;
+    }    
+    if (cctxt->inode->forwardsCompat == 0) {	
+	/*
+	* We are not in forwards-compatible mode, so raise an error.
+	*/
+	xsltTransformError(NULL, cctxt->style, node,
+	    "Unknown XSLT element '%s'.\n", node->name);
+	cctxt->style->errors++;
+	return(0);
+    }
+    /*
+    * Forwards-compatible mode.
+    * ------------------------
+    *    
+    * Parse/compile xsl:fallback elements.
+    *
+    * QUESTION: Do we have to raise an error if there's no xsl:fallback?
+    * ANSWER: No, since in the stylesheet the fallback behaviour might
+    *  also be provided by using the XSLT function "element-available".
+    */
+    if (cctxt->unknownItem == NULL) {
+	/*
+	* Create a singleton for all unknown XSLT instructions.
+	*/
+	cctxt->unknownItem = xsltForwardsCompatUnkownItemCreate(cctxt);
+	if (cctxt->unknownItem == NULL) {
+	    node->psvi = NULL;
+	    return(-1);
+	}
+    }
+    node->psvi = cctxt->unknownItem;
+    if (node->children == NULL)
+	return(0);
+    else {
+	xmlNodePtr child = node->children;
+
+	xsltCompilerNodePush(cctxt, node);
+	/*
+	* Update the in-scope namespaces if needed.
+	*/
+	if (node->nsDef != NULL)
+	    cctxt->inode->inScopeNs =
+		xsltCompilerBuildInScopeNsList(cctxt, node);
+	/*
+	* Parse all xsl:fallback children.
+	*/
+	do {
+	    if ((child->type == XML_ELEMENT_NODE) &&
+		IS_XSLT_ELEM_FAST(child) &&
+		IS_XSLT_NAME(child, "fallback"))
+	    {
+		cctxt->inode->curChildType = XSLT_FUNC_FALLBACK;
+		xsltParseAnyXSLTElem(cctxt, child);
+	    }
+	    child = child->next;
+	} while (child != NULL);
+	
+	xsltCompilerNodePop(cctxt, node);
+    }
+    return(0);
+}
 /**
+ * xsltParseSequenceConstructor:
+ *
+ * @cctxt: the compilation context
+ * @cur: the start-node of the content to be parsed
+ *
+ * Parses a "template" content (or "sequence constructor" in XSLT 2.0 terms).
+ * This will additionally remove xsl:text elements from the tree.
+ */ 
+void
+xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur)
+{
+    xsltStyleType type;
+    xmlNodePtr deleteNode = NULL;
+
+    if (cctxt == NULL) {
+	xmlGenericError(xmlGenericErrorContext,
+	    "xsltParseSequenceConstructor: Bad arguments\n");
+	cctxt->style->errors++;
+	return;
+    }
+    /*
+    * Detection of handled content of extension instructions.
+    */
+    if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) {
+	cctxt->inode->extContentHandled = 1;
+    }
+    if (cur == NULL)
+	return;
+    /*
+    * This is the content reffered to as a "template".
+    * E.g. an xsl:element has such content model:
+    * <xsl:element
+    *   name = { qname }
+    *   namespace = { uri-reference }
+    *   use-attribute-sets = qnames>
+    * <!-- Content: template -->
+    *
+    * NOTE that in XSLT-2 the term "template" was abandoned due to
+    *  confusion with xsl:template and the term "sequence constructor"
+    *  was introduced instead.
+    *
+    * The following XSLT-instructions are allowed to appear:
+    *  xsl:apply-templates, xsl:call-template, xsl:apply-imports,
+    *  xsl:for-each, xsl:value-of, xsl:copy-of, xsl:number,
+    *  xsl:choose, xsl:if, xsl:text, xsl:copy, xsl:variable,
+    *  xsl:message, xsl:fallback,
+    *  xsl:processing-instruction, xsl:comment, xsl:element
+    *  xsl:attribute. 
+    * Additional allowed content:
+    * 1) extension instructions
+    * 2) literal result elements
+    * 3) PCDATA
+    *
+    * NOTE that this content model does *not* allow xsl:param.
+    */    
+    while (cur != NULL) {
+	if (deleteNode != NULL)	{
+#ifdef WITH_XSLT_DEBUG_BLANKS
+	    xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltParseSequenceConstructor: removing xsl:text element\n");
+#endif
+	    xmlUnlinkNode(deleteNode);
+	    xmlFreeNode(deleteNode);
+	    deleteNode = NULL;
+	}
+	if (cur->type == XML_ELEMENT_NODE) {	    
+	    
+	    if (cur->psvi == xsltXSLTTextMarker) {
+		/*
+		* xsl:text elements
+		* --------------------------------------------------------
+		*/
+		xmlNodePtr tmp;
+
+		cur->psvi = NULL;
+		/*
+		* Mark the xsl:text element for later deletion.
+		*/
+		deleteNode = cur;
+		/*
+		* Validate content.
+		*/
+		tmp = cur->children;
+		if (tmp) {
+		    /*
+		    * We don't expect more than one text-node in the
+		    * content, since we already merged adjacent
+		    * text/CDATA-nodes and eliminated PI/comment-nodes.
+		    */
+		    if ((tmp->type == XML_TEXT_NODE) ||
+			(tmp->next == NULL))
+		    {
+			/*
+			* Leave the contained text-node in the tree.
+			*/
+			xmlUnlinkNode(tmp);
+			xmlAddPrevSibling(cur, tmp);
+		    } else {
+			tmp = NULL;
+			xsltTransformError(NULL, cctxt->style, cur,
+			    "Element 'xsl:text': Invalid type "
+			    "of node found in content.\n");
+			cctxt->style->errors++;
+		    } 
+		}
+		if (cur->properties) {
+		    xmlAttrPtr attr;
+		    /*
+		    * TODO: We need to report errors for
+		    *  invalid attrs.
+		    */
+		    attr = cur->properties;
+		    do {
+			if ((attr->ns == NULL) &&
+			    (attr->name != NULL) &&
+			    (attr->name[0] == 'd') &&
+			    xmlStrEqual(attr->name,
+			    BAD_CAST "disable-output-escaping"))
+			{
+			    /*
+			    * Attr "disable-output-escaping".
+			    * XSLT-2: This attribute is deprecated.
+			    */
+			    if ((attr->children != NULL) &&
+				xmlStrEqual(attr->children->content,
+				BAD_CAST "yes"))
+			    {
+				/*
+				* Disable output escaping for this
+				* text node.
+				*/
+				if (tmp)
+				    tmp->name = xmlStringTextNoenc;
+			    } else if ((attr->children == NULL) ||
+				(attr->children->content == NULL) ||
+				(!xmlStrEqual(attr->children->content,
+				BAD_CAST "no")))
+			    {
+				xsltTransformError(NULL, cctxt->style,
+				    cur,
+				    "Attribute 'disable-output-escaping': "
+				    "Invalid value. Expected is "
+				    "'yes' or 'no'.\n");
+				cctxt->style->errors++;
+			    }
+			    break;
+			}
+			attr = attr->next;
+		    } while (attr != NULL);
+		}
+	    } else if (IS_XSLT_ELEM_FAST(cur)) {
+		/*
+		* TODO: Using the XSLT-marker is still not stable yet.
+		*/
+		/* if (cur->psvi == xsltXSLTElemMarker) { */	    
+		/*
+		* XSLT instructions
+		* --------------------------------------------------------
+		*/
+		cur->psvi = NULL;
+		type = xsltGetXSLTElementTypeByNode(cctxt, cur);
+		switch (type) {
+		    case XSLT_FUNC_APPLYIMPORTS:
+		    case XSLT_FUNC_APPLYTEMPLATES:
+		    case XSLT_FUNC_ATTRIBUTE:
+		    case XSLT_FUNC_CALLTEMPLATE:
+		    case XSLT_FUNC_CHOOSE:
+		    case XSLT_FUNC_COMMENT:
+		    case XSLT_FUNC_COPY:
+		    case XSLT_FUNC_COPYOF:
+		    case XSLT_FUNC_DOCUMENT: /* Extra one */
+		    case XSLT_FUNC_ELEMENT:
+		    case XSLT_FUNC_FALLBACK:
+		    case XSLT_FUNC_FOREACH:
+		    case XSLT_FUNC_IF:
+		    case XSLT_FUNC_MESSAGE:
+		    case XSLT_FUNC_NUMBER:
+		    case XSLT_FUNC_PI:
+		    case XSLT_FUNC_TEXT:
+		    case XSLT_FUNC_VALUEOF:
+		    case XSLT_FUNC_VARIABLE:
+			/*
+			* Parse the XSLT element.
+			*/
+			cctxt->inode->curChildType = type;
+			xsltParseAnyXSLTElem(cctxt, cur);
+			break;
+		    default:
+			xsltParseUnknownXSLTElem(cctxt, cur);			
+			cur = cur->next;
+			continue;
+		}
+	    } else {
+		/*
+		* Non-XSLT elements
+		* -----------------
+		*/
+		xsltCompilerNodePush(cctxt, cur);
+		/*
+		* Update the in-scope namespaces if needed.
+		*/
+		if (cur->nsDef != NULL)
+		    cctxt->inode->inScopeNs =
+			xsltCompilerBuildInScopeNsList(cctxt, cur);
+		/*
+		* The current element is either a literal result element
+		* or an extension instruction.
+		*
+		* Process attr "xsl:extension-element-prefixes".
+		* FUTURE TODO: IIRC in XSLT 2.0 this attribute must be
+		* processed by the implementor of the extension function;
+		* i.e., it won't be handled by the XSLT processor.
+		*/
+		/* SPEC 1.0:
+		*   "exclude-result-prefixes" is only allowed on literal
+		*   result elements and "xsl:exclude-result-prefixes"
+		*   on xsl:stylesheet/xsl:transform.
+		* SPEC 2.0:
+		*   "There are a number of standard attributes
+		*   that may appear on any XSLT element: specifically
+		*   version, exclude-result-prefixes,
+		*   extension-element-prefixes, xpath-default-namespace,
+		*   default-collation, and use-when."
+		*
+		* SPEC 2.0:
+		*   For literal result elements:
+		*   "xsl:version, xsl:exclude-result-prefixes,
+		*    xsl:extension-element-prefixes,
+		*    xsl:xpath-default-namespace,
+		*    xsl:default-collation, or xsl:use-when."
+		*/
+		if (cur->properties)
+		    cctxt->inode->extElemNs =
+			xsltParseExtElemPrefixes(cctxt,
+			    cur, cctxt->inode->extElemNs,
+			    XSLT_ELEMENT_CATEGORY_LRE);
+		/*
+		* Eval if we have an extension instruction here.
+		*/
+		if ((cur->ns != NULL) &&
+		    (cctxt->inode->extElemNs != NULL) &&
+		    (xsltCheckExtPrefix(cctxt->style, cur->ns->href) == 1))
+		{
+		    /*
+		    * Extension instructions
+		    * ----------------------------------------------------
+		    * Mark the node information.
+		    */
+		    cctxt->inode->category = XSLT_ELEMENT_CATEGORY_EXTENSION;
+		    cctxt->inode->extContentHandled = 0;
+		    if (cur->psvi != NULL) {
+			cur->psvi = NULL;
+			/*
+			* TODO: Temporary sanity check.
+			*/
+			xsltTransformError(NULL, cctxt->style, cur,
+			    "Internal error in xsltParseSequenceConstructor(): "
+			    "Occupied PSVI field.\n");
+			cctxt->style->errors++;
+			cur = cur->next;
+			continue;
+		    }
+		    cur->psvi = (void *)
+			xsltPreComputeExtModuleElement(cctxt->style, cur);
+		    
+		    if (cur->psvi == NULL) {
+			/*
+			* OLD COMMENT: "Unknown element, maybe registered at the
+			*  context level. Mark it for later recognition."
+			* QUESTION: What does the xsltExtMarker mean?
+			*  ANSWER: It is used in xsltApplyOneTemplateInt() at
+			*   transformation-time to look out for extension
+			*   registered in the transformation context.
+			*/
+			cur->psvi = (void *) xsltExtMarker;
+		    }
+		    /*
+		    * BIG NOTE: Now the ugly part. In previous versions
+		    *  of Libxslt (until 1.1.16), all the content of an
+		    *  extension instruction was processed and compiled without
+		    *  the need of the extension-author to explicitely call
+		    *  such a processing;.We now need to mimic this old
+		    *  behaviour in order to avoid breaking old code
+		    *  on the extension-author's side.
+		    * The mechanism:
+		    *  1) If the author does *not* set the
+		    *    compile-time-flag @extContentHandled, then we'll
+		    *    parse the content assuming that it's a "template"
+		    *    (or "sequence constructor in XSLT 2.0 terms).
+		    *    NOTE: If the extension is registered at
+		    *    transformation-time only, then there's no way of
+		    *    knowing that content shall be valid, and we'll
+		    *    process the content the same way.
+		    *  2) If author *does* set the flag, then we'll assume
+		    *   that the author has handled the parsing him/herself
+		    *   (e.g. called xsltParseSequenceConstructor(), etc.
+		    *   explicitely in his/her code).
+		    */
+		    if ((cur->children != NULL) &&
+			(cctxt->inode->extContentHandled == 0))
+		    {
+			/*
+			* Default parsing of the content using the
+			* sequence-constructor model.
+			*/
+			xsltParseSequenceConstructor(cctxt, cur->children);
+		    }
+		} else {
+		    /*
+		    * Literal result element
+		    * ----------------------------------------------------
+		    * Allowed XSLT attributes:
+		    *  xsl:extension-element-prefixes CDATA #IMPLIED
+		    *  xsl:exclude-result-prefixes CDATA #IMPLIED
+		    *  TODO: xsl:use-attribute-sets %qnames; #IMPLIED
+		    *  xsl:version NMTOKEN #IMPLIED
+		    */
+		    cur->psvi = NULL;
+		    cctxt->inode->category = XSLT_ELEMENT_CATEGORY_LRE;
+		    if (cur->properties != NULL) {
+			/*
+			* Attribute "xsl:exclude-result-prefixes".
+			*/
+			cctxt->inode->exclResultNs =
+			    xsltParseExclResultPrefixes(cctxt, cur,
+				cctxt->inode->exclResultNs,
+				XSLT_ELEMENT_CATEGORY_LRE);
+			/*
+			* Attribute "xsl:version".
+			*/
+			xsltParseAttrXSLTVersion(cctxt, cur,
+			    XSLT_ELEMENT_CATEGORY_LRE);
+			/*
+			* Report invalid XSLT attributes.
+			*/
+			if (cur->properties) {
+			    xmlAttrPtr attr = cur->properties;
+
+			    do {
+				if (IS_XSLT_ATTR_FAST(attr) &&
+				    (! xmlStrEqual(attr->name,
+					BAD_CAST "use-attribute-sets")))
+				{				
+				    xsltTransformError(NULL, cctxt->style, cur,
+					"Unknown XSLT attribute '%s'.\n",
+					attr->name);				
+				     cctxt->style->errors++;
+				}
+				attr = attr->next;
+			    } while (attr != NULL);			    
+			}
+		    }
+		    /*
+		    * Create/reuse info for the literal result element.
+		    */
+		    if (cctxt->inode->nsChanged)
+			xsltLREInfoCreate(cctxt, cur, 1);
+		    cur->psvi = cctxt->inode->litResElemInfo;
+		    /*
+		    * Apply ns-aliasing on the element and on its attributes.
+		    */
+		    if (cctxt->hasNsAliases)
+			xsltLREBuildEffectiveNs(cctxt, cur);
+		    /*
+		    * Compile attribute value templates (AVT).
+		    */
+		    if (cur->properties) {
+			xmlAttrPtr attr = cur->properties;
+			
+			while (attr != NULL) {
+			    xsltCompileAttr(cctxt->style, attr);
+			    attr = attr->next;
+			}
+		    }
+		    /*
+		    * Parse the content, which is defined to be a "template"
+		    * (or "sequence constructor" in XSLT 2.0 terms).
+		    */
+		    if (cur->children != NULL) {
+			xsltParseSequenceConstructor(cctxt, cur->children);
+		    }
+		}
+		/*
+		* Leave the non-XSLT element.
+		*/
+		xsltCompilerNodePop(cctxt, cur);
+	    }
+	}
+	cur = cur->next;
+    }
+    if (deleteNode != NULL) {
+#ifdef WITH_XSLT_DEBUG_BLANKS
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "xsltParseSequenceConstructor: removing xsl:text element\n");
+#endif
+	xmlUnlinkNode(deleteNode);
+	xmlFreeNode(deleteNode);
+	deleteNode = NULL;
+    }
+}
+
+/**
  * xsltParseTemplateContent:
  * @style:  the XSLT stylesheet
+ * @templ:  the node containing the content to be parsed
+ *
+ * Parses and compiles the content-model of an xsl:template element.
+ * Note that this is *not* the "template" (or "sequence constructor"
+ *  in XSLT 2.0) content model. Since it allows addional xsl:param
+ *  elements as immediate children of @templ.
+ *
+ * Called by: 
+ *   exsltFuncFunctionComp() (EXSLT, functions.c)
+ *   So this is intended to be called from extension functions.
+ */
+void
+xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
+    if ((style == NULL) || (templ == NULL))
+	return;
+
+    /*
+    * Detection of handled content of extension instructions.
+    */
+    if (XSLT_CCTXT(style)->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) {
+	XSLT_CCTXT(style)->inode->extContentHandled = 1;
+    }
+
+    if (templ->children != NULL) {	
+	xmlNodePtr child = templ->children;
+	/*
+	* Process xsl:param elements, which can only occur as the
+	* immediate children of xsl:template (well, and of any
+	* user-defined extension instruction if needed).
+	*/	
+	do {
+	    if ((child->type == XML_ELEMENT_NODE) &&
+		IS_XSLT_ELEM_FAST(child) &&
+		IS_XSLT_NAME(child, "param"))
+	    {
+		XSLT_CCTXT(style)->inode->curChildType = XSLT_FUNC_PARAM;
+		xsltParseAnyXSLTElem(XSLT_CCTXT(style), child);
+	    } else
+		break;
+	    child = child->next;
+	} while (child != NULL);
+	/*
+	* Parse the content and register the pattern.
+	*/
+	xsltParseSequenceConstructor(XSLT_CCTXT(style), child);
+    }
+}
+
+#else /* XSLT_REFACTORED */
+
+/**
+ * xsltParseTemplateContent:
+ * @style:  the XSLT stylesheet
  * @templ:  the container node (can be a document for literal results)
  *
  * parse a template content-model
  * Clean-up the template content from unwanted ignorable blank nodes
  * and process xslt:text
  */
-
 void
 xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
     xmlNodePtr cur, delete;
@@ -1761,6 +4523,13 @@
 	}
 	if (IS_XSLT_ELEM(cur)) {
 	    if (IS_XSLT_NAME(cur, "text")) {
+		/*
+		* TODO: Processing of xsl:text should be moved to
+		*   xsltPrecomputeStylesheet(), since otherwise this
+		*   will be performed for every multiply included
+		*   stylesheet; i.e. this here is not skipped with
+		*   the use of the style->nopreproc flag.
+		*/
 		if (cur->children != NULL) {
 		    xmlChar *prop;
 		    xmlNodePtr text = cur->children, next;
@@ -1809,7 +4578,8 @@
 		    if (text == NULL) {
 			text = cur->children;
 			while (text != NULL) {
-			    if ((text->content != NULL) &&
+			    if ((style->internalized) &&
+			        (text->content != NULL) &&
 			        (!xmlDictOwns(style->dict, text->content))) {
 
 				/*
@@ -1837,8 +4607,10 @@
 		delete = cur;
 		goto skip_children;
 	    }
-	} else if ((cur->ns != NULL) && (style->nsDefs != NULL) &&
-	           (xsltCheckExtPrefix(style, cur->ns->prefix))) {
+	}
+	else if ((cur->ns != NULL) && (style->nsDefs != NULL) &&
+	    (xsltCheckExtPrefix(style, cur->ns->prefix)))
+	{
 	    /*
 	     * okay this is an extension element compile it too
 	     */
@@ -1862,7 +4634,6 @@
 		}
 	    }
 	}
-
 	/*
 	 * Skip to next node
 	 */
@@ -1930,6 +4701,8 @@
     }
 }
 
+#endif /* else XSLT_REFACTORED */
+
 /**
  * xsltParseStylesheetKey:
  * @style:  the XSLT stylesheet
@@ -1949,7 +4722,7 @@
     xmlChar *name = NULL;
     xmlChar *nameURI = NULL;
 
-    if (key == NULL)
+    if ((style == NULL) || (key == NULL))
 	return;
 
     /*
@@ -2010,9 +4783,235 @@
 	xmlFree(name);
     if (nameURI != NULL)
 	xmlFree(nameURI);
+
+    if (key->children != NULL) {
+	xsltParseContentError(style, key->children);
+    }
 }
 
+#ifdef XSLT_REFACTORED
 /**
+ * xsltParseXSLTTemplate:
+ * @style:  the XSLT stylesheet
+ * @template:  the "template" element
+ *
+ * parse an XSLT stylesheet template building the associated structures
+ * TODO: Is @style ever expected to be NULL?
+ *
+ * Called from:
+ *   xsltParseXSLTStylesheet()
+ *   xsltParseStylesheetTop()
+ */
+
+static void
+xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) {
+    xsltTemplatePtr templ;
+    xmlChar *prop;    
+    double  priority;    
+
+    if ((cctxt == NULL) || (templNode == NULL))
+	return;
+
+    /*
+     * Create and link the structure
+     */
+    templ = xsltNewTemplate();
+    if (templ == NULL)
+	return;
+
+    xsltCompilerNodePush(cctxt, templNode);
+    if (templNode->nsDef != NULL)
+	cctxt->inode->inScopeNs =
+	    xsltCompilerBuildInScopeNsList(cctxt, templNode);
+
+    templ->next = cctxt->style->templates;
+    cctxt->style->templates = templ;
+    templ->style = cctxt->style;
+   
+
+    /*
+    * Get inherited namespaces.
+    */
+    if (cctxt->inode->inScopeNs != NULL) {
+	int i, j;
+	xmlNsPtr ns;
+	xsltPointerListPtr extElemNs = cctxt->inode->extElemNs;
+	xsltPointerListPtr exclResultNs = cctxt->inode->exclResultNs;
+	xsltNsListContainerPtr inScopeNs = cctxt->inode->inScopeNs;
+
+	for (i = 0; i < inScopeNs->number; i++) {
+	    ns = inScopeNs->list[i];
+	    /*
+	    * Exclude the XSLT namespace.
+	    */
+	    if (xmlStrEqual(ns->href, XSLT_NAMESPACE))
+		goto skip_ns;
+	    /*
+	    * Exclude excluded result namespaces.
+	    */
+	    if (exclResultNs) {
+		for (j = 0; j < exclResultNs->number; j++)
+		    if (xmlStrEqual(ns->href, BAD_CAST exclResultNs->items[j]))
+			goto skip_ns;		
+	    }
+	    /*
+	    * Exclude extension-element namespaces.
+	    */
+	    if (extElemNs) {
+		for (j = 0; j < extElemNs->number; j++)
+		    if (xmlStrEqual(ns->href, BAD_CAST extElemNs->items[j]))
+			goto skip_ns;
+	    }
+	    /*
+	    * Add the xmlNs item.
+	    */
+	    if (templ->inheritedNs == NULL) {
+		templ->inheritedNs = (xmlNsPtr *) xmlMalloc(
+		    inScopeNs->number * sizeof(xmlNsPtr));
+		if (templ->inheritedNs == NULL) {
+		    xmlGenericError(xmlGenericErrorContext,
+			"xsltGetInheritedNsList : out of memory!\n");
+		    cctxt->style->errors++;
+		    goto error;
+		}
+		memset(templ->inheritedNs, 0,
+		    inScopeNs->number * sizeof(xmlNsPtr));
+	    }
+	    templ->inheritedNs[templ->inheritedNsNr++] = ns;
+skip_ns:
+	    {}
+	}	
+#ifdef WITH_XSLT_DEBUG_PARSING
+	if (templ->inheritedNsNr != 0) {
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"xsl:template has %d inherited namespaces\n",
+		templ->inheritedNsNr);
+	}
+#endif
+    }
+
+    /*
+    * Attribute "mode".
+    */
+    prop = xmlGetNsProp(templNode, (const xmlChar *)"mode", NULL);
+    if (prop != NULL) {	
+        const xmlChar *modeURI;
+
+	/*
+	* TODO: We need a standardized function for extraction
+	*  of namespace names and local names from QNames.
+	*/
+	modeURI = xsltGetQNameURI(templNode, &prop);
+	if (prop == NULL) {
+	    cctxt->style->errors++;
+	    goto error;
+	}
+	templ->mode = xmlDictLookup(cctxt->style->dict, prop, -1);
+	xmlFree(prop);
+	prop = NULL;
+	if (xmlValidateNCName(templ->mode, 0)) {
+	    xsltTransformError(NULL, cctxt->style, templNode,
+		"xsl:template: Attribute 'mode': The local part '%s' "
+		"of the value is not a valid NCName.\n", templ->name);
+	    cctxt->style->errors++;
+	    goto error;
+	}
+	if (modeURI != NULL)
+	    templ->modeURI = xmlDictLookup(cctxt->style->dict, modeURI, -1);
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltParseXSLTTemplate: mode %s\n", templ->mode);
+#endif
+    }
+    /*
+    * Attribute "match".
+    */
+    prop = xmlGetNsProp(templNode, (const xmlChar *)"match", NULL);
+    if (prop != NULL) {
+	templ->match  = prop;
+	prop = NULL;
+    }
+    /*
+    * Attribute "priority".
+    */
+    prop = xmlGetNsProp(templNode, (const xmlChar *)"priority", NULL);
+    if (prop != NULL) {
+	priority = xmlXPathStringEvalNumber(prop);
+	templ->priority = (float) priority;
+	xmlFree(prop);
+	prop = NULL;
+    }
+    /*
+    * Attribute "name".
+    */
+    prop = xmlGetNsProp(templNode, (const xmlChar *)"name", NULL);
+    if (prop != NULL) {
+        const xmlChar *nameURI;
+	xsltTemplatePtr curTempl;
+	
+	nameURI = xsltGetQNameURI(templNode, &prop);
+	if (prop == NULL) {
+	    cctxt->style->errors++;
+	    goto error;
+	}
+	templ->name = xmlDictLookup(cctxt->style->dict, prop, -1);
+	xmlFree(prop);
+	prop = NULL;
+	if (xmlValidateNCName(templ->name, 0)) {
+	    xsltTransformError(NULL, cctxt->style, templNode,
+		"xsl:template: Attribute 'name': The local part '%s' of "
+		"the value is not a valid NCName.\n", templ->name);
+	    cctxt->style->errors++;
+	    goto error;
+	} 	
+	if (nameURI != NULL)
+	    templ->nameURI = xmlDictLookup(cctxt->style->dict, nameURI, -1);
+	curTempl = templ->next;
+	while (curTempl != NULL) {
+	    if ((nameURI != NULL && xmlStrEqual(curTempl->name, templ->name) &&
+		xmlStrEqual(curTempl->nameURI, nameURI) ) ||
+		(nameURI == NULL && curTempl->nameURI == NULL &&
+		xmlStrEqual(curTempl->name, templ->name)))
+	    {
+		xsltTransformError(NULL, cctxt->style, templNode,
+		    "xsl:template: error duplicate name '%s'\n", templ->name);
+		cctxt->style->errors++;
+		goto error;
+	    }
+	    curTempl = curTempl->next;
+	}
+    }
+    if (templNode->children != NULL) {
+	xsltParseTemplateContent(cctxt->style, templNode);	
+	/*
+	* MAYBE TODO: Custom behaviour: In order to stay compatible with
+	* Xalan and MSXML(.NET), we could allow whitespace
+	* to appear before an xml:param element; this whitespace
+	* will additionally become part of the "template".
+	* NOTE that this is totally deviates from the spec, but
+	* is the de facto behaviour of Xalan and MSXML(.NET).
+	* Personally I wouldn't allow this, since if we have:
+	* <xsl:template ...xml:space="preserve">
+	*   <xsl:param name="foo"/>
+	*   <xsl:param name="bar"/>
+	*   <xsl:param name="zoo"/>
+	* ... the whitespace between every xsl:param would be
+	* added to the result tree.
+	*/		
+    }    
+    
+    templ->elem = templNode;
+    templ->content = templNode->children;
+    xsltAddTemplate(cctxt->style, templ, templ->mode, templ->modeURI);
+
+error:
+    xsltCompilerNodePop(cctxt, templNode);
+    return;
+}
+
+#else /* XSLT_REFACTORED */
+
+/**
  * xsltParseStylesheetTemplate:
  * @style:  the XSLT stylesheet
  * @template:  the "template" element
@@ -2092,16 +5091,7 @@
     if (prop != NULL) {
         const xmlChar *URI;
 	xsltTemplatePtr cur;
-
-	if (ret->name != NULL) {
-	    xmlFree(ret->name);
-	    ret->name = NULL;
-	}
-	if (ret->nameURI != NULL) {
-	    xmlFree(ret->nameURI);
-	    ret->nameURI = NULL;
-	}
-
+	
 	URI = xsltGetQNameURI(template, &prop);
 	if (prop == NULL) {
 	    if (style != NULL) style->errors++;
@@ -2112,20 +5102,22 @@
 	            "xsl:template : error invalid name '%s'\n", prop);
 		if (style != NULL) style->errors++;
 		goto error;
-	    } 
-	    ret->name = prop;
+	    }
+	    ret->name = xmlDictLookup(style->dict, BAD_CAST prop, -1);
+	    xmlFree(prop);
+	    prop = NULL;
 	    if (URI != NULL)
-		ret->nameURI = xmlStrdup(URI);
+		ret->nameURI = xmlDictLookup(style->dict, BAD_CAST URI, -1);
 	    else
 		ret->nameURI = NULL;
 	    cur = ret->next;
 	    while (cur != NULL) {
-	        if ((URI != NULL && xmlStrEqual(cur->name, prop) &&
+	        if ((URI != NULL && xmlStrEqual(cur->name, ret->name) &&
 				xmlStrEqual(cur->nameURI, URI) ) ||
 		    (URI == NULL && cur->nameURI == NULL &&
-				xmlStrEqual(cur->name, prop))) {
+				xmlStrEqual(cur->name, ret->name))) {
 		    xsltTransformError(NULL, style, template,
-		        "xsl:template: error duplicate name '%s'\n", prop);
+		        "xsl:template: error duplicate name '%s'\n", ret->name);
 		    style->errors++;
 		    goto error;
 		}
@@ -2146,87 +5138,615 @@
     return;
 }
 
-#ifdef XSLT_REFACTORED_PARSING
-/*
-* xsltParseStylesheetTreeNew:
-*
-* Parses and compiles an XSLT stylesheet's XML tree.
-*
-* TODO: Adjust error report text.
-*/
+#endif /* else XSLT_REFACTORED */
+
+#ifdef XSLT_REFACTORED
+
+/**
+ * xsltIncludeComp:
+ * @cctxt: the compilation contenxt
+ * @node:  the xsl:include node
+ *
+ * Process the xslt include node on the source node
+ */
+static xsltStyleItemIncludePtr
+xsltCompileXSLTIncludeElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) {
+    xsltStyleItemIncludePtr item;
+
+    if ((cctxt == NULL) || (node == NULL))
+	return(NULL);
+
+    node->psvi = NULL;
+    item = (xsltStyleItemIncludePtr) xmlMalloc(sizeof(xsltStyleItemInclude));
+    if (item == NULL) {
+	xsltTransformError(NULL, cctxt->style, node,
+		"xsltIncludeComp : malloc failed\n");
+	cctxt->style->errors++;
+	return(NULL);
+    }
+    memset(item, 0, sizeof(xsltStyleItemInclude));
+
+    node->psvi = item;
+    item->inst = node;
+    item->type = XSLT_FUNC_INCLUDE;
+
+    item->next = cctxt->style->preComps;
+    cctxt->style->preComps = (xsltElemPreCompPtr) item;
+
+    return(item);
+}
+
+/**
+ * xsltParseFindTopLevelElem:
+ */
 static int
-xsltParseStylesheetTreeNew(xsltStylesheetPtr sheet, xmlNodePtr cur)
+xsltParseFindTopLevelElem(xsltCompilerCtxtPtr cctxt,
+			      xmlNodePtr cur,
+			      const xmlChar *name,
+			      const xmlChar *namespaceURI,
+			      int breakOnOtherElem,			      
+			      xmlNodePtr *resultNode)
 {
-    xsltCompilerCtxtPtr cctxt;
-    xmlNodePtr top = cur;
-    int depth = 0, simpleSyntax = 0;
-
-    if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE) ||
-	(sheet == NULL) || (sheet->compCtxt == NULL))
+    if (name == NULL)
 	return(-1);
-    cctxt = (xsltCompilerCtxtPtr) sheet->compCtxt;
 
+    *resultNode = NULL;
+    while (cur != NULL) {
+	if (cur->type == XML_ELEMENT_NODE) {
+	    if ((cur->ns != NULL) && (cur->name != NULL)) {
+		if ((*(cur->name) == *name) &&
+		    xmlStrEqual(cur->name, name) &&
+		    xmlStrEqual(cur->ns->href, namespaceURI))		    
+		{
+		    *resultNode = cur;
+		    return(1);
+		}
+	    }
+	    if (breakOnOtherElem)
+		break;
+	}
+	cur = cur->next;
+    }
+    *resultNode = cur;
+    return(0);
+}
+
+static int
+xsltParseTopLevelXSLTElem(xsltCompilerCtxtPtr cctxt,
+			  xmlNodePtr node,
+			  xsltStyleType type)
+{
+    int ret = 0;
+
     /*
-    * Evalute if we have a simplified syntax.
+    * TODO: The reason why this function exists:
+    *  due to historical reasons some of the
+    *  top-level declarations are processed by functions
+    *  in other files. Since we need still to set
+    *  up the node-info and generate information like
+    *  in-scope namespaces, this is a wrapper around
+    *  those old parsing functions.
     */
-    if ((IS_XSLT_ELEM(cur)) && 
-	((IS_XSLT_NAME(cur, "stylesheet")) ||
-	 (IS_XSLT_NAME(cur, "transform"))))
-    {	
+    xsltCompilerNodePush(cctxt, node);
+    if (node->nsDef != NULL)
+	cctxt->inode->inScopeNs =
+	    xsltCompilerBuildInScopeNsList(cctxt, node);
+    cctxt->inode->type = type;
+
+    switch (type) {
+	case XSLT_FUNC_INCLUDE:
+	    {
+		int oldIsInclude;
+
+		if (xsltCompileXSLTIncludeElem(cctxt, node) == NULL)
+		    goto exit;		
+		/*
+		* Mark this stylesheet tree as being currently included.
+		*/
+		oldIsInclude = cctxt->isInclude;
+		cctxt->isInclude = 1;
+						
+		if (xsltParseStylesheetInclude(cctxt->style, node) != 0) {
+		    cctxt->style->errors++;
+		}
+		cctxt->isInclude = oldIsInclude;
+	    }
+	    break;
+	case XSLT_FUNC_PARAM:
+	    xsltStylePreCompute(cctxt->style, node);
+	    xsltParseGlobalParam(cctxt->style, node);
+	    break;
+	case XSLT_FUNC_VARIABLE:
+	    xsltStylePreCompute(cctxt->style, node);
+	    xsltParseGlobalVariable(cctxt->style, node);
+	    break;
+	case XSLT_FUNC_ATTRSET:
+	    xsltParseStylesheetAttributeSet(cctxt->style, node);
+	    break;
+	default:
+	    xsltTransformError(NULL, cctxt->style, node,
+		"Internal error: (xsltParseTopLevelXSLTElem) "
+		"Cannot handle this top-level declaration.\n");
+	    cctxt->style->errors++;
+	    ret = -1;
+    }
+
+exit:
+    xsltCompilerNodePop(cctxt, node);
+
+    return(ret);
+}
+
+#if 0
+static int
+xsltParseRemoveWhitespace(xmlNodePtr node)
+{
+    if ((node == NULL) || (node->children == NULL))
+	return(0);
+    else {
+	xmlNodePtr delNode = NULL, child = node->children;
+
+	do {
+	    if (delNode) {
+		xmlUnlinkNode(delNode);
+		xmlFreeNode(delNode);
+		delNode = NULL;
+	    }
+	    if (((child->type == XML_TEXT_NODE) ||
+		 (child->type == XML_CDATA_SECTION_NODE)) &&
+		(IS_BLANK_NODE(child)))
+		delNode = child;	    
+	    child = child->next;
+	} while (child != NULL);
+	if (delNode) {
+	    xmlUnlinkNode(delNode);
+	    xmlFreeNode(delNode);
+	    delNode = NULL;
+	}
+    }
+    return(0);
+}
+#endif
+
+static int
+xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{
 #ifdef WITH_XSLT_DEBUG_PARSING
-	xsltGenericDebug(xsltGenericDebugContext,
-		"xsltParseStylesheetProcess : found stylesheet\n");
+    int templates = 0;
 #endif
+    xmlNodePtr cur, start = NULL;
+    xsltStylesheetPtr style;
+
+    if ((cctxt == NULL) || (node == NULL) ||
+	(node->type != XML_ELEMENT_NODE))
+	return(-1);    
+
+    style = cctxt->style;    
+    /*
+    * At this stage all import declarations of all stylesheet modules
+    * with the same stylesheet level have been processed.
+    * Now we can safely parse the rest of the declarations.
+    */
+    if (IS_XSLT_ELEM_FAST(node) && IS_XSLT_NAME(node, "include"))
+    {
+	xsltDocumentPtr include;
 	/*
-	* TODO: Initialize.
+	* URGENT TODO: Make this work with simplified stylesheets!
+	*   I.e., when we won't find an xsl:stylesheet element.
 	*/
-    } else {
-	simpleSyntax = 1;	
 	/*
-	* TODO: Create the initial template.
-	* TODO: Initialize.
+	* This is as include declaration.
 	*/
-    }        
+	include = ((xsltStyleItemIncludePtr) node->psvi)->include;
+	if (include == NULL) {
+	    /* TODO: raise error? */
+	    return(-1);
+	}
+	/*
+	* TODO: Actually an xsl:include should locate an embedded
+	*  stylesheet as well; so the document-element won't always
+	*  be the element where the actual stylesheet is rooted at.
+	*  But such embedded stylesheets are not supported by Libxslt yet.
+	*/
+	node = xmlDocGetRootElement(include->doc);
+	if (node == NULL) {
+	    return(-1);
+	}
+    }    
+    
+    if (node->children == NULL)
+	return(0);
     /*
-    * Reset the compiler context.
+    * Push the xsl:stylesheet/xsl:transform element.
+    */  
+    xsltCompilerNodePush(cctxt, node);
+    cctxt->inode->isRoot = 1;
+    cctxt->inode->nsChanged = 0;
+    /*
+    * Start with the naked dummy info for literal result elements.
     */
-    cctxt->depth = 0;
-    cctxt->inode = NULL;
+    cctxt->inode->litResElemInfo = cctxt->inodeList->litResElemInfo;
+
     /*
-    * Initialize the in-scope namespaces. We need to have
-    * the in-scope ns-decls of the first given node, regardless
-    * if it's a XSLT instruction or a literal result element.
+    * In every case, we need to have
+    * the in-scope namespaces of the element, where the
+    * stylesheet is rooted at, regardless if it's an XSLT
+    * instruction or a literal result instruction (or if
+    * this is an embedded stylesheet).
+    */		
+    cctxt->inode->inScopeNs =
+	xsltCompilerBuildInScopeNsList(cctxt, node);
+
+    /*
+    * Process attributes of xsl:stylesheet/xsl:transform.
+    * --------------------------------------------------
+    * Allowed are:
+    *  id = id
+    *  extension-element-prefixes = tokens
+    *  exclude-result-prefixes = tokens
+    *  version = number (mandatory)    
     */
-    xsltCompilerNodePush(cctxt, cur);
-    xsltCompilerGetInScopeNSInfo(cctxt, cur);
-    goto next_sibling;
-
+    if (xsltParseAttrXSLTVersion(cctxt, node,
+	XSLT_ELEMENT_CATEGORY_XSLT) == 0)
+    {    
+	/*
+	* Attribute "version".
+	* XSLT 1.0: "An xsl:stylesheet element *must* have a version
+	*  attribute, indicating the version of XSLT that the
+	*  stylesheet requires".
+	* The root element of a simplified stylesheet must also have
+	* this attribute.
+	*/
+#ifdef XSLT_REFACTORED_MANDATORY_VERSION
+	if (isXsltElem)
+	    xsltTransformError(NULL, cctxt->style, node,
+		"The attribute 'version' is missing.\n");
+	cctxt->style->errors++;	
+#else
+	/* OLD behaviour. */
+	xsltTransformError(NULL, cctxt->style, node,
+	    "xsl:version is missing: document may not be a stylesheet\n");
+	cctxt->style->warnings++;
+#endif
+    }    
+    /*
+    * The namespaces declared by the attributes
+    *  "extension-element-prefixes" and
+    *  "exclude-result-prefixes" are local to *this*
+    *  stylesheet tree; i.e., they are *not* visible to
+    *  other stylesheet-modules, whether imported or included.
+    * 
+    * Attribute "extension-element-prefixes".
+    */
+    cctxt->inode->extElemNs =
+	xsltParseExtElemPrefixes(cctxt, node, NULL,
+	    XSLT_ELEMENT_CATEGORY_XSLT);
+    /*
+    * Attribute "exclude-result-prefixes".
+    */
+    cctxt->inode->exclResultNs =
+	xsltParseExclResultPrefixes(cctxt, node, NULL,
+	    XSLT_ELEMENT_CATEGORY_XSLT);
+    /*
+    * Create/reuse info for the literal result element.
+    */
+    if (cctxt->inode->nsChanged)
+	xsltLREInfoCreate(cctxt, node, 0);
+    /*
+    * Processed top-level elements:
+    * ----------------------------
+    *  xsl:variable, xsl:param (QName, in-scope ns,
+    *    expression (vars allowed))
+    *  xsl:attribute-set (QName, in-scope ns)
+    *  xsl:strip-space, xsl:preserve-space (XPath NameTests,
+    *    in-scope ns)
+    *    I *think* global scope, merge with includes
+    *  xsl:output (QName, in-scope ns)
+    *  xsl:key (QName, in-scope ns, pattern,
+    *    expression (vars *not* allowed))
+    *  xsl:decimal-format (QName, needs in-scope ns)
+    *  xsl:namespace-alias (in-scope ns)
+    *    global scope, merge with includes
+    *  xsl:template (last, QName, pattern)
+    *
+    * (whitespace-only text-nodes have *not* been removed
+    *  yet; this will be done in xsltParseSequenceConstructor)
+    *
+    * Report misplaced child-nodes first.
+    */
+    cur = node->children;
     while (cur != NULL) {
-	if (cur->type == XML_ELEMENT_NODE) {
-	    
+	if (cur->type == XML_TEXT_NODE) {
+	    xsltTransformError(NULL, style, cur,
+		"Misplaced text node (content: '%s').\n",
+		(cur->content != NULL) ? cur->content : BAD_CAST "");
+	    style->errors++;
+	} else if (cur->type != XML_ELEMENT_NODE) {
+	    xsltTransformError(NULL, style, cur, "Misplaced node.\n");
+	    style->errors++;
 	}
+	cur = cur->next;
+    }
+    /*
+    * Skip xsl:import elements; they have been processed
+    * already.
+    */
+    cur = node->children;
+    while ((cur != NULL) && xsltParseFindTopLevelElem(cctxt, cur,
+	    BAD_CAST "import", XSLT_NAMESPACE, 1, &cur) == 1)
+	cur = cur->next;
+    if (cur == NULL)
+	goto exit;
 
-next_sibling:
-	if (cur->type == XML_ELEMENT_NODE) {
+    start = cur;
+    /*
+    * Process all top-level xsl:param elements.
+    */
+    while ((cur != NULL) &&
+	xsltParseFindTopLevelElem(cctxt, cur,
+	BAD_CAST "param", XSLT_NAMESPACE, 0, &cur) == 1)
+    {
+	xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_PARAM);	
+	cur = cur->next;
+    }  
+    /*
+    * Process all top-level xsl:variable elements.
+    */
+    cur = start;
+    while ((cur != NULL) &&
+	xsltParseFindTopLevelElem(cctxt, cur,
+	BAD_CAST "variable", XSLT_NAMESPACE, 0, &cur) == 1)
+    {
+	xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_VARIABLE);
+	cur = cur->next;
+    }   
+    /*
+    * Process all the rest of top-level elements.
+    */
+    cur = start;
+    while (cur != NULL) {	
+	/*
+	* Process element nodes.
+	*/
+	if (cur->type == XML_ELEMENT_NODE) {	    
+	    if (cur->ns == NULL) {
+		xsltTransformError(NULL, style, cur,
+		    "Unexpected top-level element in no namespace.\n");
+		style->errors++;
+		cur = cur->next;
+		continue;
+	    }
 	    /*
-	    * Leaving an element.
+	    * Process all XSLT elements.
 	    */
-	    xsltCompilerNodePop(cctxt, cur);
+	    if (IS_XSLT_ELEM_FAST(cur)) {
+		/*
+		* xsl:import is only allowed at the beginning.
+		*/
+		if (IS_XSLT_NAME(cur, "import")) {
+		    xsltTransformError(NULL, style, cur,
+			"Misplaced xsl:import element.\n");
+		    style->errors++;
+		    cur = cur->next;
+		    continue;
+		}
+		/* 
+		* TODO: Change the return type of the parsing functions
+		*  to int.
+		*/
+		if (IS_XSLT_NAME(cur, "template")) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+		    templates++;
+#endif
+		    /*
+		    * TODO: Is the position of xsl:template in the
+		    *  tree significant? If not it would be easier to
+		    *  parse them at a later stage.
+		    */
+		    xsltParseXSLTTemplate(cctxt, cur);
+		} else if (IS_XSLT_NAME(cur, "variable")) {
+		    /* NOP; done already */
+		} else if (IS_XSLT_NAME(cur, "param")) {
+		    /* NOP; done already */
+		} else if (IS_XSLT_NAME(cur, "include")) {		    
+		    if (cur->psvi != NULL)		    
+			xsltParseXSLTStylesheetElemCore(cctxt, cur);
+		    else {
+			xsltTransformError(NULL, style, cur,
+			    "Internal error: "
+			    "(xsltParseXSLTStylesheetElemCore) "
+			    "The xsl:include element was not compiled.\n");
+			style->errors++;
+		    }
+		} else if (IS_XSLT_NAME(cur, "strip-space")) {
+		    /* No node info needed. */
+		    xsltParseStylesheetStripSpace(style, cur);
+		} else if (IS_XSLT_NAME(cur, "preserve-space")) {
+		    /* No node info needed. */
+		    xsltParseStylesheetPreserveSpace(style, cur);
+		} else if (IS_XSLT_NAME(cur, "output")) {
+		    /* No node-info needed. */
+		    xsltParseStylesheetOutput(style, cur);
+		} else if (IS_XSLT_NAME(cur, "key")) {
+		    /* TODO: node-info needed for expressions ? */
+		    xsltParseStylesheetKey(style, cur);
+		} else if (IS_XSLT_NAME(cur, "decimal-format")) {
+		    /* No node-info needed. */		     
+		    xsltParseStylesheetDecimalFormat(style, cur);
+		} else if (IS_XSLT_NAME(cur, "attribute-set")) {		    
+		    xsltParseTopLevelXSLTElem(cctxt, cur,
+			XSLT_FUNC_ATTRSET);		
+		} else if (IS_XSLT_NAME(cur, "namespace-alias")) {
+		    /* NOP; done already */		    
+		} else {
+		    if (cctxt->inode->forwardsCompat) {
+			/*
+			* Forwards-compatible mode:
+			*
+			* XSLT-1: "if it is a top-level element and
+			*  XSLT 1.0 does not allow such elements as top-level
+			*  elements, then the element must be ignored along
+			*  with its content;"
+			*/
+			/*
+			* TODO: I don't think we should generate a warning.
+			*/
+			xsltTransformError(NULL, style, cur,
+			    "Forwards-compatible mode: Ignoring unknown XSLT "
+			    "element '%s'.\n", cur->name);
+			style->warnings++;
+		    } else {
+			xsltTransformError(NULL, style, cur,
+			    "Unknown XSLT element '%s'.\n", cur->name);
+			style->errors++;
+		    }
+		}
+	    } else {
+		xsltTopLevelFunction function;
+
+		/*
+		* Process non-XSLT elements, which are in a
+		*  non-NULL namespace.
+		*/
+		/*
+		* QUESTION: What does xsltExtModuleTopLevelLookup()
+		*  do exactly?
+		*/
+		function = xsltExtModuleTopLevelLookup(cur->name,
+		    cur->ns->href);
+		if (function != NULL)
+		    function(style, cur);
+#ifdef WITH_XSLT_DEBUG_PARSING
+		xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltParseXSLTStylesheetElemCore : User-defined "
+		    "data element '%s'.\n", cur->name);
+#endif
+	    }
 	}
-	if (cur == top)
-	    break;
-	if (cur->next != NULL)
-	    cur = cur->next;
-	else {
-	    cur = cur->parent;
-	    goto next_sibling;
-	}	
+	cur = cur->next;
     }
+
+exit:
+
+#ifdef WITH_XSLT_DEBUG_PARSING
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### END of parsing top-level elements of doc '%s'.\n",
+	node->doc->URL);
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### Templates: %d\n", templates);
+#ifdef XSLT_REFACTORED
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### Max inodes: %d\n", cctxt->maxNodeInfos);
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### Max LREs  : %d\n", cctxt->maxLREs);
+#endif /* XSLT_REFACTORED */
+#endif /* WITH_XSLT_DEBUG_PARSING */
+
+    xsltCompilerNodePop(cctxt, node);
     return(0);
 }
-#endif /* XSLT_REFACTORED_PARSING */
 
 /**
+ * xsltParseXSLTStylesheet:
+ * @cctxt: the compiler context
+ * @node: the xsl:stylesheet/xsl:transform element-node
+ *
+ * Parses the xsl:stylesheet and xsl:transform element. 
+ *
+ * <xsl:stylesheet
+ *  id = id
+ *  extension-element-prefixes = tokens
+ *  exclude-result-prefixes = tokens
+ *  version = number>
+ *  <!-- Content: (xsl:import*, top-level-elements) -->
+ * </xsl:stylesheet>
+ *
+ * BIG TODO: The xsl:include stuff.
+ * 
+ * Called by xsltParseStylesheetTree()
+ *
+ * Returns 0 on success, a positive result on errors and
+ *         -1 on API or internal errors.
+ */
+static int
+xsltParseXSLTStylesheetElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{
+    xmlNodePtr cur, start;
+
+    if ((cctxt == NULL) || (node == NULL))
+	return(-1);
+    
+    if (node->children == NULL)
+	goto exit;
+
+    /*
+    * Process top-level elements:
+    *  xsl:import (must be first)
+    *  xsl:include (this is just a pre-processing)
+    */
+    cur = node->children;
+    /*
+    * Process xsl:import elements.
+    * XSLT 1.0: "The xsl:import element children must precede all
+    *  other element children of an xsl:stylesheet element,
+    *  including any xsl:include element children."
+    */    
+    while ((cur != NULL) &&
+	xsltParseFindTopLevelElem(cctxt, cur,
+	    BAD_CAST "import", XSLT_NAMESPACE, 1, &cur) == 1)
+    {
+	if (xsltParseStylesheetImport(cctxt->style, cur) != 0) {
+	    cctxt->style->errors++;
+	}
+	cur = cur->next;
+    }
+    if (cur == NULL)
+	goto exit;
+    start = cur;
+    /*
+    * Pre-process all xsl:include elements.
+    */
+    cur = start;
+    while ((cur != NULL) &&
+	xsltParseFindTopLevelElem(cctxt, cur,
+	    BAD_CAST "include", XSLT_NAMESPACE, 0, &cur) == 1)
+    {
+	xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_INCLUDE);
+	cur = cur->next;
+    }
+    /*
+    * Pre-process all xsl:namespace-alias elements.
+    * URGENT TODO: This won't work correctly: the order of included
+    *  aliases and aliases defined here is significant.
+    */
+    cur = start;
+    while ((cur != NULL) &&
+	xsltParseFindTopLevelElem(cctxt, cur,
+	    BAD_CAST "namespace-alias", XSLT_NAMESPACE, 0, &cur) == 1)
+    {
+	xsltNamespaceAlias(cctxt->style, cur);
+	cur = cur->next;
+    }
+
+    if (cctxt->isInclude) {
+	/*
+	* If this stylesheet is intended for inclusion, then
+	* we will process only imports and includes. 
+	*/
+	goto exit;
+    } 
+    /*
+    * Now parse the rest of the top-level elements.
+    */
+    xsltParseXSLTStylesheetElemCore(cctxt, node); 	
+exit:
+
+    return(0);
+}
+
+#else /* XSLT_REFACTORED */
+
+/**
  * xsltParseStylesheetTop:
  * @style:  the XSLT stylesheet
  * @top:  the top level "stylesheet" or "transform" element
@@ -2289,7 +5809,7 @@
 	if (cur->type == XML_TEXT_NODE) {
 	    if (cur->content != NULL) {
 		xsltTransformError(NULL, style, cur,
-		    "misplaced text element: '%s'\n", cur->content);
+		    "misplaced text node: '%s'\n", cur->content);
 	    }
 	    if (style != NULL) style->errors++;
             cur = cur->next;
@@ -2350,6 +5870,10 @@
     } else if (IS_XSLT_NAME(cur, "namespace-alias")) {
 	    xsltNamespaceAlias(style, cur);
 	} else {
+	    /*
+	    * BUG TODO: The version of the *doc* is irrelevant for
+	    *  the forwards-compatible mode.
+	    */
             if ((style != NULL) && (style->doc->version != NULL) &&
 	        (!strncmp((const char *) style->doc->version, "1.0", 3))) {
 	        xsltTransformError(NULL, style, cur,
@@ -2373,17 +5897,178 @@
 #endif
 }
 
+#endif /* else of XSLT_REFACTORED */
+
+#ifdef XSLT_REFACTORED
 /**
+ * xsltParseSimplifiedStylesheetTree:
+ *
+ * @style: the stylesheet (TODO: Change this to the compiler context)
+ * @doc: the document containing the stylesheet.
+ * @node: the node where the stylesheet is rooted at
+ *
+ * Returns 0 in case of success, a positive result if an error occurred
+ *         and -1 on API and internal errors.
+ */
+static int
+xsltParseSimplifiedStylesheetTree(xsltCompilerCtxtPtr cctxt,
+				  xmlDocPtr doc,
+				  xmlNodePtr node)
+{
+    xsltTemplatePtr templ;
+    
+    if ((cctxt == NULL) || (node == NULL))
+	return(-1);
+
+    if (xsltParseAttrXSLTVersion(cctxt, node, 0) == XSLT_ELEMENT_CATEGORY_LRE)
+    {
+	/*
+	* TODO: Adjust report, since this might be an
+	* embedded stylesheet.
+	*/
+	xsltTransformError(NULL, cctxt->style, node,
+	    "The attribute 'xsl:version' is missing; cannot identify "
+	    "this document as an XSLT stylesheet document.\n");
+	cctxt->style->errors++;
+	return(1);
+    }
+    
+#ifdef WITH_XSLT_DEBUG_PARSING
+    xsltGenericDebug(xsltGenericDebugContext,
+	"xsltParseSimplifiedStylesheetTree: document is stylesheet\n");
+#endif        
+    
+    /*
+    * Create and link the template
+    */
+    templ = xsltNewTemplate();
+    if (templ == NULL) {
+	return(-1);
+    }
+    templ->next = cctxt->style->templates;
+    cctxt->style->templates = templ;
+    templ->match = xmlStrdup(BAD_CAST "/");
+
+    /*
+    * Note that we push the document-node in this special case.
+    */
+    xsltCompilerNodePush(cctxt, (xmlNodePtr) doc);
+    /*
+    * In every case, we need to have
+    * the in-scope namespaces of the element, where the
+    * stylesheet is rooted at, regardless if it's an XSLT
+    * instruction or a literal result instruction (or if
+    * this is an embedded stylesheet).
+    */
+    cctxt->inode->inScopeNs =
+	xsltCompilerBuildInScopeNsList(cctxt, node);
+    /*
+    * Parse the content and register the match-pattern.
+    */
+    xsltParseSequenceConstructor(cctxt, node);
+    xsltCompilerNodePop(cctxt, (xmlNodePtr) doc);
+
+    templ->elem = (xmlNodePtr) doc;
+    templ->content = node;
+    xsltAddTemplate(cctxt->style, templ, NULL, NULL);
+    cctxt->style->literal_result = 1;
+    return(0);
+}
+
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+int
+xsltRestoreDocumentNamespaces(xsltNsMapPtr ns, xmlDocPtr doc)
+{
+    if (doc == NULL)
+	return(-1);
+    /*
+    * Revert the changes we have applied to the namespace-URIs of
+    * ns-decls.
+    */    
+    while (ns != NULL) {
+	if ((ns->doc == doc) && (ns->ns != NULL)) {
+	    ns->ns->href = ns->origNsName;
+	    ns->origNsName = NULL;
+	    ns->ns = NULL;	    
+	}
+	ns = ns->next;
+    }
+    return(0);
+}
+#endif /* XSLT_REFACTORED_XSLT_NSCOMP */
+
+/**
  * xsltParseStylesheetProcess:
- * @ret:  the XSLT stylesheet
+ * @style:  the XSLT stylesheet (the current stylesheet-level)
  * @doc:  and xmlDoc parsed XML
  *
- * parse an XSLT stylesheet adding the associated structures
+ * Parses an XSLT stylesheet, adding the associated structures.
+ * Called by:
+ *  xsltParseStylesheetImportedDoc() (xslt.c)
+ *  xsltParseStylesheetInclude() (imports.c)
  *
- * Returns the value of the 'ret' parameter if everything
+ * Returns the value of the @style parameter if everything
  * went right, NULL if something went amiss.
  */
+xsltStylesheetPtr
+xsltParseStylesheetProcess(xsltStylesheetPtr style, xmlDocPtr doc)
+{
+    xsltCompilerCtxtPtr cctxt;
+    xmlNodePtr cur;
+    int oldIsSimplifiedStylesheet;
 
+
+    if ((style == NULL) || (doc == NULL))
+	return(NULL);
+
+    cctxt = XSLT_CCTXT(style);
+
+    cur = xmlDocGetRootElement(doc);
+    if (cur == NULL) {
+	xsltTransformError(NULL, style, (xmlNodePtr) doc,
+		"xsltParseStylesheetProcess : empty stylesheet\n");
+	return(NULL);
+    }
+    oldIsSimplifiedStylesheet = cctxt->simplified;
+
+    if ((IS_XSLT_ELEM(cur)) && 
+	((IS_XSLT_NAME(cur, "stylesheet")) ||
+	 (IS_XSLT_NAME(cur, "transform")))) {	
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+		"xsltParseStylesheetProcess : found stylesheet\n");
+#endif
+	cctxt->simplified = 0;
+	style->literal_result = 0;
+    } else {
+	cctxt->simplified = 1;
+	style->literal_result = 1;
+    }
+    /*
+    * Pre-process the stylesheet if not already done before.
+    *  This will remove PIs and comments, merge adjacent
+    *  text nodes, internalize strings, etc.
+    */
+    if (! style->nopreproc)
+	xsltParsePreprocessStylesheetTree(cctxt, cur);
+    /*
+    * Parse and compile the stylesheet.
+    */
+    if (style->literal_result == 0) {
+	if (xsltParseXSLTStylesheetElem(cctxt, cur) != 0)
+	    return(NULL);
+    } else {
+	if (xsltParseSimplifiedStylesheetTree(cctxt, doc, cur) != 0)
+	    return(NULL);
+    }    
+
+    cctxt->simplified = oldIsSimplifiedStylesheet;
+
+    return(style);
+}
+
+#else /* XSLT_REFACTORED */
+
 xsltStylesheetPtr
 xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) {
     xmlNodePtr cur;
@@ -2403,7 +6088,8 @@
 	xsltTransformError(NULL, ret, (xmlNodePtr) doc,
 		"xsltParseStylesheetProcess : empty stylesheet\n");
 	return(NULL);
-    }    
+    }
+
     if ((IS_XSLT_ELEM(cur)) && 
 	((IS_XSLT_NAME(cur, "stylesheet")) ||
 	 (IS_XSLT_NAME(cur, "transform")))) {	
@@ -2420,22 +6106,8 @@
 	ret->literal_result = 1;
     }
     if (!ret->nopreproc) {
-#ifdef XSLT_REFACTORED
-	/*
-	* Reset the compiler context.
-	* TODO: This all looks ugly; but note that this will go
-	*   into an other function; it's just temporarily here.
-	*/
-	XSLT_CCTXT(ret)->depth = -1;
-	XSLT_CCTXT(ret)->inode = NULL;
-#endif
 	xsltPrecomputeStylesheet(ret, cur);
-#ifdef XSLT_REFACTORED
-	XSLT_CCTXT(ret)->depth = -1;
-	XSLT_CCTXT(ret)->inode = NULL;
-#endif
     }
-
     if (ret->literal_result == 0) {
 	xsltParseStylesheetTop(ret, cur);
     } else {
@@ -2483,16 +6155,18 @@
 	template->elem = (xmlNodePtr) doc;
 	template->content = doc->children;
 	xsltAddTemplate(ret, template, NULL, NULL);
-	ret->literal_result = 1;
+	ret->literal_result = 1;	
     }
 
     return(ret);
 }
 
+#endif /* else of XSLT_REFACTORED */
+
 /**
  * xsltParseStylesheetImportedDoc:
  * @doc:  an xmlDoc parsed XML
- * @style: pointer to parent stylesheet
+ * @style: pointer to the parent stylesheet (if it exists)
  *
  * parse an XSLT stylesheet building the associated structures
  * except the processing not needed for imported documents.
@@ -2501,44 +6175,167 @@
  */
 
 xsltStylesheetPtr
-xsltParseStylesheetImportedDoc(xmlDocPtr doc, xsltStylesheetPtr style) {
-    xsltStylesheetPtr ret;
+xsltParseStylesheetImportedDoc(xmlDocPtr doc,
+			       xsltStylesheetPtr parentStyle) {
+    xsltStylesheetPtr retStyle;
 
     if (doc == NULL)
 	return(NULL);
 
-    ret = xsltNewStylesheet();
-    if (ret == NULL)
+    retStyle = xsltNewStylesheet();
+    if (retStyle == NULL)
 	return(NULL);
-    
+    /*
+    * Set the importing stylesheet module; also used to detect recursion.
+    */
+    retStyle->parent = parentStyle;
+    /*
+    * Adjust the string dict.
+    */
     if (doc->dict != NULL) {
-        xmlDictFree(ret->dict);
-	ret->dict = doc->dict;
+        xmlDictFree(retStyle->dict);
+	retStyle->dict = doc->dict;
 #ifdef WITH_XSLT_DEBUG
         xsltGenericDebug(xsltGenericDebugContext,
-                         "reusing dictionary from %s for stylesheet\n",
-			 doc->URL);
+	    "reusing dictionary from %s for stylesheet\n",
+	    doc->URL);
 #endif
-	xmlDictReference(ret->dict);
-    }
+	xmlDictReference(retStyle->dict);
+    }    	
     
-    ret->doc = doc;
-    ret->parent = style;	/* needed to prevent loops */
-    xsltGatherNamespaces(ret);
-    if (xsltParseStylesheetProcess(ret, doc) == NULL) {
-	ret->doc = NULL;
-	xsltFreeStylesheet(ret);
-	ret = NULL;
+    /*
+    * TODO: Eliminate xsltGatherNamespaces(); we must not restrict
+    *  the stylesheet to containt distinct namespace prefixes.
+    */
+    xsltGatherNamespaces(retStyle);
+
+#ifdef XSLT_REFACTORED
+    {
+	xsltCompilerCtxtPtr cctxt;
+	xsltStylesheetPtr oldCurSheet;
+	    
+	if (parentStyle == NULL) {
+	    xsltPrincipalStylesheetDataPtr principalData;
+	    /*
+	    * Principal stylesheet
+	    * --------------------
+	    */
+	    retStyle->principal = retStyle;
+	    /*
+	    * Create extra data for the principal stylesheet.
+	    */
+	    principalData = xsltNewPrincipalStylesheetData();
+	    if (principalData == NULL) {
+		xsltFreeStylesheet(retStyle);
+		return(NULL);
+	    }
+	    retStyle->principalData = principalData;
+	    /*
+	    * Create the compilation context
+	    * ------------------------------
+	    * (only once; for the principal stylesheet).
+	    * This is currently the only function where the
+	    * compilation context is created.
+	    */
+	    cctxt = xsltCompilationCtxtCreate(retStyle);
+	    if (cctxt == NULL) {
+		xsltFreeStylesheet(retStyle);
+		return(NULL);
+	    }	    	    
+	    retStyle->compCtxt = (void *) cctxt;
+	    cctxt->style = retStyle;
+	    cctxt->dict = retStyle->dict;
+	    cctxt->psData = principalData;
+	    /*
+	    * Push initial dummy node info.
+	    */
+	    cctxt->depth = -1;
+	    xsltCompilerNodePush(cctxt, (xmlNodePtr) doc);
+	} else {
+	    /*
+	    * Imported stylesheet.
+	    */
+	    retStyle->principal = parentStyle->principal;
+	    cctxt = parentStyle->compCtxt;
+	    retStyle->compCtxt = cctxt;
+	}
+	/*
+	* Save the old and set the current stylesheet structure in the
+	* compilation context.
+	*/
+	oldCurSheet = cctxt->style;
+	cctxt->style = retStyle;
+	
+	retStyle->doc = doc;
+	xsltParseStylesheetProcess(retStyle, doc);
+	
+	cctxt->style = oldCurSheet;
+	if (parentStyle == NULL) {
+	    /*
+	    * Pop the initial dummy node info.
+	    */
+	    xsltCompilerNodePop(cctxt, (xmlNodePtr) doc);
+	} else {
+	    /*
+	    * Clear the compilation context of imported
+	    * stylesheets.
+	    * TODO: really?
+	    */
+	    /* retStyle->compCtxt = NULL; */
+	}
+	/*
+	* Free the stylesheet if there were errors.
+	*/
+	if (retStyle != NULL) {
+	    if (retStyle->errors != 0) {
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+		/*
+		* Restore all changes made to namespace URIs of ns-decls.
+		*/
+		if (cctxt->psData->nsMap)		
+		    xsltRestoreDocumentNamespaces(cctxt->psData->nsMap, doc);
+#endif
+		/*
+		* Detach the doc from the stylesheet; otherwise the doc
+		* will be freed in xsltFreeStylesheet().
+		*/
+		retStyle->doc = NULL;
+		/*
+		* Cleanup the doc if its the main stylesheet.
+		*/
+		if (parentStyle == NULL) {
+		    xsltCleanupStylesheetTree(doc, xmlDocGetRootElement(doc));
+		    if (retStyle->compCtxt != NULL) {			
+			xsltCompilationCtxtFree(retStyle->compCtxt);
+			retStyle->compCtxt = NULL;
+		    }
+		}
+
+		xsltFreeStylesheet(retStyle);
+		retStyle = NULL;
+	    }
+	}
     }
-    if (ret != NULL) {
-	if (ret->errors != 0) {
-	    ret->doc = NULL;
-	    xsltFreeStylesheet(ret);
-	    ret = NULL;
+        
+#else /* XSLT_REFACTORED */
+    /*
+    * Old behaviour.
+    */
+    retStyle->doc = doc;
+    xsltParseStylesheetProcess(retStyle, doc);
+    if (retStyle != NULL) {
+	if (retStyle->errors != 0) {
+	    retStyle->doc = NULL;
+	    if (parentStyle == NULL)
+		xsltCleanupStylesheetTree(doc,
+		    xmlDocGetRootElement(doc));
+	    xsltFreeStylesheet(retStyle);
+	    retStyle = NULL;
 	}
     }
-    
-    return(ret);
+#endif /* else of XSLT_REFACTORED */
+        
+    return(retStyle);
 }
 
 /**
@@ -2566,7 +6363,7 @@
     *   xsltParseStylesheetImportedDoc().
     */
     if (ret->compCtxt != NULL) {
-	xsltCompilerCtxtFree(XSLT_CCTXT(ret));
+	xsltCompilationCtxtFree(XSLT_CCTXT(ret));
 	ret->compCtxt = NULL;
     }
 #endif

Modified: packages/libxslt/branches/upstream/current/libxslt/xsltInternals.h
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/xsltInternals.h	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/xsltInternals.h	2006-06-08 22:23:55 UTC (rev 563)
@@ -18,6 +18,7 @@
 #include <libxml/xpath.h>
 #include <libxml/xmlerror.h>
 #include <libxml/dict.h>
+#include <libxml/xmlstring.h>
 #include <libxslt/xslt.h>
 #include "xsltexports.h"
 #include "numbersInternals.h"
@@ -26,16 +27,128 @@
 extern "C" {
 #endif
 
+#define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \
+    (((n)->type == XML_TEXT_NODE) || \
+     ((n)->type == XML_CDATA_SECTION_NODE)))
 
+
+#if 0
+
+extern const xmlChar *xsltDocFragFake;
+
+#define XSLT_MARK_RES_TREE_FRAG(n) (n)->psvi = (void *) xsltDocFragFake;
+
+#define XSLT_IS_RES_TREE_FRAG(n) \
+    ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \
+     ((n)->psvi == xsltDocFragFake))
+
+#else
+
+#define XSLT_MARK_RES_TREE_FRAG(n) \
+    (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt");
+
+#define XSLT_IS_RES_TREE_FRAG(n) \
+    ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \
+     ((n)->name != NULL) && ((n)->name[0] == ' ') && \
+    xmlStrEqual(BAD_CAST (n)->name, BAD_CAST " fake node libxslt"))
+
+#endif
+
 /**
+ * XSLT_REFACTORED_KEYCOMP:
+ *
+ * Internal define to enable on-demand xsl:key computation.
+ */
+#define XSLT_REFACTORED_KEYCOMP
+
+/**
  * XSLT_REFACTORED:
  *
- * Internal define to enable the refactored parts of Libxslt
- * mostly related to pre-computation.
+ * Internal define to enable the refactored parts of Libxslt.
  */
 /* #define XSLT_REFACTORED */
+/* ==================================================================== */
 
+#ifdef XSLT_REFACTORED
+/* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */
+
+/* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */
+
 /**
+ * XSLT_REFACTORED_XSLT_NSCOMP
+ *
+ * Internal define to enable the pointer-comparison of
+ * namespaces of XSLT elements. 
+ */
+#define XSLT_REFACTORED_XSLT_NSCOMP
+
+/**
+ * XSLT_REFACTORED_XPATHCOMP
+ *
+ * Internal define to enable the optimization of the
+ * compilation of XPath expressions.
+ */
+#define XSLT_REFACTORED_XPATHCOMP
+
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+
+extern const xmlChar *xsltConstNamespaceNameXSLT;
+
+#define IS_XSLT_ELEM_FAST(n) \
+    (((n) != NULL) && ((n)->ns != NULL) && \
+    ((n)->ns->href == xsltConstNamespaceNameXSLT))
+
+#define IS_XSLT_ATTR_FAST(a) \
+    (((a) != NULL) && ((a)->ns != NULL) && \
+    ((a)->ns->href == xsltConstNamespaceNameXSLT))
+
+#define XSLT_HAS_INTERNAL_NSMAP(s) \
+    (((s) != NULL) && ((s)->principal) && \
+     ((s)->principal->principalData) && \
+     ((s)->principal->principalData->nsMap))
+
+#define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap)
+
+#else /* XSLT_REFACTORED_XSLT_NSCOMP */
+
+#define IS_XSLT_ELEM_FAST(n) \
+    (((n) != NULL) && ((n)->ns != NULL) && \
+     (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
+
+#define IS_XSLT_ATTR_FAST(a) \
+    (((a) != NULL) && ((a)->ns != NULL) && \
+     (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE)))
+
+
+#endif /* XSLT_REFACTORED_XSLT_NSCOMP */
+
+
+/**
+ * XSLT_REFACTORED_MANDATORY_VERSION:
+ *
+ * TODO: Currently disabled to surpress regression test failures, since
+ *  the old behaviour was that a missing version attribute
+ *  produced a only a warning and not an error, which was incerrect.
+ *  So the regression tests need to be fixed if this is enabled.
+ */
+/* #define XSLT_REFACTORED_MANDATORY_VERSION */
+
+/**
+ * xsltPointerList:
+ *
+ * Pointer-list for various purposes.
+ */
+typedef struct _xsltPointerList xsltPointerList;
+typedef xsltPointerList *xsltPointerListPtr;
+struct _xsltPointerList {
+    void **items;
+    int number;
+    int size;
+};
+
+#endif
+
+/**
  * XSLT_REFACTORED_PARSING:
  *
  * Internal define to enable the refactored parts of Libxslt
@@ -110,13 +223,17 @@
     struct _xsltStylesheet *style;/* the containing stylesheet */
     xmlChar *match;	/* the matching string */
     float priority;	/* as given from the stylesheet, not computed */
-    xmlChar *name;	/* the local part of the name QName */
-    xmlChar *nameURI;	/* the URI part of the name QName */
+    const xmlChar *name; /* the local part of the name QName */
+    const xmlChar *nameURI; /* the URI part of the name QName */
     const xmlChar *mode;/* the local part of the mode QName */
     const xmlChar *modeURI;/* the URI part of the mode QName */
     xmlNodePtr content;	/* the template replacement value */
     xmlNodePtr elem;	/* the source element */
 
+    /*
+    * TODO: @inheritedNsNr and @inheritedNs won't be used in the
+    *  refactored code.
+    */
     int inheritedNsNr;  /* number of inherited namespaces */
     xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */
 
@@ -165,8 +282,44 @@
     void *keys;			/* key tables storage */
     struct _xsltDocument *includes; /* subsidiary includes */
     int preproc;		/* pre-processing already done */
+    int nbKeysComputed;
 };
 
+/**
+ * xsltKeyDef:
+ *
+ * Representation of an xsl:key.
+ */
+typedef struct _xsltKeyDef xsltKeyDef;
+typedef xsltKeyDef *xsltKeyDefPtr;
+struct _xsltKeyDef {
+    struct _xsltKeyDef *next;
+    xmlNodePtr inst;
+    xmlChar *name;
+    xmlChar *nameURI;
+    xmlChar *match;
+    xmlChar *use;
+    xmlXPathCompExprPtr comp;
+    xmlXPathCompExprPtr usecomp;
+    xmlNsPtr *nsList;           /* the namespaces in scope */
+    int nsNr;                   /* the number of namespaces in scope */
+};
+
+/**
+ * xsltKeyTable:
+ *
+ * Holds the computed keys for key definitions of the same QName.
+ * Is owned by an xsltDocument.
+ */
+typedef struct _xsltKeyTable xsltKeyTable;
+typedef xsltKeyTable *xsltKeyTablePtr;
+struct _xsltKeyTable {
+    struct _xsltKeyTable *next;
+    xmlChar *name;
+    xmlChar *nameURI;
+    xmlHashTablePtr keys;
+};
+
 /*
  * The in-memory structure corresponding to an XSLT Stylesheet.
  * NOTE: most of the content is simply linked from the doc tree
@@ -236,7 +389,15 @@
     XSLT_FUNC_VARIABLE,
     XSLT_FUNC_WHEN,
     XSLT_FUNC_EXTENSION,
+#ifdef XSLT_REFACTORED
     XSLT_FUNC_OTHERWISE,
+    XSLT_FUNC_FALLBACK,
+    XSLT_FUNC_MESSAGE,
+    XSLT_FUNC_INCLUDE,
+    XSLT_FUNC_ATTRSET,
+    XSLT_FUNC_LITERAL_RESULT_ELEMENT,
+    XSLT_FUNC_UNKOWN_FORWARDS_COMPAT,
+#endif
 } xsltStyleType;
 
 /**
@@ -258,7 +419,7 @@
 struct _xsltElemPreComp {
     xsltElemPreCompPtr next;		/* next item in the global chained
 					   list hold by xsltStylesheet. */
-    xsltStyleType type;			/* type of the element */
+    xsltStyleType type;		/* type of the element */
     xsltTransformFunction func; 	/* handling function */
     xmlNodePtr inst;			/* the node in the stylesheet's tree
 					   corresponding to this item */
@@ -270,52 +431,45 @@
 /**
  * xsltStylePreComp:
  *
- * The abstract basic structure for items of the
- * AST of the XSLT processor.
- * The AST includes:
+ * The abstract basic structure for items of the XSLT processor.
+ * This includes:
  * 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.)
  * 2) compiled forms of literal result elements
+ * 3) compiled forms of extension elements
  */
 typedef struct _xsltStylePreComp xsltStylePreComp;
 typedef xsltStylePreComp *xsltStylePreCompPtr;
 
-/*************************
- * Refactored structures *
- *************************/
 #ifdef XSLT_REFACTORED
 
-typedef struct _xsltNsList xsltNsList;
+/*
+* Some pointer-list utility functions.
+*/
+XSLTPUBFUN xsltPointerListPtr XSLTCALL
+		xsltPointerListCreate		(int initialSize);
+XSLTPUBFUN void XSLTCALL
+		xsltPointerListFree		(xsltPointerListPtr list);
+XSLTPUBFUN void XSLTCALL
+		xsltPointerListClear		(xsltPointerListPtr list);
+XSLTPUBFUN int XSLTCALL
+		xsltPointerListAddSize		(xsltPointerListPtr list,						 
+						 void *item,
+						 int initialSize);
 
-typedef xsltNsList *xsltNsListPtr;
-struct _xsltNsList {
+/************************************************************************
+ *									*
+ * Refactored structures                                                *
+ *									*
+ ************************************************************************/
+
+typedef struct _xsltNsListContainer xsltNsListContainer;
+typedef xsltNsListContainer *xsltNsListContainerPtr;
+struct _xsltNsListContainer {
     xmlNsPtr *list;
     int number;
 };
 
-#if 0
-/*
- * TODO: xsltBasicItem is not used yet; maybe never will be used, since
- * xsltElemPreCompPtr is acting as the base type for the compiled
- * items of a stylesheet. It seems not practical to try to change
- * this type to xsltBasicItemPtr, since xsltElemPreCompPtr is
- * used already used too massively (e.g. xsltStylesheet->preComps) and
- * for extension functions.
- */
 /**
- * xsltBasicItem:
- *
- * The basic structure for all items of the AST of the XSLT processor.
- */
-typedef struct _xsltBasicItem xsltBasicItem;
-
-typedef xsltBasicItem *xsltBasicItemPtr;
-struct _xsltBasicItem {
-    xsltBasicASTItemPtr next;
-    xsltStyleType type;
-};
-#endif
-
-/**
  * XSLT_ITEM_COMPATIBILITY_FIELDS:
  * 
  * Fields for API compatibility to the structure
@@ -346,7 +500,7 @@
  *
  * The in-scope namespaces.
  */
-#define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListPtr inScopeNS;
+#define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs;
 
 /**
  * XSLT_ITEM_COMMON_FIELDS:
@@ -378,8 +532,8 @@
     xsltTransformFunction func; /* handling function */
     xmlNodePtr inst;		/* the node in the stylesheet's tree
 				   corresponding to this item. */
-    /* Currenlty to navigational fields. */
-    xsltNsListPtr inScopeNS;
+    /* Currently no navigational fields. */
+    xsltNsListContainerPtr inScopeNs;
 };
 
 /**
@@ -868,22 +1022,150 @@
     XSLT_ITEM_COMMON_FIELDS
 };
 
+typedef struct _xsltStyleItemInclude xsltStyleItemInclude;
+typedef xsltStyleItemInclude *xsltStyleItemIncludePtr;
+
+struct _xsltStyleItemInclude {
+    XSLT_ITEM_COMMON_FIELDS
+    xsltDocumentPtr include;
+};
+
+/************************************************************************
+ *									*
+ *  XSLT elements in forwards-compatible mode                           *
+ *									*
+ ************************************************************************/
+
+typedef struct _xsltStyleItemUknown xsltStyleItemUknown;
+typedef xsltStyleItemUknown *xsltStyleItemUknownPtr;
+struct _xsltStyleItemUknown {
+    XSLT_ITEM_COMMON_FIELDS
+};
+
+
+/************************************************************************
+ *									*
+ *  Extension elements                                                  *
+ *									*
+ ************************************************************************/
+
 /*
- * Literal result elements.
- * TODO: Not used yet.
+ * xsltStyleItemExtElement:
+ *
+ * Reflects extension elements.
+ *
+ * NOTE: Due to the fact that the structure xsltElemPreComp is most
+ * probably already heavily in use out there by users, so we cannot
+ * easily change it, we'll create an intermediate structure which will
+ * hold an xsltElemPreCompPtr.
+ * BIG NOTE: The only problem I see here is that the user processes the
+ *  content of the stylesheet tree, possibly he'll lookup the node->psvi
+ *  fields in order to find subsequent extension functions.
+ *  In this case, the user's code will break, since the node->psvi
+ *  field will hold now the xsltStyleItemExtElementPtr and not
+ *  the xsltElemPreCompPtr.
+ *  However the place where the structure is anchored in the node-tree,
+ *  namely node->psvi, has beed already once been moved from node->_private
+ *  to node->psvi, so we have a precedent here, which, I think, should allow
+ *  us to change such semantics without headaches.
  */
-typedef struct _xsltStyleItemLRE xsltStyleItemLRE;
-typedef xsltStyleItemLRE *xsltStyleItemLREPtr;
-struct _xsltStyleItemLRE {
+typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement;
+typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr;
+struct _xsltStyleItemExtElement {
     XSLT_ITEM_COMMON_FIELDS
+    xsltElemPreCompPtr item;   
 };
 
 /************************************************************************
  *									*
+ *  Literal result elements                                             *
+ *									*
+ ************************************************************************/
+
+typedef struct _xsltEffectiveNs xsltEffectiveNs;
+typedef xsltEffectiveNs *xsltEffectiveNsPtr;
+struct _xsltEffectiveNs {
+    xsltEffectiveNsPtr nextInStore; /* storage next */
+    xsltEffectiveNsPtr next; /* next item in the list */
+    const xmlChar *prefix;
+    const xmlChar *nsName;
+    /* 
+    * Indicates if eclared on the literal result element; dunno if really
+    * needed.
+    */
+    int holdByElem;
+};
+
+/*
+ * Info for literal result elements.
+ * This will be set on the elem->psvi field and will be
+ * shared by literal result elements, which have the same
+ * excluded result namespaces; i.e., this *won't* be created uniquely
+ * for every literal result element.
+ */
+typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo;
+typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr;
+struct _xsltStyleItemLRElementInfo {
+    XSLT_ITEM_COMMON_FIELDS
+    /*
+    * @effectiveNs is the set of effective ns-nodes
+    *  on the literal result element, which will be added to the result
+    *  element if not already existing in the result tree.
+    *  This means that excluded namespaces (via exclude-result-prefixes,
+    *  extension-element-prefixes and the XSLT namespace) not added
+    *  to the set.
+    *  Namespace-aliasing was applied on the @effectiveNs.
+    */
+    xsltEffectiveNsPtr effectiveNs;
+
+};
+
+#ifdef XSLT_REFACTORED
+
+typedef struct _xsltNsAlias xsltNsAlias;
+typedef xsltNsAlias *xsltNsAliasPtr;
+struct _xsltNsAlias {
+    xsltNsAliasPtr next; /* next in the list */    
+    xmlNsPtr literalNs;
+    xmlNsPtr targetNs;
+    xmlDocPtr docOfTargetNs;
+};
+#endif
+
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+
+typedef struct _xsltNsMap xsltNsMap;
+typedef xsltNsMap *xsltNsMapPtr;
+struct _xsltNsMap {
+    xsltNsMapPtr next; /* next in the list */
+    xmlDocPtr doc;
+    xmlNodePtr elem; /* the element holding the ns-decl */
+    xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */
+    const xmlChar *origNsName; /* the original XML namespace name */
+    const xmlChar *newNsName; /* the mapped XML namespace name */    
+};
+#endif
+
+/************************************************************************
+ *									*
  *  Compile-time structures for *internal* use only                     *
  *									*
  ************************************************************************/
 
+typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData;
+typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr;
+
+typedef struct _xsltNsList xsltNsList;
+typedef xsltNsList *xsltNsListPtr;
+struct _xsltNsList {
+    xsltNsListPtr next; /* next in the list */
+    xmlNsPtr ns;
+};
+
+#define XSLT_ELEMENT_CATEGORY_XSLT 0
+#define XSLT_ELEMENT_CATEGORY_EXTENSION 1
+#define XSLT_ELEMENT_CATEGORY_LRE 2
+
 /**
  * xsltCompilerNodeInfo:
  *
@@ -896,29 +1178,86 @@
     xsltCompilerNodeInfoPtr prev;
     xmlNodePtr node;
     int depth;
-    xsltNsListPtr inScopeNS; /* The in-scope namespaces for the current
-                                position in the node-tree */
     xsltTemplatePtr templ;   /* The owning template */
+    int category;	     /* XSLT element, LR-element or
+                                extension element */
+    xsltStyleType type;
     xsltElemPreCompPtr item; /* The compiled information */
+    /* The current in-scope namespaces */
+    xsltNsListContainerPtr inScopeNs;
+    /* The current excluded result namespaces */
+    xsltPointerListPtr exclResultNs; 
+    /* The current extension instruction namespaces */
+    xsltPointerListPtr extElemNs;
+    /* The current info for literal result elements. */
+    xsltStyleItemLRElementInfoPtr litResElemInfo;
+    /* 
+    * Set to 1 if in-scope namespaces changed,
+    *  or excluded result namespaces changed,
+    *  or extension element namespaces changed.
+    * This will trigger creation of new infos
+    *  for literal result elements.
+    */
+    int nsChanged;
+    int preserveWhitespace;
+    int stripWhitespace;
+    int isRoot; /* whether this is the stylesheet's root node */
+    int forwardsCompat; /* whether forwards-compatible mode is enabled */
+    /* whether the content of an extension element was processed */
+    int extContentHandled;
+    /* the type of the current child */
+    xsltStyleType curChildType;    
 };
 
-#define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt)
+#define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt) 
 
+typedef enum {
+    XSLT_ERROR_SEVERITY_ERROR = 0,
+    XSLT_ERROR_SEVERITY_WARNING
+} xsltErrorSeverityType;
+
 typedef struct _xsltCompilerCtxt xsltCompilerCtxt;
 typedef xsltCompilerCtxt *xsltCompilerCtxtPtr;
 struct _xsltCompilerCtxt {
-    void *errorCtxt;             /* user specific error context */
+    void *errorCtxt;            /* user specific error context */
+    /*
+    * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */
+    xsltErrorSeverityType errSeverity;		
     int warnings;		/* TODO: number of warnings found at
                                    compilation */
     int errors;			/* TODO: number of errors found at
                                    compilation */
-    xsltStylesheetPtr sheet;
+    xmlDictPtr dict;
+    xsltStylesheetPtr style;
+    int simplified; /* whether this is a simplified stylesheet */
     /* TODO: structured/unstructured error contexts. */
-    int depth; /* TODO: current depth in the stylesheets node-tree */
+    int depth; /* Current depth of processing */
     
     xsltCompilerNodeInfoPtr inode;
     xsltCompilerNodeInfoPtr inodeList;
     xsltCompilerNodeInfoPtr inodeLast;
+    xsltPointerListPtr tmpList; /* Used for various purposes */
+    /*
+    * The XSLT version as specified by the stylesheet's root element.
+    */
+    int isInclude;
+    int hasForwardsCompat; /* whether forwards-compatible mode was used
+			     in a parsing episode */
+    int maxNodeInfos; /* TEMP TODO: just for the interest */
+    int maxLREs;  /* TEMP TODO: just for the interest */
+    /* 
+    * In order to keep the old behaviour, applying strict rules of
+    * the spec can be turned off. This has effect only on special
+    * mechanisms like whitespace-stripping in the stylesheet.
+    */
+    int strict;
+    xsltPrincipalStylesheetDataPtr psData;
+#ifdef XSLT_REFACTORED_XPATHCOMP
+    xmlXPathContextPtr xpathCtxt;
+#endif
+    xsltStyleItemUknownPtr unknownItem;
+    int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */
+    xsltNsAliasPtr nsAliases;    
 };   
 
 #else /* XSLT_REFACTORED */
@@ -1002,10 +1341,42 @@
     xmlXPathObjectPtr value;	/* The value if computed */
 };
 
+#ifdef XSLT_REFACTORED
+
+struct _xsltPrincipalStylesheetData {
+    /*
+    * Namespace dictionary for ns-prefixes and ns-names:
+    * TODO: Shared between stylesheets, and XPath mechanisms.
+    *   Not used yet.
+    */
+    xmlDictPtr namespaceDict;
+    /*
+    * Global list of in-scope namespaces.
+    */
+    xsltPointerListPtr inScopeNamespaces;
+    /*
+    * Global list of information for [xsl:]excluded-result-prefixes.
+    */
+    xsltPointerListPtr exclResultNamespaces;
+    /*
+    * Global list of information for [xsl:]extension-element-prefixes.
+    */
+    xsltPointerListPtr extElemNamespaces;
+    xsltEffectiveNsPtr effectiveNs;
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    /*
+    * Namespace name map to get rid of string comparison of namespace names.
+    */
+    xsltNsMapPtr nsMap;
+#endif
+};
+
+    
+#endif
 /*
- * TODO: We need a field to anchor an stylesheet compilation context, since,
- *   due to historical reasons, various compile-time function take only the
- *   stylesheet as argument and not a compilation context.
+ * Note that we added a @compCtxt field to anchor an stylesheet compilation
+ * context, since, due to historical reasons, various compile-time function
+ * take only the stylesheet as argument and not a compilation context.
  */
 struct _xsltStylesheet {
     /*
@@ -1048,6 +1419,7 @@
     
     /*
      * Namespace aliases.
+     * NOTE: Not used in the refactored code.
      */
     xmlHashTablePtr nsAliases;	/* the namespace alias hash tables */
 
@@ -1058,14 +1430,24 @@
 
     /*
      * Namespaces.
+     * TODO: Eliminate this.
      */
-    xmlHashTablePtr nsHash;     /* the set of namespaces in use */
-    void           *nsDefs;     /* the namespaces defined */
+    xmlHashTablePtr nsHash;     /* the set of namespaces in use:
+                                   ATTENTION: This is used for
+                                   execution of XPath expressions; unfortunately
+                                   it restricts the stylesheet to have distinct
+                                   prefixes.
+				   TODO: We need to get rid of this.    
+				 */
+    void           *nsDefs;     /* ATTENTION TODO: This is currently used to store
+				   xsltExtDefPtr (in extensions.c) and
+                                   *not* xmlNsPtr.
+				 */
 
     /*
      * Key definitions.
      */
-    void *keys;				/* key definitions */
+    void *keys;			/* key definitions */
 
     /*
      * Output related stuff.
@@ -1112,7 +1494,7 @@
     xsltDocumentPtr includes;	/* points to last nested include */
 
     /*
-     * dictionnary: shared between stylesheet, context and documents.
+     * dictionary: shared between stylesheet, context and documents.
      */
     xmlDictPtr dict;
     /*
@@ -1121,6 +1503,7 @@
     void *attVTs;
     /*
      * if namespace-alias has an alias for the default stylesheet prefix
+     * NOTE: Not used in the refactored code.
      */
     const xmlChar *defaultAlias;
     /*
@@ -1135,16 +1518,18 @@
      * Literal Result Element as Stylesheet c.f. section 2.3
      */
     int literal_result;
+    /*
+    * The principal stylesheet
+    */
+    xsltStylesheetPtr principal;
 #ifdef XSLT_REFACTORED
     /*
     * Compilation context used during compile-time.
     */
-    void * compCtxt;
-    /*
-    * Namespace lists.
-    */
-    void *inScopeNamespaces;    
-#endif    
+    xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */
+
+    xsltPrincipalStylesheetDataPtr principalData;    
+#endif
 };
 
 /*
@@ -1265,6 +1650,8 @@
      * all document text strings are internalized
      */
     int internalized;
+    int nbKeys;
+    int hasTemplKeyPatterns;
 };
 
 /**
@@ -1323,13 +1710,13 @@
 XSLTPUBFUN xsltStylesheetPtr XSLTCALL	
 			xsltParseStylesheetFile	(const xmlChar* filename);
 XSLTPUBFUN void XSLTCALL			
-			xsltFreeStylesheet	(xsltStylesheetPtr sheet);
+			xsltFreeStylesheet	(xsltStylesheetPtr style);
 XSLTPUBFUN int XSLTCALL			
 			xsltIsBlank		(xmlChar *str);
 XSLTPUBFUN void XSLTCALL			
 			xsltFreeStackElemList	(xsltStackElemPtr elem);
 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL	
-			xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
+			xsltDecimalFormatGetByName(xsltStylesheetPtr style,
 						 xmlChar *name);
 
 XSLTPUBFUN xsltStylesheetPtr XSLTCALL	
@@ -1389,23 +1776,44 @@
 XSLTPUBFUN void XSLTCALL
 			xsltFreeAVTList		(void *avt);
 
+/*
+ * Extra function for successful xsltCleanupGlobals / xsltInit sequence.
+ */
+
+XSLTPUBFUN void XSLTCALL
+			xsltUninit		(void);
+
 /************************************************************************
  *									*
  *  Compile-time functions for *internal* use only                      *
  *									*
  ************************************************************************/
 
-#ifdef XSLT_REFACTORED
-XSLTPUBFUN xsltNsListPtr XSLTCALL
-			xsltCompilerGetInScopeNSInfo(xsltCompilerCtxtPtr cctxt,
-						     xmlNodePtr node);
+#ifdef XSLT_REFACTORED  
+XSLTPUBFUN void XSLTCALL
+			xsltParseSequenceConstructor(
+						 xsltCompilerCtxtPtr cctxt,
+						 xmlNodePtr start);
+XSLTPUBFUN int XSLTCALL
+			xsltParseAnyXSLTElem	(xsltCompilerCtxtPtr cctxt,
+						 xmlNodePtr elem);
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+XSLTPUBFUN int XSLTCALL
+			xsltRestoreDocumentNamespaces(
+						 xsltNsMapPtr ns,
+						 xmlDocPtr doc);
+#endif
 #endif /* XSLT_REFACTORED */
-/*
- * Extra function for successful xsltCleanupGlobals / xsltInit sequence.
- */
 
-XSLTPUBFUN void XSLTCALL
-			xsltUninit		(void);
+/************************************************************************
+ *									*
+ *  Transformation-time functions for *internal* use only               *
+ *									*
+ ************************************************************************/
+XSLTPUBFUN int XSLTCALL
+			xsltInitCtxtKey		(xsltTransformContextPtr ctxt,
+						 xsltDocumentPtr doc,
+						 xsltKeyDefPtr keyd);
 
 #ifdef __cplusplus
 }

Modified: packages/libxslt/branches/upstream/current/libxslt/xsltconfig.h
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/xsltconfig.h	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/xsltconfig.h	2006-06-08 22:23:55 UTC (rev 563)
@@ -20,28 +20,28 @@
  *
  * the version string like "1.2.3"
  */
-#define LIBXSLT_DOTTED_VERSION "1.1.16"
+#define LIBXSLT_DOTTED_VERSION "1.1.17"
 
 /**
  * LIBXSLT_VERSION:
  *
  * the version number: 1.2.3 value is 1002003
  */
-#define LIBXSLT_VERSION 10116
+#define LIBXSLT_VERSION 10117
 
 /**
  * LIBXSLT_VERSION_STRING:
  *
  * the version number string, 1.2.3 value is "1002003"
  */
-#define LIBXSLT_VERSION_STRING "10116"
+#define LIBXSLT_VERSION_STRING "10117"
 
 /**
  * LIBXSLT_VERSION_EXTRA:
  *
  * extra version information, used to show a CVS compilation
  */
-#define	LIBXSLT_VERSION_EXTRA "-CVS1050"
+#define	LIBXSLT_VERSION_EXTRA "-CVS1062"
 
 /**
  * WITH_XSLT_DEBUG:

Modified: packages/libxslt/branches/upstream/current/libxslt/xsltutils.c
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/xsltutils.c	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/xsltutils.c	2006-06-08 22:23:55 UTC (rev 563)
@@ -303,6 +303,49 @@
 #ifdef XSLT_REFACTORED
 
 /**
+ * xsltPointerListAddSize:
+ * @list: the pointer list structure
+ * @item: the item to be stored
+ * @initialSize: the initial size of the list
+ *
+ * Adds an item to the list.
+ *
+ * Returns the position of the added item in the list or
+ *         -1 in case of an error.
+ */
+int
+xsltPointerListAddSize(xsltPointerListPtr list,		       
+		       void *item,
+		       int initialSize)
+{
+    if (list->items == NULL) {
+	if (initialSize <= 0)
+	    initialSize = 1;
+	list->items = (void **) xmlMalloc(
+	    initialSize * sizeof(void *));
+	if (list->items == NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+	     "xsltPointerListAddSize: memory allocation failure.\n");
+	    return(-1);
+	}
+	list->number = 0;
+	list->size = initialSize;
+    } else if (list->size <= list->number) {
+	list->size *= 2;
+	list->items = (void **) xmlRealloc(list->items,
+	    list->size * sizeof(void *));
+	if (list->items == NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+	     "xsltPointerListAddSize: memory re-allocation failure.\n");
+	    list->size = 0;
+	    return(-1);
+	}
+    }
+    list->items[list->number++] = item;
+    return(0);
+}
+
+/**
  * xsltPointerListCreate:
  *
  * Creates an xsltPointerList structure.
@@ -310,7 +353,7 @@
  * Returns a xsltPointerList structure or NULL in case of an error.
  */
 xsltPointerListPtr
-xsltPointerListCreate(void)
+xsltPointerListCreate(int initialSize)
 {
     xsltPointerListPtr ret;
 
@@ -321,6 +364,10 @@
 	return (NULL);
     }
     memset(ret, 0, sizeof(xsltPointerList));
+    if (initialSize > 0) {
+	xsltPointerListAddSize(ret, NULL, initialSize);
+	ret->number = 0;
+    }
     return (ret);
 }
 
@@ -357,76 +404,6 @@
     list->size = 0;
 }
 
-/**
- * xsltPointerListAdd:
- *
- * Adds an item to the list.
- *
- * Returns the position of the added item in the list or
- *         -1 in case of an error.
- */
-int
-xsltPointerListAdd(xsltPointerListPtr list, void *item)
-{
-    if (list->items == NULL) {
-	list->items = (void **) xmlMalloc(
-	    20 * sizeof(void *));
-	if (list->items == NULL) {
-	    xsltGenericError(xsltGenericErrorContext,
-	     "xsltPointerListAdd: memory allocation failure.\n");
-	    return(-1);
-	}
-	list->number = 0;
-	list->size = 20;
-    } else if (list->size <= list->number) {
-	list->size *= 2;
-	list->items = (void **) xmlRealloc(list->items,
-	    list->size * sizeof(void *));
-	if (list->items == NULL) {
-	    xsltGenericError(xsltGenericErrorContext,
-	     "xsltPointerListAdd: memory re-allocation failure.\n");
-	    list->size = 0;
-	    return(-1);
-	}
-    }
-    list->items[list->number++] = item;
-    return(0);
-}
-
-#if 0 /* TODO: Not used yet. Enable if ever needed. */
-static int
-xsltPointerListAddSize(xsltPointerListPtr list,
-		       int initialSize,
-		       void *item)
-{
-    if (list->items == NULL) {
-	if (initialSize <= 0)
-	    initialSize = 1;
-	list->items = (void **) xmlMalloc(
-	    initialSize * sizeof(void *));
-	if (list->items == NULL) {
-	    xsltGenericError(xsltGenericErrorContext,
-	     "xsltPointerListAddSize: memory allocation failure.\n");
-	    return(-1);
-	}
-	list->number = 0;
-	list->size = initialSize;
-    } else if (list->size <= list->number) {
-	list->size *= 2;
-	list->items = (void **) xmlRealloc(list->items,
-	    list->size * sizeof(void *));
-	if (list->items == NULL) {
-	    xsltGenericError(xsltGenericErrorContext,
-	     "xsltPointerListAddSize: memory re-allocation failure.\n");
-	    list->size = 0;
-	    return(-1);
-	}
-    }
-    list->items[list->number++] = item;
-    return(0);
-}
-#endif
-
 #endif /* XSLT_REFACTORED */
 
 /************************************************************************
@@ -650,8 +627,16 @@
     
     if (ctxt != NULL)
 	type = "runtime error";
-    else if (style != NULL)
+    else if (style != NULL) {
+#ifdef XSLT_REFACTORED
+	if (XSLT_CCTXT(style)->errSeverity == XSLT_ERROR_SEVERITY_WARNING)
+	    type = "compilation warning";
+	else
+	    type = "compilation error";
+#else
 	type = "compilation error";
+#endif
+    }
 
     if ((file != NULL) && (line != 0) && (name != NULL))
 	error(errctx, "%s: file %s line %d element %s\n",
@@ -1008,9 +993,9 @@
 	ctxt->node = list->nodeTab[i];
 	ctxt->xpathCtxt->node = ctxt->node;
 #ifdef XSLT_REFACTORED
-	if (comp->inScopeNS != NULL) {
-	    ctxt->xpathCtxt->namespaces = comp->inScopeNS->list;
-	    ctxt->xpathCtxt->nsNr = comp->inScopeNS->number;
+	if (comp->inScopeNs != NULL) {
+	    ctxt->xpathCtxt->namespaces = comp->inScopeNs->list;
+	    ctxt->xpathCtxt->nsNr = comp->inScopeNs->number;
 	} else {
 	    ctxt->xpathCtxt->namespaces = NULL;
 	    ctxt->xpathCtxt->nsNr = 0;
@@ -2078,22 +2063,50 @@
  */
 xmlXPathCompExprPtr
 xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) {
-    xmlXPathContextPtr xctxt;
+    xmlXPathContextPtr xpathCtxt;
     xmlXPathCompExprPtr ret;
 
-    if (style != NULL)
-	xctxt = xmlXPathNewContext(style->doc);
-    else
-	xctxt = xmlXPathNewContext(NULL);
-    if (style != NULL)
-	xctxt->dict = style->dict;
-    ret = xmlXPathCtxtCompile(xctxt, str);
-    xmlXPathFreeContext(xctxt);
+    if (style != NULL) {
+#ifdef XSLT_REFACTORED_XPATHCOMP
+	if (XSLT_CCTXT(style)) {
+	    /*
+	    * Proposed by Jerome Pesenti
+	    * --------------------------
+	    * For better efficiency we'll reuse the compilation
+	    * context's XPath context. For the common stylesheet using
+	    * XPath expressions this will reduce compilation time to
+	    * about 50%.
+	    *
+	    * See http://mail.gnome.org/archives/xslt/2006-April/msg00037.html
+	    */
+	    xpathCtxt = XSLT_CCTXT(style)->xpathCtxt;
+	    xpathCtxt->doc = style->doc;
+	} else
+	    xpathCtxt = xmlXPathNewContext(style->doc);	
+#else
+	xpathCtxt = xmlXPathNewContext(style->doc);
+#endif
+	xpathCtxt->dict = style->dict;
+    } else {
+	xpathCtxt = xmlXPathNewContext(NULL);
+    }
     /*
+    * Compile the expression.
+    */
+    ret = xmlXPathCtxtCompile(xpathCtxt, str);
+
+#ifdef XSLT_REFACTORED_XPATHCOMP
+    if ((style == NULL) || (! XSLT_CCTXT(style))) {
+	xmlXPathFreeContext(xpathCtxt);
+    }
+#else
+    xmlXPathFreeContext(xpathCtxt);
+#endif
+    /*
      * TODO: there is a lot of optimizations which should be possible
      *       like variable slot precomputations, function precomputations, etc.
      */
-     
+
     return(ret);
 }
 

Modified: packages/libxslt/branches/upstream/current/libxslt/xsltutils.h
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/xsltutils.h	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/xsltutils.h	2006-06-08 22:23:55 UTC (rev 563)
@@ -298,31 +298,6 @@
 XSLTPUBFUN void XSLTCALL		
 		xslDropCall			(void);
 
-#ifdef XSLT_REFACTORED
-/**
- * xsltPointerList:
- *
- * Pointer-list for various purposes.
- */
-typedef struct _xsltPointerList xsltPointerList;
-typedef xsltPointerList *xsltPointerListPtr;
-struct _xsltPointerList {
-    void **items;
-    int number;
-    int size;
-};
-
-XSLTPUBFUN xsltPointerListPtr XSLTCALL
-		xsltPointerListCreate		(void);
-XSLTPUBFUN void XSLTCALL
-		xsltPointerListFree		(xsltPointerListPtr list);
-XSLTPUBFUN void XSLTCALL
-		xsltPointerListClear		(xsltPointerListPtr list);
-XSLTPUBFUN int XSLTCALL
-		xsltPointerListAdd		(xsltPointerListPtr list,
-						 void *item);
-#endif /* XSLT_REFACTOR */
-
 #ifdef __cplusplus
 }
 #endif

Modified: packages/libxslt/branches/upstream/current/libxslt/xsltwin32config.h
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt/xsltwin32config.h	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt/xsltwin32config.h	2006-06-08 22:23:55 UTC (rev 563)
@@ -23,21 +23,21 @@
  *
  * the version string like "1.2.3"
  */
-#define LIBXSLT_DOTTED_VERSION "1.1.16"
+#define LIBXSLT_DOTTED_VERSION "1.1.17"
 
 /**
  * LIBXSLT_VERSION:
  *
  * the version number: 1.2.3 value is 1002003
  */
-#define LIBXSLT_VERSION 10116
+#define LIBXSLT_VERSION 10117
 
 /**
  * LIBXSLT_VERSION_STRING:
  *
  * the version number string, 1.2.3 value is "1002003"
  */
-#define LIBXSLT_VERSION_STRING "10116"
+#define LIBXSLT_VERSION_STRING "10117"
 
 /**
  * LIBXSLT_VERSION_EXTRA:

Modified: packages/libxslt/branches/upstream/current/libxslt.spec
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt.spec	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt.spec	2006-06-08 22:23:55 UTC (rev 563)
@@ -1,14 +1,14 @@
 Summary: Library providing the Gnome XSLT engine
 Name: libxslt
-Version: 1.1.16
+Version: 1.1.17
 Release: 1
 License: MIT
 Group: Development/Libraries
 Source: ftp://xmlsoft.org/XSLT/libxslt-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 URL: http://xmlsoft.org/XSLT/
-Requires: libxml2 >= 2.6.17
-BuildRequires: libxml2-devel >= 2.6.17
+Requires: libxml2 >= 2.6.25
+BuildRequires: libxml2-devel >= 2.6.25
 BuildRequires: python python-devel
 BuildRequires: libxml2-python
 BuildRequires: libgcrypt-devel
@@ -18,7 +18,7 @@
 %description
 This C library allows to transform XML files into other XML files
 (or HTML, text, ...) using the standard XSLT stylesheet transformation
-mechanism. To use it you need to have a version of libxml2 >= 2.6.17
+mechanism. To use it you need to have a version of libxml2 >= 2.6.25
 installed. The xsltproc command is a command line interface to the XSLT engine
 
 %package devel
@@ -27,19 +27,20 @@
 Requires: libxslt = %{version}
 Requires: libxml2-devel >= 2.5.6
 Requires: libgcrypt-devel
+Requires: pkgconfig
 
 %description devel
 This C library allows to transform XML files into other XML files
 (or HTML, text, ...) using the standard XSLT stylesheet transformation
-mechanism. To use it you need to have a version of libxml2 >= 2.6.17
+mechanism. To use it you need to have a version of libxml2 >= 2.6.25
 installed.
 
 %package python
 Summary: Python bindings for the libxslt library
 Group: Development/Libraries
 Requires: libxslt = %{version}
-Requires: libxml2 >= 2.6.17
-Requires: libxml2-python >= 2.6.17
+Requires: libxml2 >= 2.6.25
+Requires: libxml2-python >= 2.6.25
 Requires: %{_libdir}/python%(echo `python -c "import sys; print sys.version[0:3]"`)
 
 %description python
@@ -120,30 +121,5 @@
 %doc python/tests/*.xsl
 
 %changelog
-* Mon May  1 2006 Daniel Veillard <veillard at redhat.com>
-- upstream release 1.1.16 see http://xmlsoft.org/XSLT/news.html
-
-* Sun Nov  2 2003 Daniel Veillard <veillard at redhat.com>
-- cleanup, removal of the deprecated breakpoint library and
-  automated libxml2 dependancy level in the generated spec file.
-
-* Wed Oct 23 2002 Daniel Veillard <veillard at redhat.com>
-- revamped the spec file, cleaned up some rpm building problems
-
-* Wed Sep  4 2002 Daniel Veillard <veillard at redhat.com>
-
-- library paths fixed for x86-64
-
-* Fri Feb  8 2002 Daniel.Veillard <veillard at redhat.com>
-
-- added the python module
-- changed the Licence to MIT
-
-* Sat Nov 10 2001 Daniel.Veillard <daniel at veillard.com>
-
-- cleaned up the specfile
-
-* Mon Jan 22 2001 Daniel.Veillard <daniel at veillard.com>
-
-- created based on libxml2 spec file
-
+* Tue Jun  6 2006 Daniel Veillard <veillard at redhat.com>
+- upstream release 1.1.17 see http://xmlsoft.org/XSLT/news.html

Modified: packages/libxslt/branches/upstream/current/libxslt.spec.in
===================================================================
--- packages/libxslt/branches/upstream/current/libxslt.spec.in	2006-06-08 20:46:30 UTC (rev 562)
+++ packages/libxslt/branches/upstream/current/libxslt.spec.in	2006-06-08 22:23:55 UTC (rev 563)
@@ -27,6 +27,7 @@
 Requires: libxslt = %{version}
 Requires: libxml2-devel >= 2.5.6
 Requires: libgcrypt-devel
+Requires: pkgconfig
 
 %description devel
 This C library allows to transform XML files into other XML files
@@ -122,28 +123,3 @@
 %changelog
 * @RELDATE@ Daniel Veillard <veillard at redhat.com>
 - upstream release @VERSION@ see http://xmlsoft.org/XSLT/news.html
-
-* Sun Nov  2 2003 Daniel Veillard <veillard at redhat.com>
-- cleanup, removal of the deprecated breakpoint library and
-  automated libxml2 dependancy level in the generated spec file.
-
-* Wed Oct 23 2002 Daniel Veillard <veillard at redhat.com>
-- revamped the spec file, cleaned up some rpm building problems
-
-* Wed Sep  4 2002 Daniel Veillard <veillard at redhat.com>
-
-- library paths fixed for x86-64
-
-* Fri Feb  8 2002 Daniel.Veillard <veillard at redhat.com>
-
-- added the python module
-- changed the Licence to MIT
-
-* Sat Nov 10 2001 Daniel.Veillard <daniel at veillard.com>
-
-- cleaned up the specfile
-
-* Mon Jan 22 2001 Daniel.Veillard <daniel at veillard.com>
-
-- created based on libxml2 spec file
-




More information about the debian-xml-sgml-commit mailing list