I am going to convert an Ant script to a Make file. I have finished lot of conversion part of it. But that ant script has small code like below,
<xslt
in=""
out=""
style="../profiling/profile.xsl">
<param name="profile.arch" expression="${profile.arch}" if="profile.arch"/>
<param name="profile.audience" expression="${profile.audience}" if="profile.audience"/>
</xslt>
How should I write above "xslt", "in", "out", "style", and "param name" parts of ant script in my Make file? Can any one give me a sample Make file code for it?
I tried and searched about that conversion so many times, but I couldn't find it.
Thank you..!!
Make doesn't have an XSLT transformation program built in. When converting the xslt ant task one must chose which program to substitute.
ANT has Xalan built in. The java jars would need to be first installed. Here is how you could download them from Maven Central:
curl -O http://search.maven.org/remotecontent?filepath=xalan/xalan/2.7.1/xalan-2.7.1.jar
curl -O http://search.maven.org/remotecontent?filepath=xalan/serializer/2.7.1/serializer-2.7.1.jar
Running the following java program would perform the desired XSLT transformation:
java -cp xalan-2.7.1.jar:serializer-2.7.1.jar org.apache.xalan.xslt.Process \
-IN inputData.xml \
-XSL ../profiling/profile.xsl \
-OUT outputFile.html \
-PARAM profile.arch ??? \
-PARAM profile.audience ???
See Xalan documentation for more information.
Related
Trying to run xalan to do docbook stylesheets, get the following:
(Location of error unknown)XSLT Error (java.lang.NoClassDefFoundError): org/apache/xml/serializer/SerializerTrace
Here is the shell script, Lx.sh
!/bin/sh
export X=/home/leffstudent/docbook-xsl-1.79.1/tools/lib/
export CLASSPATH=$X/xmlresolver.jar:$X/xalan.jar:$X/xercesImpl.jar:$X/xml-apis.jar:/home/leffstudent/docbook-xsl-1.79.1/extensions/xalan27.jar:/home/leffstudent/xsl2/xsl/tools/lib/xalan/serializer.jar
java -Djava.endorsed.dirs=$X org.apache.xalan.xslt.Process -out $1.fo -in $1 -xsl stO.xsl -param use.extensions 1 -param default.table.width auto -param title.margin.left 0pc param insert.xref.page.number yes -param xref.with.number.and.title 0
When I run the script, I get the following error messages
Lx.sh test1.xml
Invalid option: param
Invalid option: insert.xref.page.number
Invalid option: yes
(Location of error unknown)XSLT Error (java.lang.NoClassDefFoundError): org/apache/xml/serializer/SerializerTrace
Exception in thread "main" java.lang.RuntimeException: org/apache/xml/serializer/SerializerTrace
at org.apache.xalan.xslt.Process.doExit(Process.java:1155)
at org.apache.xalan.xslt.Process.main(Process.java:1128)
I followed the instructions on page 25 to 26 of
the wonderful book:
DocBook XSL: The Complete Guide: Second Edition: Sagehill Enterprises
On page 22, that listed three needed jar files:
xalan.jar, xml-apis.jar, xercesImpl.jar
When that did not work and I got the above error message, I added
serializer.jar That did not help.
Note: I originally used saxon to do the conversion of docbook xml
to XSL-FO. Someone suggested I try one of the other processors.
That is question number 55908387
Thus, I tried Xalan and have the above problem.
Following the accepted answer to Running phpunit tests using HHVM (HipHop), I attempted to run some tests:
unit-tests/ [develop] > hhvm $(which phpunit) --colors -c phpunit.xml --testsuite all .
/usr/bin/env php -d allow_url_fopen=On -d detect_unicode=Off /usr/local/Cellar/phpunit/4.3.4/libexec/phpunit-4.3.4.phar $*
It appears that this is a command to run the tests (which it does), but I'm confused about
why it's printing this command instead of just running the tests
whether executing that command even uses HHVM, since it starts with /usr/bin/env php...
Does anyone have any insight into this? Thanks so much!
What happened here is that you installed PHPUnit using homebrew, so it created a wrapper script for the actual PHAR file. That wrapper script is a Bash script that runs the PHPUnit PHAR and that script is what you're trying to get HHVM to run. Since it's not a PHP or Hack script, the Bash script is outputted directly.
Instead, you probably want to try to execute $(brew --prefix phpunit)/libexec/phpunit*.phar
e.g.: hhvm $(brew --prefix phpunit)/libexec/phpunit*.phar --colors -c phpunit.xml --testsuite all .
The wildcard is so that you don't need to specify the version of PHPUnit being using.
I am trying to migrate from Java 7 to Java 8 for an existing system , which implements Jax-ws 2.0. The build and deployment process is uses Ant task (apt, wsgen, wsimport) to generates wsdl and libraries from java annotated service end point interface and from generated WSDL prepares client libraries. Which works as expected until Java – 7. But when I tried to use jdk-8 for building, got problem in using jax-ws libraries and above mentioned ant task. I have upgraded the JAX-WS lib to JAX-WS RI – 2.2.8 and JAX-WS 2.2.10 , which did work until WSDL and schema generation using ant task wsgen, but Still I am unable to resolve the generation of client libraries from generated WSDL using wsimport. I am getting following error
javax.xml.validation.SchemaFactoryConfigurationError: Provider for class javax.xml.validation.SchemaFactory cannot be created
My wsgen and wsimport scripts are as below :
<taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen">
<classpath refid="project.classpath"/>
</taskdef>
<wsgen resourcedestdir="${smruti.wsdl.dir}"
sei="com.smruti.webservice.SmrutiWebService"
keep="true"
sourcedestdir="${smruti.wsdl.dir}\src"
destdir="${build.dir}"
genwsdl="true">
<classpath>
<path refid="project.classpath"/>
<pathelement location="${build.dir}"/>
</classpath>
</wsgen>
<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath refid="project.classpath" />
</taskdef>
<wsimport sourcedestdir="${generated.dir}/src" destdir="${build.dir}" wsdl="${wsdl.location}" keep="true" extension="true" package="com.smruti.webservice.client"/>
Note : I am using jdk 8 , ant- 1.9.4 , jax-ws ri - 2.2.10 libs.
As a work around I am able to solve the above problem by using jdk provided wsimport.exe instead of ant task. Below is the script for the same ..
<exec executable="C:\Program Files\Java\jdk1.8.0_40\bin\wsimport.exe">
<arg line="${wsdl.location} -s ${generated.dir}/src -p com.smruti.webservice.client -d ${build.dir} -extension -keep -Xdebug -verbose" />
</exec>
But, Still not able to use wsimport as an ant task with java 8 and jax-ws-2.2.10.
I try to pack some map files for our geoserver in an internal rpm package. For the build part, this is just to copy the files. I think this works as expected. But it takes terribly long to pack those 20GB of images.
I've read that rpm internally compresses the data and that this can be done with several different compression algorithms. But, I don't have a clue which compression my rpm chooses and how I can influence this. I could not find any options for the rpmbuild command, nor for the specfile nor for the general rpm options I can list with rpmbuild --showrc
I´m not very experienced with rpmbuild and specfiles, but after reading lots of man pages and tutorials on rpm.org I have no further ideas.
The specfile I use looks like:
%define debug_package %{nil}
%global mapsversion 0.9
# If this is a snapshot, put the date here and uncomment
#global snapshot_version 20100519
# This is the version in a form acceptable
# an an RPM version string (i.e. no '-')
# Hier werden die Makros definiert.
%global rpmversion %(echo %{mapsversion} | tr '-' '_')
%global pkgversion %{mapsversion}%{?snapshot_version:-SNAPSHOT}
%global pkgname %{name}
Name: geoserver-maps-part2
Version: %{rpmversion}
Release: 1%{?dist}
Summary: Swiss Maps for GeoServer
Group: Application/ourApp
License: Copyright (c) 2011
URL: http://doc.polyalert.local
#Source0: %{name}-%{version}.tgz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: geoserver
%define mapshome /opt/geoserver/swisstopo
%define mapssource /home/user/polyalert_env/geoserver/swisstopo
%description
Swiss Maps for GeoServer
%prep
%build
/bin/true
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{mapshome}
cp -a %{mapssource}/pk100 $RPM_BUILD_ROOT%{mapshome}
%clean
rm -rf $RPM_BUILD_ROOT
%pre
%post
%preun
%files
%{mapshome}/pk100
%changelog
* Tue Feb 14 2012 user - 1.0
- First version of specfile
I call rpmbuild like this:
rpmbuild -bb --define "_topdir $TOP_DIR" --define "_gpg_name ourkey" --define "_signature gpg" --sign $TOP_DIR/SPECS/$SPEC_FILE_NAME $RPM_BUILD_PARAMETER
Any suggestions?
I was working with some RPM stuff today and accidentally stumbled upon the answer for ya!
Put these in your spec file:
%define _source_payload w0.gzdio
%define _binary_payload w0.gzdio
That will still use gzip but pass it -0 for a level, which should just store. On my RPM, it made it grow from 21MB to 76MB, so I'm pretty sure this is your answer!
BTW, I found that in one of the macro files - you can also do bzdio and any number from 0 to 9 to use bzip2. This was on RHEL4; later versions of RPM seem to support more compression options; but again, for what you want, the above should be what you need.
Please check the file /usr/lib/rpm/macros in your build machine, (the file maybe diff in path), it has a total support list of compression methods there: e.g.:
329 # Compression type and level for source/binary package payloads.
330 # "w9.gzdio" gzip level 9 (default).
331 # "w9.bzdio" bzip2 level 9.
332 # "w7.xzdio" xz level 7, xz's default.
333 # "w7.lzdio" lzma-alone level 7, lzma's default
334 #
335 #%_source_payload w9.gzdio
336 #%_binary_payload w9.gzdio
so here just as Aaron said, you can set it here for universal, or set specifically for your proj. spec.
I have used "%define _binary_payload w9.xzdio" on RHEL 6.6. As I understand, the default compression tool used in RHEL 6 is xz, but the default compression level appears to be 2, even though 7 is supposed to be xz's default. I kicked it up to 9 and some giant RPMs went from 653MB to 439MB. I was able to save a total of 1 gigabyte over the default compression.
I ran into the same issue with Ant building a runnable Jar RPM with Spring Boot Loader complaining of this:
Caused by: java.lang.IllegalStateException: Unable to open nested entry 'BOOT-INF/lib/accessors-smart-1.2.jar'. It has been compressed and nested jar files must be stored without compression. Please check the mechanism used to create your executable jar file
My ant build task was like this:
<exec executable="rpmbuild" failonerror="true">
<env key="version" value="${fullversion}" />
<arg value="-ba" />
<arg value="--clean" />
<arg value="${specfile}" />
</exec>
My solution to build an RPM with a runnable JAR was to disable the repacking, setting the macro definitions on the spec file did not do it for me.
Adding this to the spec file was what worked for me:
#Disable jar unpacking
%define __jar_repack 0
Reference:
https://bugzilla.redhat.com/show_bug.cgi?id=219731
Thanks to the previous posters for helping to focus in on the issue too.
Erion
I'm having difficulty getting XQuery to work. I downloaded Saxon-HE 9.2. It seems to only want to work with XSLT.
When I type:
java -jar saxon9he.jar
I get back usage information for XSLT. When I use the command syntax for XQuery, it doesn't recognize the parameters (like -q), and gives XSLT usage information.
Here are some command line interactions:
>java -jar saxon9he.jar
No source file name
Saxon-HE 9.2.0.6J from Saxonica
Usage: see http://www.saxonica.com/documentation/using-xsl/commandline.html
Options:
-a Use xml-stylesheet PI, not -xsl argument
-c:filename Use compiled stylesheet from file
-config:filename Use configuration file
-cr:classname Use collection URI resolver class
-dtd:on|off Validate using DTD
-expand:on|off Expand defaults defined in schema/DTD
-explain[:filename] Display compiled expression tree
-ext:on|off Allow|Disallow external Java functions
-im:modename Initial mode
-ief:class;class;... List of integrated extension functions
-it:template Initial template
-l:on|off Line numbering for source document
-m:classname Use message receiver class
-now:dateTime Set currentDateTime
-o:filename Output file or directory
-opt:0..10 Set optimization level (0=none, 10=max)
-or:classname Use OutputURIResolver class
-outval:recover|fatal Handling of validation errors on result document
-p:on|off Recognize URI query parameters
-r:classname Use URIResolver class
-repeat:N Repeat N times for performance measurement
-s:filename Initial source document
-sa Use schema-aware processing
-strip:all|none|ignorable Strip whitespace text nodes
-t Display version and timing information
-T[:classname] Use TraceListener class
-TJ Trace calls to external Java functions
-tree:tiny|linked Select tree model
-traceout:file|#null Destination for fn:trace() output
-u Names are URLs not filenames
-val:strict|lax Validate using schema
-versionmsg:on|off Warn when using XSLT 1.0 stylesheet
-warnings:silent|recover|fatal Handling of recoverable errors
-x:classname Use specified SAX parser for source file
-xi:on|off Expand XInclude on all documents
-xmlversion:1.0|1.1 Version of XML to be handled
-xsd:file;file.. Additional schema documents to be loaded
-xsdversion:1.0|1.1 Version of XML Schema to be used
-xsiloc:on|off Take note of xsi:schemaLocation
-xsl:filename Stylesheet file
-y:classname Use specified SAX parser for stylesheet
--feature:value Set configuration feature (see FeatureKeys)
-? Display this message
param=value Set stylesheet string parameter
+param=filename Set stylesheet document parameter
?param=expression Set stylesheet parameter using XPath
!option=value Set serialization option
>java -jar saxon9he.jar -q:"..\w3xQueryTut.xq"
Unknown option -q:..\w3xQueryTut.xq
Saxon-HE 9.2.0.6J from Saxonica
Usage: see http://www.saxonica.com/documentation/using-xsl/commandline.html
Options:
-a Use xml-stylesheet PI, not -xsl argument
// etc...
>java net.sf.saxon.Query -q:"..\w3xQueryTut.xq"
Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/saxon/Query
Caused by: java.lang.ClassNotFoundException: net.sf.saxon.Query
// etc...
Could not find the main class: net.sf.saxon.Query. Program will exit.
I'm probably making some stupid mistake. Do you know what it could be?
UPDATE 1 This command does not work:
>java -jar saxon9he.jar net.sf.saxon.Query q:"..\w3xQueryTut.xq"
Source file net.sf.saxon.Query does not exist
UPDATE 2 This command works better:
>dir
03/28/2010 16:07 <DIR> .
03/28/2010 16:07 <DIR> ..
03/27/2010 13:37 849 books.xml
03/27/2010 13:32 <DIR> doc
03/27/2010 13:32 <DIR> notices
03/27/2010 13:32 5,473,874 saxon9he.jar
03/27/2010 13:38 37 w3xQueryTut.xq
>java -cp saxon9he.jar net.sf.saxon.Query q:"w3xQueryTut.xq"
java.io.FileNotFoundException: q:w3xQueryTut.xq (The system cannot find the path
specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at net.sf.saxon.Query.compileQuery(Query.java:885)
at net.sf.saxon.Query.doQuery(Query.java:183)
at net.sf.saxon.Query.main(Query.java:89)
Fatal error during query: java.io.FileNotFoundException: q:w3xQueryTut.xq (The s
ystem cannot find the path specified)
w3xQueryTut.xq:
doc("books.xml")/bookstore/book/title
books.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
When you use "java -jar saxon9he.jar", you are asking Java to invoke the default entry point in the JAR file, which is net.sf.saxon.Transform. To enter at a specific entry point, for example net.sf.saxon.Query, you need to use the form "java -cp saxon9he.jar net.sf.saxon.Query".
I don't have problems with this command-line usage:
java -cp C:\xml\Parsers\Saxon\HE-9-2-0-6\saxon9he.jar net.sf.saxon.Query
-q:"C:\Program Files\Oxygen XML Editor 11\samples\xquery\Books\authors.xquery"
pre-preparations
Download the Saxon:
first you should download the Saxon package at http://sourceforge.net/projects/saxon/ and unzip it at some directory like D:\Program Files\SaxonHE9-5-0-1J.
Get Source code:
If your want the source code, download it at http://nchc.dl.sourceforge.net/project/saxon/Saxon-HE/9.3/saxon-resources9-3.zip before you unzip it into the SaxonHE9-5-0-1J dir;
Build Workstation:
prepare the workstation for you to exercise: it's at SaxonHE9-5-0-1J\iexercise where you can put your *.xq files and its results; you can also make a directory named icache to hold your caches;
Let Java know where to find the interpreter:
To make it work well for Xquery statements, your should add the core package to interpret it to the windows environment: open the command line and change to SaxonHE9-5-0-1J and run after you copy the saxon9he.jar into jdk1.7.0\lib:
set classpath=.;%java_home%\lib\saxon9he.jar
Test if it's known:
So normally you can run the xquery scripts now after Step 4 run right. If you're not sure of it still, chech it with: java net.sf.saxon.Query
2.Prepare your first launch
Make a file(for example, named test.xq) with affix .xq, .xquery or .xqy in iexercise, its content is displayed below:
doc(“catalog.xml”)/catalog/product[#dept = “ACC”]
Copy the pre-done file catalog.xml into . /.
Run java net.sf.saxon.Query -q:test.xq -o:result.xml
the first arguement indicates the interpreter to compile xquery file, which is your labor in Step 1.4, -q:filename is the file that will be compiled with the xquery statements, and the third shows where to put the result; if not specified, is will be dispalyed at the standard output.
The catalog file:
<catalog>
<product dept="WMN">
<number>557</number>
<name language="en">Fleece Pullover</name>
<colorChoices>navy black</colorChoices>
</product>
<product dept="ACC">
<number>563</number>
<name language="en">Floppy Sun Hat</name>
</product>
<product dept="ACC">
<number>433</number>
<name language="en">Deluxe Travel Bag</name>
</product>
<product dept="MEN">
<number>784</number>
<name language="en">Cotton Dress Shirt</name>
<colorChoices>white green</colorChoices>
<desc>Our <i>favorite</i> shirt!</desc>
</product>
</catalog>
Note that the documentation on saxonica does not say
java -jar saxon9he.jar net.sf.saxon.Query -q:myQuery.xql
(it isn't an executable jar file and you don't need -q at all if the xql file is the last option)
so the following will work
java net.sf.saxon.Query myQuery.xql
or
java -cp C:\downloads\saxon\saxon9he.jar net.sf.saxon.Query myQuery.xql