How to modify xs3p.xsl

Here should go questions about transforming XML with XSLT and FOP.
Oliver
Posts: 4
Joined: Sat Oct 21, 2006 1:27 am

How to modify xs3p.xsl

Post by Oliver »

Hi

I tried to modify the xs3p.xsl to change the output of oXygen's schema documentation, but for some reason my changes are ignored.

I even deleted the file and oXygen is still able to generate the schema documentation. Does oXygen read it at all?

How do modify the output for schema documentation?

Thanks,
Oliver
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Oliver,

oXygen uses a copy of xs3p.xsl that is located inside oxygen.jar. The xs3p.xsl from frameworks is there to be used from command line, see the schemaDocumentation.bat and .sh scripts.

Best Regards,
George
Oliver
Posts: 4
Joined: Sat Oct 21, 2006 1:27 am

Post by Oliver »

Hi George,

Thanks for your hint! But for some reason I'm not able to generate the schema documentation _without_ using hashcoded filenames. This is my batch file command line:

schemaDocumentation.bat myschema.xsd images html_files myschema.xsd.html .png false

In the xs3p.xsl I specified:
<xsl:param name="useHashcodes" select="'false'"/>

Now I get image names like h1821458449.png but in the HTML file the image link goes to the real element name and the image is not found.
It seems as if the image generator uses hash encoded filenames but the document generator not.

Thank you very much for your help!

Greetings,
Oliver
Oliver
Posts: 4
Joined: Sat Oct 21, 2006 1:27 am

Post by Oliver »

One other thing:

I was looking in the example for xs3p.xsl and how to generate the documentation for multiple schemas in one shot using ant.

ant is giving me this error:

Code: Select all


C:\Program Files\Oxygen XML Editor 7.2\frameworks\xs3p\examples>ant
Buildfile: build.xml

all:
[xslt] Transforming into C:\Program Files\Oxygen XML Editor 7.2\frameworks\xs3p\examples\ant-results
[xslt] Processing C:\Program Files\Oxygen XML Editor 7.2\frameworks\xs3p\examples\XMLSchema.xsd to C:\Program Files\Oxygen XML Editor 7.2\frameworks\xs3p\examples\ant-results\XMLSchema.html
[xslt] Loading stylesheet C:\Program Files\Oxygen XML Editor 7.2\frameworks\xs3p\xs3p.xsl
[xslt] : Error! Syntax error in 'if (./ancestor-or-self::*[last() - 1]/self::xsd:redefine) then ./ancestor-or-self::*[last() - 2] else ./ancestor-or-self::*[last() - 1]'.
[xslt] : Error! file:///C:/Program%20Files/Oxygen%20XML%20Editor%207.2/frameworks/xs3p/xs3p.xsl: line 3233: Error parsing XPath expression 'if (./ancestor-or-self::*[last() - 1]/self::xsd:redefine) then ./ancestor-or-self::*[last() - 2] else ./ancestor-or-self::*[last() - 1]'.
[xslt] : Error! file:///C:/Program%20Files/Oxygen%20XML%20Editor%207.2/frameworks/xs3p/xs3p.xsl: line 3233: Required attribute 'select' is missing.
[xslt] : Error! file:///C:/Program%20Files/Oxygen%20XML%20Editor%207.2/frameworks/xs3p/xs3p.xsl: line 9416: Variable 'correctedFullPath' is multiply defined in the same scope.
[xslt] : Fatal Error! Could not compile stylesheet
[xslt] Failed to process C:\Program Files\Oxygen XML Editor 7.2\frameworks\xs3p\examples\XMLSchema.xsd

BUILD FAILED
C:\Program Files\Oxygen XML Editor 7.2\frameworks\xs3p\examples\build.xml:10: Fatal error during transformation

Total time: 4 seconds
C:\Program Files\Oxygen XML Editor 7.2\frameworks\xs3p\examples>
I'm using a plain apache ant 1.6.5 and jdk1.5.0_07. Anyone seen an error like this? I don't think xs3p.xsl is wrong, perhaps another version of ant is working?

Thanks,
Oliver
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Oliver,

Indeed, it seems that the code that generates the diagrams knows yes and no as parameter values. Please edit the script to replace the USE_HASH_CODES parameter with no, like below for instance

(some new lines added for readability)
java -cp "%~dp0;%~dp0/classes;%~dp0/lib/oxygen.jar;%~dp0/lib/oxygen.jar;
%~dp0/lib/xml-apis.jar;%~dp0/lib/xercesImpl.jar;%~dp0/lib/log4j.jar;
%~dp0/lib/resolver.jar" ro.sync.exml.SwingSDImageGenerator "%XSDPATH%"
"%MAINDOCBASE%\%IMAGESFOLDER%" %DIAGRAMS_EXTENSION% no

The modified xs3p.xsl is an XSLT 2.0 stylesheet so you need to use from ant an XSLT 2.0 processor like Saxon 8 for instance. From ant you get by default an XSLT 1.0 processor, thus the errors you got.

Best Regards,
George
Oliver
Posts: 4
Joined: Sat Oct 21, 2006 1:27 am

Post by Oliver »

Hi George,

Thank you very much! I'm using the line you suggested and this is working fine now.
Do you know if there is another parameter for the diagram generator to get chunking support? The generateChunks="true" parameter does not have any effect on the image generator.
The problem is that he is creating links like

"myschema.xsd.html#type_MyType"

in the .map file for the image maps. For one big html file this is ok, but if you enable chunking the link should rather look like this:

'myschema.xsd.html_type_MyType.html#type_MyType".

BTW, the integrated documentation generator in oXygen does this correctly.
The modified xs3p.xsl is an XSLT 2.0 stylesheet so you need to use from ant an XSLT 2.0 processor like Saxon 8 for instance. From ant you get by default an XSLT 1.0 processor, thus the errors you got.
Thanks for pointing me to the right direction. Actually there is a parameter for ant to specify the xslt processor. I'm using this line in my build.xml, just in case someone else is running into the same issue:

Code: Select all


<xslt basedir="." destdir="${target-dir}" extension=".html" style="${original-loc}/${xslt-file}" classpath="..\..\..\lib\saxon8.jar">

Thanks,
Oliver
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Oliver,

It is not possible to make the diagram images generator know about chunks from the command line. We will add support for this in the next release. Sorry. There is indeed a comment in the batch file that suggests that this might be possible but that variable that is commented out in the batch script is not actually used.

Best Regards,
George
Post Reply