• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use X3D-Edit to import X3D models by using an XSLT Style Sheet

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm in the process of converting X3D files into X3DV files for a project that I'm building in Java. I'm using the Netbeans IDE to program Java, and I have Xj3D installed along with X3D-Edit. When I go to convert X3DV files into X3D files, it works great, but when I try and convert X3D files into X3DV files, it doesn't seem to work. I have two XSLT Style Sheets downloaded named X3dToVrml97 and X3dtoX3dvClassicVrmlEncoding along with a Windows Batch file named X3dTo X3dvClassicVrmlEncoding. The versioon of X3D-Edit that I have is X3D-Edit 3.3 and the Netbeans version that I have is Netbeans 8.1. The problem that I have is when I click on the 'Export from X3D' in the X3D drop down menu, a dialogue box appears asking which X3D files I'd like to select, however it always seems empty and I have a handful of X3D files within my Netbeans project. The dialogue box that appears when I go onto the X3D drop down menu can be found here.
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it is fine for you to do the batch job of transforming a bunch of x3d into x3dv in classic vrml format (or the tool allows you to transform to vrml97 format, just in case you are interested in knowing), you can do it with your own batch file. I say your own batch file because the batch file you seem to have downloaded and in hand is quite out-dated and was written in a fashion which can confuse users quite a bit. For instance vorlon is practically out of the sceen... checking syntax with xmlint is usually unnecessary if the users already know what they are doing and simply want to get the x3dv file output..., hence you don't even bother to have xmlint downloaded etc.

One thing you need to have is an xslt engine. The said batch file use saxon which is a good choice (but you can use Apache's up-to-date version of xalan. no problem). But it uses some dated info and therefore you need to rewrite that part despite all. If you keep that suggestion of using saxon, you must download it and the free version works just fine. I happen to have saxon9 on my box and know it quite well. If you go to their site, you might find a new version and it is in general recommended to use a more updated version. Just download its -j (java) and -n (dot net) variants. To use it for batch (or powershell), you can stick to the dotnet version. The executable is now called transform.exe (rather than saxon.exe as written in that dated batch file).

You can write a greatly simplified bat, something like this.

I will transform it to ClassicVRML encoding output named after the input x3d. If it is HelloWorld.x3d, it would output HelloWorldClassicVRML.x3dv etc... (The naming is actually quite free. If you want it differently named, just edit your requirement into the batch file.) The xslt file is having an extension xslt. I most of the time use xsl then just edit the line set xsltext=xslt to set xsltext=xsl.

Since you use X3dToX3dvClassicVrmlEncoding.xslt, you don't even need to set the parameter fileEncoding, as it is defaulted to ClassicVRML. I still put there just for in case you read the downloaded bat and find it there.

For example, now if you call:

You will transform a HelloWorld.x3d (or something you put there for testing...) to HelloWorldClassicVRML.x3dv.

If you do this:

It will transform an x3d file 2d.x3d to output a 2dClassicVRML.x3dv. That's all it does.
 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help and I'm editing it round now and I was wondering what you mean by the ' [hard enter] ' sections? And when I go to open the X3dToX3dvClassicVrmlEncoding.bat file after making the alterations, it doesn't want to run and I have downloaded SaxonHE9-7-0-3J which I believe is the correct one to download but I'm unsure
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic