Page 1 of 1

XSLT, Depends on how I start Oxygen

Posted: Mon Feb 11, 2008 6:01 pm
by mphare
I'm still on Oxygen 8.1 running on XP sp2.

I have an XSLT that uses:

Code: Select all

		<xsl:variable name="subtreeCmdsource" 		select="collection('/mphare/Development/structured-fm/XSLT/source/?select=*.xml')"/>
because I want to run the transformation against a bunch of XML files, not just one.

If I open Oxygen by double clicking on the XSL file or on the Oxygen Project XML file, everything works just fine.

However, if I open Oxygen from the shortcut, and even if I re-open the Project, running the XSL I get 2 errors:

Code: Select all

F The file or directory file:/mphare/Development/structured-fm/XSLT/source/ does not exist
E The file or directory file:/mphare/Development/structured-fm/XSLT/source/ does not exist
Why does it make a difference as to how Oxygen is opened whether or not the XSLT executes correctly?

Re: XSLT, Depends on how I start Oxygen

Posted: Mon Feb 11, 2008 7:00 pm
by sorin_ristache
Hello,

I cannot reproduce the problem with oXygen version 8.2. Do you get the same error with version 8.2? The same license key that you use with version 8.1 is valid for version 8.2. If you get the same error please post the full file path of the XSLT stylesheet and of the folder /mphare/Development/structured-fm/XSLT/source.


Regards,
Sorin

Re: XSLT, Depends on how I start Oxygen

Posted: Mon Feb 11, 2008 9:12 pm
by mphare
Thanks for the heads up about 8.2

Same problem, but I've narrowed it down to drive letter.

My install is on the C: drive, I work on the D: drive.

I changed the shortcut to Oxygen 8.2 to make the D: drive the "Start In" drive and it works.

So, it's probably not really an issue.

Thanks!

Re: XSLT, Depends on how I start Oxygen

Posted: Mon Feb 11, 2008 9:26 pm
by mphare
Spoke too soon..

Now, with 8.2, it's doesn't work at all, even if I change the shortcut.

So, I'm backing back to R8.1.

I'm sure it has something to do with the drive letters being different.

Re: XSLT, Depends on how I start Oxygen

Posted: Mon Feb 11, 2008 9:39 pm
by mphare
Here's the stylesheet:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--
=====================================================
TL1Stats.xsl
- - - - - - - - - - - - - - - - - - - -
This XSLT searches through the NMIS gathering NMI Statistics

- - - - - - - - - - - - - - - - - - - -
copyright 2007 Fujitsu Network Communications
=====================================================
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<!-- Begin Output Processing -->
<xsl:preserve-space elements="*"/>
<!-- Since this going to be imported into Framemaker, we will output in XML -->
<xsl:output method="xml"/>


<!--
-->
<xsl:template match="/">
<!--
-->
<xsl:variable name="subtreeCmdsource"
select="collection('/mphare/Development/structured-fm/XSLT/source/?select=*.xml')"/>
<!--
-->
<xsl:text>&#x0A;</xsl:text>
<Section>
<Appendix>

<Head>Task Sets</Head>
<Para/>
<xsl:text>&#x0A;</xsl:text>
<table colsep="1" frame="all" rowsep="1" tabstyle="FormatA">
<xsl:text>&#x0A;</xsl:text>
<title>Processed Files</title>
<tgroup colsep="1" cols="2" rowsep="1">
<xsl:text>&#x0A;</xsl:text>
<colspec colname="1" colnum="1" colwidth="1.0in"/>
<xsl:text>&#x0A;</xsl:text>
<colspec colname="2" colnum="2" colwidth="4.0in"/>
<xsl:text>&#x0A;</xsl:text>

<thead>
<xsl:text>&#x0A;</xsl:text>
<row rowsep="1">
<xsl:text>&#x0A;</xsl:text>
<entry colname="1" cellFmt="Small">ID</entry>
<entry colname="2" cellFmt="Small">Filename</entry>
<xsl:text>&#x0A;</xsl:text>
</row>
<xsl:text>&#x0A;</xsl:text>
</thead>
<xsl:text>&#x0A;</xsl:text>
<tbody>
<!--
Dump the names of all the files we are processing during this run
-->
<xsl:call-template name="fileNames">
<xsl:with-param name="param1" select="$subtreeCmdsource"/>
</xsl:call-template>
</tbody>
</tgroup>
</table>
</Appendix>

</Section>
</xsl:template>

<!--
======================================================================
Start of Templates
======================================================================
-->
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Template:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Template:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<xsl:template name="fileNames">
<xsl:param name="param1"/>
<xsl:for-each select="$param1/.">
<!--
We are going to output the filename as:
# : filename
where # is an enumeration of the file
and filename is the name of the file

position() outputs the enumeration
-->
<row>
<entry colname="1" cellFmt="Small">
<xsl:value-of select="position()"/>
</entry>
<!--
for the filename, tokenize the current document uri using
a backslash as the delimeter.
Then, the last() node will be just the filename
-->
<entry colname="2" cellFmt="Small">
<xsl:value-of select="tokenize(document-uri(.), '/')[last()]"/>
</entry>
<xsl:text>&#x0A;</xsl:text>
</row>
</xsl:for-each>

</xsl:template>
</xsl:stylesheet>

If I move the source files and directory hierarchy to the C Drive, the problem goes away.

Re: XSLT, Depends on how I start Oxygen

Posted: Thu Feb 14, 2008 1:03 am
by mphare
Hi,

Any ideas on this? 8.2 completely broke my XSLT processing. I'm forced to back rev myself to 8.1 so I can continue working.

Re: XSLT, Depends on how I start Oxygen

Posted: Thu Feb 14, 2008 2:01 pm
by sorin_ristache
You installed oXygen on the drive C: but your XML files (/mphare/Development/structured-fm/...) are located on drive D:. In case you start oXygen from the start menu the start driver is C: so your relative path (/mphare/Development/structured-fm/XSLT/source) is resolved relative to C:. The error is correctly reported in this case.

In case you start oXygen by double clicking on the XSLT from D: the start driver should be D: so the files should be read correctly from D:\mphare\Development\structured-fm\XSLT\source\*.xml. We will investigate this issue.

Until we fix the problem please pass a URL parameter to the collection() function, that is:

Code: Select all

file:///D:/mphare/Development/structured-fm/XSLT/source
In this case the start drive does not matter.


Regards,
Sorin

Re: XSLT, Depends on how I start Oxygen

Posted: Thu Feb 14, 2008 5:43 pm
by mphare
Thanks.

That works in 8.1 but not in 8.2

The problem with using the drive letter is I ultimately run the transformations from cygwin bash scripts. The drive letter causes problems in that case.

But, thanks for getting back to me.
I'll stick with 8.1 for the time being.

Would 9.1 have this same issue?

Re: XSLT, Depends on how I start Oxygen

Posted: Thu Feb 14, 2008 6:18 pm
by sorin_ristache
It does not matter how you run the stylesheet. If you specify a URL as parameter for the XSLT 2.0 collection() function (file:///D:/mphare/Development/...) the XML collection files should be located correctly.

Yes, version 9.1 has the same problem. We will look into the start drive issue.


Regards,
Sorin

Re: XSLT, Depends on how I start Oxygen

Posted: Fri Feb 15, 2008 11:34 am
by sorin_ristache
I figured out why your files specified by a relative location are not found. On Windows the start directory is the installation directory (C:\Program Files\Oxygen XML Editor <version-number>) both when oXygen is started from the start menu and when it is started by double clicking on a file located on the D: drive. This is the start directory of the Java virtual machine that Windows sets to the executable file that starts oXygen and it cannot be changed. It is not an oXygen bug. You can see the path of the start directory in the property user.dir in the About dialog opened from menu Help -> About, the System properties tab of the dialog.

For example if you start the Java virtual machine that runs oXygen from a folder on the D: drive with a command like the one from [oXygen-install-dir]/oxygen.bat then the relative path is resolved as you need for your stylesheet.


Regards,
Sorin

Re: XSLT, Depends on how I start Oxygen

Posted: Fri Feb 15, 2008 5:50 pm
by mphare
With 8.1 I can start Oxygen by double-clicking on the XSL file on the D: drive or, I can change the 'Start In' directory in the Oxygen shortcut, and the relative path finds the files on the D: drive.

With 8.2 it doesn't. So something changed between 8.1 and 8.2.
Whether it's a bug or not, that's your call.

Myself, I like the 8.1 behaviour better.

Re: XSLT, Depends on how I start Oxygen

Posted: Mon Feb 18, 2008 8:06 pm
by mphare
It occurs to me that maybe upgrading my Saxon might change how this works.

Is it possible to ad Saxon9 to Oxygen 8.2?

If so, are their guidelines or instructions on how to do it?

Thanks,

- m

Re: XSLT, Depends on how I start Oxygen

Posted: Tue Feb 19, 2008 12:50 pm
by sorin_ristache
Hello,

I think upgrading the Saxon version does not change how the start directory is set to a Windows process. Anyway replacing the Saxon version means replacing the jar files of the old Saxon version with the jar files of the new version in the [oXygen-install-dir]/lib directory. If the new version of Saxon introduced API changes that were taken into consideration only in a later version of oXygen (released after the new version of Saxon) then the transformations may throw a NoSuchMethodError or a NoClassDefFoundError in the Editor perspective or in the Debugger perspective of oXygen.


Regards,
Sorin

Re: XSLT, Depends on how I start Oxygen

Posted: Tue Feb 19, 2008 10:42 pm
by george
Saxon 9 added API changes and therefore overwriting Saxon 8 libraries from oXygen 8 will cause unexpected behavior.

However, you can configure Saxon 9 as an external XSLT processor in oXygen 8 and use it in your transformation scenarios.

Best Regards,
George