Question: is it at all possible to 'pre-proccess' in XSLT?

with preprocessing i mean updating the (in memory representation) of the source tree.

is this possible, or do i need to do multiple transforms for it.

use case:
we have Docbook reference manuals for out clients but for certain clients these need different 'skins' (different images etc). so what i was hoping to do is transform the image *fileref* path depending on a parameter. then apply the rest of the normal Docbook XSL templates.

Answer: 
Since you are trying to generate slightly different output from the same DocBook XML source, you might want to look into the "profiling" (conditional markup) support in DocBook XSL stylesheets. See [Chapter 26](http://www.sagehill.net/docbookxsl/Profiling.html) in [*DocBook XSL: The Complete Guide*](http://www.sagehill.net/docbookxsl/) by Bob Stayton:

> 
> Profiling is the term used in DocBook
>  to describe conditional text.
>  Conditional text means you can create
>  a single XML document with some
>  elements marked as conditional. When
>  you process such a document, you can
>  specify which conditions apply for
>  that version of output, and the
>  stylesheet will include or exclude the
>  marked text to satisfy the conditions.
>  This feature is useful when you need
>  to produce more than one version of a
>  document, and the versions differ in
>  minor ways.
> 
> 
> 

For example, to use different images for, say, Windows and Mac versions of the same document, you might have a DocBook XML fragment like this:

```
<figure>
  <title>The Foo dialog</title>
  <mediaobject>
    <imageobject os="windows">
      <imagedata fileref="screenshots/windows/foo.png"/>
    </imageobject>
    <imageobject os="mac">
      <imagedata fileref="screenshots/mac/foo.png"/>
    </imageobject>
  </mediaobject>
</figure>

```

Then, you would use the profiling-enabled versions of the DocBook XSL stylesheets with the [`profile.os`](http://docbook.sourceforge.net/release/xsl/current/doc/html/profile.os.html) parameter set to `windows` or `mac`.
Maybe you should use XSLT "OOP" methods here. Put all the common templates to all clients in a stylesheet, and create an stylesheet for each client with specific templates overriding common ones. Import the common stylesheet within the specific ones with xsl:import, and you'll do only one processing by calling the stylesheet corresponding to a client.