Re: [xslt] Expanding Stylesheets and [OT] dealing with manpages



On Fri, Aug 17, 2001 at 03:58:04PM -0400, Ignacio Vazquez-Abrams wrote:
> >   Trying to reserialize a stylesheet from the compiled result should be
> > doable, but:
> >     - it's not trivial
> 
> Just what I need: another devel task :P Feel like giving me some pointers?

  Ouch, you asked for it:
    - first get familiar with the internals and especially the
      stylesheet compilation
      http://xmlsoft.org/XSLT/internals.html#XSLT1
    - second look at existing serialization code like xmlNodeDumpOutput()
      in libxml/tree.c
    - third look at how the stylesheet document get transformed in
      libxslt/libxslt/xslt.c xsltPrecomputeStylesheet() especially,
      note how blank text nodes are removed (some namespaces are moved
      too but trying to reverse this might be difficult and not useful),
      and how disable-output-escaping is directly saved in the text nodes.

  From that point you should have enough knowledge to make a pretty good
reserialisation of a single stylesheet. 
  As a second step if you want to build the equivalent of a preprocessed
include/import compound stylesheet, then thing get harder, basically you
need to augment the document with inherited properties, i.e. aggregate
values from the child sheets and run a reverse cascading order check 
to verify that they arent' blocked by higher priority values.

  The simplest is probably to rebuid a second tree and then ask libxml
to serialize and format it xmlSaveFormatFile(filename, doc, 1);

> I'm taking a look at it now (I need to update my libs; can you believe I'm
> still at libxslt 0.11.0?!), but I was thinking of something along the lines of
> '<xsl:output method="text">'. Ah well, it's a start.

  upgrade to libxml2-2.4.2 and libxslt-1.0.2, or even better use CVS,
this helps making patches.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]