I'm using MorganaXProc-IIIse (XPROC 3.0) to execute the following code:
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
<p:output port="result"/>
<p:xslt name="xml-author_list">
<p:with-input port="source">
<p:document href="content.xml"/>
</p:with-input>
<p:with-input port="stylesheet">
<p:document href="test.xsl"/>
</p:with-input>
</p:xslt>
</p:declare-step>
However, I get the following error message:
Check your configuration: Cannot initialize XSLTConnector with 'com.xml_project.morganaxproc3.saxon10connector.Saxon10XSLTConnector'.
<c:errors xmlns:c="http://www.w3.org/ns/xproc-step">
<c:error code="err:XC0038"
name="xml-author_list"
type="p:xslt"
href="file:///Users/bob/Dev/Workspace/IdeaProjects/test/test/test.xpl"
line="4"
column="36"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:err="http://www.w3.org/ns/xproc-error">
<message>Requested XSLT version '3.0' is not supported by choosen XSLTConnector or XSLTConnector configuration error.</message>
</c:error>
</c:errors>
So I tried change the XSLTConnector to Saxon10. The Saxon10Connector is already in the lib directory of Morgana. Here is my config.xml:
<morgana-config xmlns="http://www.xml-project.com/morganaxproc">
<path_to_iso_skeleton_schematron_1>ISO_SKELETON_SCHEMATRON_1</path_to_iso_skeleton_schematron_1>
<path_to_iso_skeleton_schematron_2>ISO_SKELETON_SCHEMATRON_2</path_to_iso_skeleton_schematron_2>
<path_to_SchXSLT_1>schxslt-1.4.5-sources/xslt/1.0</path_to_SchXSLT_1>
<path_to_SchXSLT_2>schxslt-1.4.5-sources/xslt/2.0</path_to_SchXSLT_2>
<XSLTValidationMode>STRICT</XSLTValidationMode>
<xslt-connector>Saxon10</xslt-connector>
</morgana-config>
And then I execute:
sh Morgana.sh /Users/bob/Dev/Workspace/IdeaProjects/test/test/test.xpl -xslt-connector=saxon10 -xquery-connector=saxon10 -indent-errors -debug
But the error still occurs. I cannot find any information about which XSLTConnector supports XSL-Stylesheet Version 3.0
Any hint is highly appreciated.
If you read the documentation it says:
The current search order for a Saxon implementation is saxon9ee.jar,
saxon9pe.jar, saxon9he.jar, saxon-ee-10.0.jar, saxon-pe-10.0.jar,
saxon-he-10.0.jar, saxon-ee-10.1.jar, saxon-pe-10.1.jar and
saxon-he-10.1.jar. MorganaXProc-IIIse will use the first Saxon version
found by this search order.
But since the recommended Saxon Version for Saxon 10 is Saxon 10.3:
Recommened to be used with Saxon 10.3
one can assume that it will work with 10.3 as well as with any new release.
However, with 10.3 and 10.6 I still got the same error. I assumed maybe there is a Saxon 9.x Version in the lib folder and therefore selecting the wrong version due to the search order. But that wasn't the case.
When I added 10.0 like mentioned in the search order, it works.
Related
I am using net 4.8 framework. and cake version 0.38.2.
During build in Teamcity, it has to install addins cake.npm, cake.filehelpers. But following error happens
Could not find any assemblies compatible with .NETFramework,Version=v4.6.1.
Error: Failed to install addin 'Cake.Npm'.
When I use cake.npm version as 0.17.0 for cake 0.38.2, it generates two folders - cake.npm and cake.npm0.17.0. Only cake npm0.17.0 is required, because it has netstandard2.0 which can make build successful. But the other folder makes it fail
As discussed in https://github.com/cake-contrib/Cake.Npm/issues/140 Cake.Npm is not the culprit, here.
There is an additional (#load) reference in the project to Cake.Sitecore in version 1.0.3 which in contents/scripts/tasks.restore.cake contains the line
#addin "Cake.Npm"
This - without an explicit version being set - will always default to the newest version (currently 2.0.0, which is incompatible with Cake 0.38.2).
The current version of Cake.Sitecore (1.0.27) has that problem fixed.
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.
I got below exception while running xunit test projects which works under VS 2017 15.3
[2017/12/4 23:08:40 Error] [xUnit.net 00:00:00.0033291] xxx.Test: Catastrophic failure: System.TypeInitializationException: The type initializer for 'Xunit.DiaSession' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.TypeExtensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at Xunit.DiaSession..cctor()
--- End of inner exception stack trace ---
at Xunit.DiaSession..ctor(String assemblyFileName)
at Xunit.DiaSessionWrapper..ctor(String assemblyFilename)
at Xunit.XunitFrontController..ctor(AppDomainSupport appDomainSupport, String assemblyFileName, String configFileName, Boolean shadowCopy, String shadowCopyFolder, ISourceInformationProvider sourceInformationProvider, IMessageSink diagnosticMessageSink)
at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.RunTestsInAssembly(IRunContext runContext, IFrameworkHandle frameworkHandle, LoggerHelper logger, IMessageSinkWithTypes reporterMessageHandler, AssemblyRunInfo runInfo)
My current VS 2017 version is 15.4.5.
I have tried the work around which has been provided previously, but none did not work. And I have try to downgrade my VS 2016 to 15.3, but I could not find the 15.3 package to install. I have tried to install xunit to latest version.
Any help would be appreciated.
Update:
Project Type:xUnit Test Project(.NET Core)
Target: net 461
It seems VS 2017 fail to load specific "xunit.runner.visualstudio", after checking VS2017 15.4.2 - Unable to run tests for projects targeting .NET Framework 4.6.x #1542 again, I deleted the "%TEMP%\VisualStudioTestExplorerExtensions", create a new Xunit project, change the nonworked.csproj xunit.runner.visualstudio from 2.2.0 to 2.3.1, it works now. Not sure why it did not work when I try it previous.
Hope it will help others.
You need to install System.Reflection.TypeExtensions using VS Package Manager using the following command:
Install-Package System.Reflection.TypeExtensions -Version 4.5.1
for more information please review the following link
System.Reflection.TypeExtensions
I am using Transformer.transformer for applying xsl to the xml
When i use the following namespace it is not detected.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
Starting
ERROR: 'The input document is not a stylesheet (the XSL namespace is not declared in the root element).'
FATAL ERROR: 'Could not compile stylesheet'
When i use the following namespace it is not detectedbut unable to compile completely as it is unable to detect few elements.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
ERROR: 'line 864: Unsupported XSL element 'eval'.'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
The namespace http://www.w3.org/TR/WD-xsl refers to a working draft that existed before XSLT 1.0 became a recommendation in 1999. Only old versions of Microsoft's MSXML support it on Windows, the last being MSXML 3.0. Don't expect to have support for that in the Java world. I don't think there is a direct way to use a stylesheet written for MSXML in the Java world, you would need to check which features outside of XSLT 1.0 it uses and check whether an XSLT 1.0 (like Saxon 6.5 or Xalan 2.7) processor supports it with the help of extensions or whether you can use an XSLT 2.0 or 3.0 processor like Saxon 9.5 that supports a similar feature as a new part in XSLT 2.0 or 3.0 or at least as an extension.
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