[x3d-public] Awful classnames in X3dToJava.xlst

yottzumm at gmail.com yottzumm at gmail.com
Tue Apr 18 21:48:25 PDT 2017


Looks like Saxon9 is your own macro.  I’ll have to pull it out.

John

Sent from Mail for Windows 10

From: Don Brutzman
Sent: Wednesday, April 19, 2017 12:39 AM
To: yottzumm at gmail.com; X3D Graphics public mailing list
Subject: Re: Awful classnames in X3dToJava.xlst

On 4/18/2017 9:25 PM, yottzumm at gmail.com wrote:
> How do I pass that on the command line?  I must be using saxon wrong?

every xslt processing engine has its own configuration style.  same stylesheet works in each case (thank you XSLT standard).

Using Netbeans or X3D-Edit or XMLSPy is actually quite simple: pick file, then pick stylesheet, then boom presto.

use saxon docs, i believe there are links in the stylesheet... can add any other you suggest.

quick search also finds

	Running XSLT from the Command Line
	http://www.saxonica.com/html/documentation/using-xsl/commandline/index.html

>  I will try to look at the build.xml files, but I am fading?

each archive has a customized build.xml such as the following; heavy Ant-ness follows, somewhat documented.

     <target name="processScenes.java" description="generate java source, .class files, javadoc" depends="">
		<mkdir  dir="${java.classes.dir}"/>
         <echo message="Verifying Apache Ant XML Catalog resolver classpath: ${resolver.dir}/resolver.jar (${resolver.jar.length} bytes)"/>
         <for param="file.path.name">
             <path>
                 <fileset refid="x3dScenes"/>
             </path>
             <sequential>
                 <propertyregex
                         property="name.short"
                         override="true"
                         input="@{file.path.name}"
                         regexp="([^\n]*)[\\/]([^\n]*)\.x3d"
                         select="\2"/>
                 <propertyregex
                         property="relative.path1"
                         override="true"
                         input="@{file.path.name}"
                         regexp="([^\n]*)ConformanceNist[\\/]([^\n^\\^/]*)[\\/]([^\n]*)\.x3d"
                         select="\2"/>
                 <propertyregex
                         property="relative.path2"
                         override="true"
                         input="@{file.path.name}"
                         regexp="([^\n]*)ConformanceNist[\\/]([^\n^\\^/]*)[\\/]([^\n^\\^/]*)([\\/][^\n]*)\.x3d"
                         select="\3"/>
                 <!-- trace
                 <echo></echo>
                 <echo>@file.path.name       = @{file.path.name}</echo>
                 <echo>$archive.path         = ${archive.path}</echo>
                 <echo>$relative.path1       = ${relative.path1}</echo>
                 <echo>$relative.path2       = ${relative.path2}</echo>
                 <echo>$name.short           = ${name.short}</echo>
                 -->
                 <outofdate>
                     <sourcefiles>
                         <filelist>
                             <file name="@{file.path.name}"/>
                         </filelist>
                     </sourcefiles>
                     <mapper dir="." type="glob" from="*.x3d" to="*.java"/>
                     <sequential>
                         <!-- process individual files here. show full path to facilitate user loading, editing of reported files -->
                         <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.java produced from ${name.short}.x3d</echo>
                         <!-- Saxon9 is locally defined macro -->
                         <Saxon9  scene="${relative.path1}/${relative.path2}/${name.short}"
                             stylesheet="${stylesheet.dir}/X3dToJava"
                         parameterPair1="packageName=${archive.name}.${relative.path1}.${relative.path2}"
                         parameterPair2=  "className=${name.short}"
                         parameterPair3="includeLicense=true"
                                 suffix=""
                              extension="java"
                               compiled="false"
                                 expand="on"/>
                         <!-- expand:on since DTD defaults needed -->
						<!-- <echo message="... compiling ${name.short}.java"/> -->
						<javac srcdir ="${relative.path1}/${relative.path2}/"
							 classpath="${x3djsail.stylesheets.dir}/${jsai.full.archive.jar.name}"
							   destdir="${java.classes.dir}"
							     debug="on"
							   verbose="${javac.verbose}"
							   failonerror="false"
							   includeantruntime="false">
							<include name="${name.short}.java"/>
							<exclude name="newX3dScript.java"/>
							<exclude name="**/CircleLines.*"/>
							<exclude name="**/bounce2.*"/>
							<exclude name="**/javasrc/**/*"/>
							<exclude name="**/originals/**/*"/>
							<!-- X3dForWebAuthors -->
							<exclude name="KelpForestExhibit/FishSchoolCode/*"/>
							<!-- Basic -->
							<exclude name="course\ExtrusionXj3dGoldberg1999.*"/>
							<exclude name="development/TestRegularExpressionChecks.*"/>
							<exclude name="development/TestSchematronDiagnostics.*"/>
							<exclude name="development/QuadTreeExamples.*"/>
							<exclude name="development/SpinGroupInternalSubsetDeclaration.*"/>
							<exclude name="DistributedInteractiveSimulation/EntityProcessor*"/>
							<exclude name="DistributedInteractiveSimulation/BaseballBackspin/*"/>
							<exclude name="DistributedInteractiveSimulation/CannonProject/*"/>
							<exclude name="DistributedInteractiveSimulation/EntityProcessor.*"/>
							<exclude name="ExperimentalBinaryCompression/isenburg/**/*"/>
							<exclude name="ExternalAuthoringInterface/BoxEai.*"/>
							<exclude name="ExternalAuthoringInterface/CreateSphereEai.*"/>
							<exclude name="ExternalAuthoringInterface/HelixEai.*"/>
							<exclude name="ExternalAuthoringInterface/SwitcherEai.*"/>
							<exclude name="ExternalAuthoringInterface/ViewSwitchEai.*"/>
							<exclude name="ExternalAuthoringInterface/code/**/*"/>
							<exclude name="Geospatial/GeoVrmlSiteExamples/**/*"/>
							<exclude name="HumanoidAnimation/ClientNetListener.*"/>
							<exclude name="HumanoidAnimation/VoiceActivated/*"/>
							<exclude name="LatticeXvl/XvlShell.*"/>
							<exclude name="Networking/ConnectionScript.*"/>
							<exclude name="Networking/NetworkSensorScript.*"/>
							<exclude name="NURBS/NurbsCurve.*"/>
							<exclude name="NURBS/NurbsPatchSurface.*"/>
							<exclude name="NURBS/NurbsPositionInterpolator.*"/>
							<exclude name="ScriptConformance/originalExamples/*"/>
							<exclude name="ScriptConformance/SAIExample*.*"/>
							<exclude name="ScriptConformance/ScriptNodeEventOutControl.*"/>
							<exclude name="ScriptConformance/ScriptNodeFieldControl.*"/>
							<exclude name="ScriptConformance/vrml/**/*"/>
							<exclude name="ScriptConformance/originalExamples/*"/>
							<exclude name="StudentProjects/DeadReckoningComparisons/*"/>
							<exclude name="StudentProjects/melon/*"/>
							<exclude name="StudentProjects/Race20/**/*"/>
							<exclude name="X3dSpecifications/SAIExample*.*"/>
							<!-- ConformanceNist -->
							<exclude name="Miscellaneous/Script/**/*"/>
							<!-- Savage Defense -->
							<exclude name="qrcode/**/*.*"/>
						</javac>
						<echo message="now run and validate the java model"/>
						<echo message="java -classpath ${java.classes.dir};${x3djsail.stylesheets.dir}/${jsai.full.archive.jar.name};${saxon.dir}/${saxon.jar} ${archive.name}.${relative.path1}.${name.short}"/>
						<java    classname="${archive.name}.${relative.path1}.${relative.path2}.${name.short}"
								 classpath="${java.classes.dir};${saxon.dir}/${saxon.jar};${x3djsail.stylesheets.dir}/${jsai.full.archive.jar.name}"
							   failonerror="false"/>
                     </sequential>
                 </outofdate>
             </sequential>
         </for>
         <antcall target="echo.timestamp"/>
         <echo>processScenes.java complete.</echo>
		<antcall target="processScenes.javadoc"/>
     </target>

This uses a Saxon9 macro which is also in there:

     <!-- excerpted/adapted from "SAXON XSLT Processing with Ant" by James Fuller, http://ablog.apress.com/?p=753 -->
     <!-- http://www.saxonica.com/documentation9.0/using-xsl/commandline.html                                     -->
     <macrodef name="Saxon9" description="Invoke XSLT transformation on passed scene using passed stylesheet">
         <attribute name="scene"/>
         <attribute name="stylesheet"/>
         <attribute name="suffix" default=""/>
         <attribute name="extension"/>
         <attribute name="compiled"/>
		<!-- http://www.saxonica.com/html/documentation/configuration/config-features.html -->
         <attribute name="expand" default="off"/> <!-- http://saxon.sf.net/feature/expandAttributeDefaults -->
         <!-- parameterPair1 must have a legal value or saxon fails mysteriously while running under jenkins! java.lang.StringIndexOutOfBoundsException: String index out of range: 0 -->
         <attribute name="parameterPair1" default=""/>
         <attribute name="parameterPair2" default=""/>
         <attribute name="parameterPair3" default=""/>
         <sequential>
             <!--
             <echo message="Saxon9 processing @{scene}@{suffix}.@{extension} using @{stylesheet}, compiled=@{compiled}, parameterPair0=@{parameterPair0}, parameterPair1=@{parameterPair1}"/>
             -->
             <if>
                 <equals arg1="@{compiled}" arg2="true" />
                 <then>
                     <java classname="net.sf.saxon.Transform"
                           classpath="${saxon.dir}/${saxon.jar};${resolver.dir}/resolver.jar"
                           fork="${fork}"
                           failonerror="false">
                         <!-- TODO
                         <jvmarg value="-Dxml.catalog.files=C:/www.web3d.org/specifications/OasisXmlCatalogX3D.xml"/>
                         <jvmarg value="-Dxml.catalog.verbosity=4"/>
                         use the Apache commons resolver for XML Catalog resolution of online DTD, schema addresses
                         http://sourceforge.net/apps/mediawiki/saxon/index.php?title=XML_Catalogs
                         "How to use a catalog file:  Using catalogs with Saxon"
                         http://www.sagehill.net/docbookxsl/UseCatalog.html
                         download resolver.jar from http://www.apache.org/dist/xerces/xml-commons (formerly http://xml.apache.org/commons/dist)
                         unzip package and install resolver.jar into classpath above,
                         must also have CatalogManager.properties in CLASSPATH
                         <arg value="-r:org.apache.xml.resolver.tools.CatalogResolver"/>
                         <arg value="-x:org.apache.xml.resolver.tools.ResolvingXMLReader"/>
                         <arg value="-y:org.apache.xml.resolver.tools.ResolvingXMLReader"/>
                         <arg value="-u"/> -->  <!-- source file name is resolved to a JAXP Source object -->
                         <!-- <arg value="-t"/> timing information -->
                         <!-- <arg value="-T"/> trace (voluminous) -->
                         <arg value="-warnings:recover"/> <!-- recover after writing a warning message -->
                         <arg value="-s:@{scene}.x3d"/>                  <!--  input file -->
                         <arg value="-o:@{scene}@{suffix}.@{extension}"/><!-- output file -->
                         <arg value="-c:@{stylesheet}.sxx"/>  <!-- compiled stylesheet -->
                         <arg value="-dtd:off"/>              <!-- suppress creation of default DTD values, only use values in document -->
                         <arg value="-expand:@{expand}"/>     <!-- whether to expand (i.e. add) DTD default values (on|off) -->
                         <arg value="@{parameterPair1}"/>     <!-- parameter=value passed to stylesheet -->
                         <arg value="@{parameterPair2}"/>
                         <arg value="@{parameterPair3}"/>
                     </java>
                 </then>
                 <else> <!-- not compiled -->
                     <java classname="net.sf.saxon.Transform"
                           classpath="${saxon.dir}/${saxon.jar};${resolver.dir}/resolver.jar"
                           fork="${fork}"
                           failonerror="false">
                         <!-- TODO
                         <jvmarg value="-Dxml.catalog.files=C:/www.web3d.org/specifications/OasisXmlCatalogX3D.xml"/>
                         <jvmarg value="-Dxml.catalog.verbosity=4"/>
                         use the Apache commons resolver for XML Catalog resolution of online DTD, schema addresses
                         http://sourceforge.net/apps/mediawiki/saxon/index.php?title=XML_Catalogs
                         "How to use a catalog file:  Using catalogs with Saxon"
                         http://www.sagehill.net/docbookxsl/UseCatalog.html
                         download resolver.jar from http://www.apache.org/dist/xerces/xml-commons (formerly http://xml.apache.org/commons/dist)
                         unzip package and install resolver.jar into classpath above,
                         must also have CatalogManager.properties in CLASSPATH
                         <arg value="-r:org.apache.xml.resolver.tools.CatalogResolver"/>
                         <arg value="-x:org.apache.xml.resolver.tools.ResolvingXMLReader"/>
                         <arg value="-y:org.apache.xml.resolver.tools.ResolvingXMLReader"/> -->
                         <!-- <arg value="-t"/> timing information -->
                         <!-- <arg value="-T"/> trace (voluminous) -->
                         <arg value="-warnings:recover"/> <!-- recover after writing a warning message -->
                         <arg value="-s:@{scene}.x3d"/>
                         <arg value="-o:@{scene}@{suffix}.@{extension}"/>
                         <arg value="-xsl:@{stylesheet}.xslt"/>  <!-- regular stylesheet -->
                         <arg value="-dtd:off"/>                 <!-- suppress creation of default DTD values, only use values in document -->
                         <arg value="-expand:@{expand}"/>        <!-- whether to expand (i.e. add) DTD default values (on|off) -->
                         <arg value="@{parameterPair1}"/>        <!-- parameter=value passed to stylesheet -->
                         <arg value="@{parameterPair2}"/>
                         <arg value="@{parameterPair3}"/>
                     </java>
                 </else>
             </if>
         </sequential>
     </macrodef>

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170419/e0d4b16a/attachment-0001.html>


More information about the x3d-public mailing list