[lxml-dev] How to access XSLT Parameters Inside an Extension Function?

Thomas Schraitle tom_schr at web.de
Tue Jun 10 21:05:43 CEST 2008


Hi,

On Dienstag, 10. Juni 2008, Stefan Behnel wrote:
> [...]
> Why not
>
>     def foo(_, a, b, c): ...
>
> Then you take your XSLT parameter, say "$param" and call your function
> like this:
>
>     <xsl:value-of select="foo(1, 2, $param)"/>

Ok, I knew it was that dump simple... ;)

Unfortunately, it does not work in my case. 
I use the DocBook stylesheets very much in combination with xsltproc. 
However, xsltproc doesn't support the DocBook extension functions. These 
create line numbers, get the size of a graphic, etc. You know, these sort 
of things that are very difficult or impossible to deal with XSLT. The 
problem is these extension functions are only implemented for Saxon or 
Xalan.

Well, my idea was to write these in lxml. To do this, I have to stick with 
the number of arguments, unless I change the DocBook stylesheets. My 
dream would be to have a kind of a wrapper for xsltproc which implements 
the extension function. With this I can transform any DocBook document 
without any customization so far.

Do you see any other solution? I thought I could get the parameters from 
the context, but obviously this isn't possible. It would be very useful 
if I could get access to the stylesheet itself to seek for any parameters 
(just day dreaming. ;) )


Thanks,
Tom

-- 
Thomas Schraitle


More information about the lxml-dev mailing list