Hello Bern,

Thank you for this answer.

Would there be an example somewhere that would get
me started with the solution you are proposing?

Thanks again,
Regards,
EB

> -----Original Message-----
> From: Bernd Eilers [mailto:[email protected]]
> Sent: Friday, January 23, 2009 7:08 PM
> To: [email protected]
> Subject: Re: [dev] XSLT filters in Writer / source file name
>
>
>
> Hi again!
>
> Emmanuel Bégué wrote:
>
> > Thank you Bernd for this update.
> >
> > But, do you mean sourceURL and sourceBaseURL are only set during
> > import?
> >
>
> Well I should have tested better before firing up my last reply.
>
> Indeed the sourceURL and soureBaseURL parameters are only set during
> import not on export. Contrary to would I said in my last reply. *sigh*
>
> So what I wrote before does work on import filters but not on export
> filters and thats where you would want it, sorry.
>
> So here is a new idea on what might eventually work:
>
> There´s nothing in the office-meta data or similar on where your
> transformation could get the filename from. So XSLT alone does not help
> you here.
>
> Your only chance is that the call to the XSL-Transformation contains a
> XMultiServiceFactory object as parameter which is a java object on which
> you can access the OpenOffice.org API and that the OpenOffice.org API
> sure must have means to obtain the current filename.
>
> So the solution could be something along the lines of calling a custom
> java class function from your XSLT and giving that function the
> XMultiServiceFactory as parameter which should be an java object
> implementing the interface com.sun.star.lang.XMultiServiceFactory.
>
> <http://api.openoffice.org/docs/common/ref/com/sun/star/lang/XMult
> iServiceFactory.html>
>
> I am currently not sure which ServiceFactory you will get here, but I
> suppose it is one associated with the current document. If not some
> additional calls to get the current document would be necessary before
> the next steps.
>
>  From the XMultServiceFactory you obtain the
> com.sun.star.document.OfficeDocument service
>
> XInterface
> officeDocument=xMultServiceFactory.createService("com.sun.star.doc
ument.OfficeDocument");
>
> http://api.openoffice.org/docs/common/ref/com/sun/star/document/Of
> ficeDocument.html
>
> Then you use queryInterface to get the com.sun.star.frame.XModel
> interface on that service and on the XModel interface you can call
> getURL() to get the URL of the document. And from the URL you get your
> filename.
>
> http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XModel.html
>
> Have not found the time to check/try this out in detail and provide a
> working example, sorry.
>
>  > [...snip...]
>
> Kind regards,
> Bernd Eilers
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to