Hi again Emmanuel!

A short update:

I tested again with your version OOo300m9 (build 9358) and found the same behaviour as with my previous test on DEV300m39. That is sourceURL and sourceBaseURL are also set here but sourceBaseURL does not contain what it should :-(

If OpenOffice.org would have behaved as expected something like the following should have output the filename in an XSL-Transformation.

<text:p>Filenname <xsl:value-of select="substring-after($sourceURL,$sourceBaseURL)"/></text:p>

Something similar works for targetURL and targetBaseURL but those are only set for the file to save to when doing an export via XSLT not during import.

Kind regards,
Bernd Eilers

Bernd Eilers wrote:

Hi Emmanuel,

I wrote myself a sample stylesheet to test those XSLT parameters and tested with milestone DEV300m39.

I could not reproduce that sourceURL and sourceBaseURL are empty as you said was happeing for your OOo300m9 version I had values for those parameters too. Unfortunatly tough sourceBaseURL did not contain what I would have expected. I filed an issue in OOo issuetracker for this.

http://qa.openoffice.org/issues/show_bug.cgi?id=98408

The sample stylesheet that I used for testing is attached to that issue.

Kind regards,
Bernd Eilers


Emmanuel Bégué wrote:
Hello,

Thank you for this answer.

I tested all 7 parameters; unfortunately, only
the following three are populated during a transform:
  targetBaseURL
  targetURL
  XMultiServiceFactory

The other parameters, including "sourceURL", "sourceBaseURL"
and "stylesheetURL" are empty.

I am attempting the transformation via the "File/Export"
command on the active file which has a name. I'm using
OOo300m9 (build 9358) on WinXP SP2 with JRE 1.6.0.

Thanks for any help.
Regards,
EB

-----Original Message-----
From: Bernd Eilers [mailto:bernd.eil...@sun.com]
Sent: Friday, January 23, 2009 12:42 PM
To: dev@openoffice.org
Subject: Re: [dev] XSLT filters in Writer / source file name



Hi there!

The code calling the XSLT sets some XSLT Parameters which you can
reference by $<variablename> in your Transformation.

filter/source/xsltfilter/XSLTransformer.java is where this is done in
the OpenOffice.org source code.


The parameters given to the Transformation are sourceURL, sourceBaseURL,
targetURL, targetBaseURL, publicType, systemType XMultiServiceFactory

I think it should be possible to extract the filename from the
$sourceURL variable inside the XSLT using substringafter XSLT function
with the $sourceBaseURL variable as second parameter.

Kind regards,
Bernd Eilers

Emmanuel Bégué wrote:
Hello,

I've sent this question to users' mailing list
but to no avail, so I'm sending it here; if it
is considered off topic I apologize.

I'm writing a filter in XSLT for Writer.

I need to include in the resulting XML file, the
name of the file being transformed, but I can't
seem to find it in the source XML file (neither
in <office:meta> nor elsewhere).

It also does not seem to be mentionned in the
OpenDocument spec. either (but I could be wrong).

It IS possible to include in the document a
"text field" that would hold the filename (see
OpenDocument v1.1, Chapter 6, 6.2.8 File Name
Fields).

But, if such field has not been included in
the source document, is there a way to get the
filename from within the XSLT filter?

Thanks,
Regards,
EB



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to