Sync from SUSE:SLFO:Main saxon10 revision eab80bc3724de1520ae16e19dd8dbad3

This commit is contained in:
Adrian Schröter 2024-05-04 00:28:41 +02:00
commit 69c2ccad67
14 changed files with 2989 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

119
Saxon-HE-10.9.pom Normal file
View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>10.9</version>
<name>Saxon-HE</name>
<description>The XSLT and XQuery Processor</description>
<url>http://www.saxonica.com/</url>
<inceptionYear>1999</inceptionYear>
<organization>
<name>Saxonica</name>
<url>https://www.saxonica.com/</url>
</organization>
<licenses>
<license>
<name>Mozilla Public License Version 2.0</name>
<url>http://www.mozilla.org/MPL/2.0/</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>mike</id>
<name>Michael Kay</name>
<email>mike@saxonica.com</email>
</developer>
<developer>
<id>ond1</id>
<name>ONeil Delpratt</name>
<email>oneil@saxonica.com</email>
</developer>
<developer>
<id>debbie</id>
<name>Debbie Lockett</name>
<email>debbie@saxonica.com</email>
</developer>
<developer>
<id>john</id>
<name>John Lumley</name>
<email>john@saxonica.com</email>
</developer>
<developer>
<id>norm</id>
<name>Norman Walsh</name>
<email>norm@saxonica.com</email>
</developer>
</developers>
<scm>
<connection>scm:git:https://saxonica.plan.io/projects/saxonmirrorhe/repository</connection>
<developerConnection>scm:git:https://saxonica.plan.io/projects/saxonmirrorhe/repository</developerConnection>
<url>https://saxonica.plan.io/projects/saxonmirrorhe/repository</url>
</scm>
<properties>
<skipTests>false</skipTests>
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss</maven.build.timestamp.format>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.javadoc.skip>true</maven.javadoc.skip>
<maven.javadoc.failOnError>false</maven.javadoc.failOnError>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.6.1</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.3.5</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>59.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>2.14.6</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom</artifactId>
<version>1.2.15</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-dom</artifactId>
<version>1.2.15</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.15</version>
<optional>true</optional>
</dependency>
</dependencies>
</project>

BIN
saxon-resources-10-cleaned.zip (Stored with Git LFS) Normal file

Binary file not shown.

BIN
saxon10-9source.zip (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
#!/bin/sh
SAXON_VERSION=10
wget https://github.com/Saxonica/Saxon-HE/raw/main/${SAXON_VERSION}/resources/saxon-resources-${SAXON_VERSION}.zip -O saxon-resources-${SAXON_VERSION}-cleaned.zip
# Remove script.js and search.js from doc/javadoc/ directory
zip -d saxon-resources-${SAXON_VERSION}-cleaned.zip doc/javadoc/script.js doc/javadoc/search.js

127
saxon10.build.xml Normal file
View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- simple generic build file -->
<project name="saxon" default="all" basedir=".">
<!-- Properties -->
<property name="name" value="saxon"/>
<property name="src" value="src"/>
<property name="build" value="build"/>
<property name="build.classes" value="${build}/classes"/>
<property name="build.doc" value="${build}/api"/>
<property name="build.lib" value="${build}/lib"/>
<property name="j2se.javadoc" value="/usr/share/javadoc/j2se"/>
<property name="jdom.javadoc" value="/usr/share/javadoc/jdom"/>
<property name="fop.javadoc" value="/usr/share/javadoc/fop"/>
<property name="dom4j.javadoc" value="/usr/share/javadoc/dom4j"/>
<!-- Targets -->
<!-- Prepare build directories -->
<target name="prepare">
<mkdir dir="${src}"/>
<mkdir dir="${build}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.lib}"/>
<mkdir dir="${build.doc}"/>
<copy todir="${src}">
<fileset dir="." includes="com/**,org/**,net/**"/>
</copy>
</target>
<!-- Kill all the created directories -->
<target name="clean">
<delete dir="${build}"/>
<delete dir="${src}"/>
</target>
<!-- Build classes -->
<target name="classes" depends="prepare">
<javac
srcdir="${src}"
excludes="net/sf/saxon/option/axiom/**/*.java"
destdir="${build.classes}"
encoding="ISO-8859-1"
includeantruntime="true"
source="8"
target="8"
/>
</target>
<!-- Copy resources -->
<target name="resources">
<copy todir="${build.classes}">
<fileset dir="${src}" includes="net/sf/saxon/data/**"/>
</copy>
</target>
<!-- Build jar archives -->
<target name="jar" depends="classes,resources">
<jar
jarfile="${build.lib}/${name}.jar"
basedir="${build.classes}"
>
<manifest>
<attribute name="Main-Class" value="net.sf.saxon.Transform"/>
</manifest>
<service
type="javax.xml.transform.TransformerFactory"
provider="net.sf.saxon.TransformerFactoryImpl"
/>
</jar>
</target>
<!-- Build the full JavaDocs -->
<target name="javadoc" depends="prepare">
<condition property="no.module.directories" value="--no-module-directories" else="">
<and>
<javaversion atleast="9"/>
<javaversion atmost="12"/>
</and>
</condition>
<javadoc
sourcepath="${src}"
destdir="${build.doc}"
windowtitle="${name} JavaDoc"
package="true"
author="true"
version="true"
excludepackagenames="net.sf.saxon.option.axiom.*"
source="1.8"
encoding="ISO-8859-1"
docencoding="UTF-8"
bottom="Copyright (c) 2004—2020 Saxonica Limited. All rights reserved."
doctitle="Saxon 10 Java API Documentation"
additionalparam="${no.module.directories}"
>
<group title="s9api Interface" packages="net.sf.saxon.s9api"/>
<group title="Other Interfaces">
<!-- packagenames="net.sf.saxon.*,org.w3c.xsl.*" -->
<package name="net.sf.saxon"/>
<package name="net.sf.saxon.lib"/>
<package name="net.sf.saxon.om"/>
<package name="net.sf.saxon.query"/>
<package name="net.sf.saxon.sxpath"/>
<package name="net.sf.saxon.value"/>
<package name="net.sf.saxon.type"/>
<package name="net.sf.saxon.xpath"/>
<package name="net.sf.saxon.xqj"/>
<package name="com.saxonica.config"/>
<package name="com.saxonica.jaxp"/>
<package name="com.saxonica.schema"/>
</group>
<group title="External Interfaces">
<package name="javax.xml.xquery"/>
</group>
<link href="${j2se.javadoc}"/>
<link href="${jdom.javadoc}"/>
<link href="${fop.javadoc}"/>
<link href="${dom4j.javadoc}"/>
</javadoc>
</target>
<!-- Build everything -->
<target name="all" depends="jar,javadoc"/>
</project>

213
saxon10.changes Normal file
View File

@ -0,0 +1,213 @@
-------------------------------------------------------------------
Wed Sep 27 12:20:49 UTC 2023 - Gus Kenion <gkenion@suse.com>
- Remove nonfree code from javadoc.
-------------------------------------------------------------------
Sun Mar 5 20:50:09 UTC 2023 - Anton Shvetz <shvetz.anton@gmail.com>
- Update to v10.9
* For a full list of bugs cleared in Saxon 10.9, please go to
https://saxonica.plan.io/projects/saxon/issues and filter the
list of bugs for those labelled as "Fixed in Maintenance
Release 10.9".
-------------------------------------------------------------------
Fri May 6 18:44:40 UTC 2022 - Anton Shvetz <shvetz.anton@gmail.com>
- Update to v10.8
* For a full list of bugs cleared in Saxon 10.8, please go to
https://saxonica.plan.io/projects/saxon/issues and filter the
list of bugs for those labelled as "Fixed in Maintenance
Release 10.8".
* For a full list of bugs cleared in Saxon 10.7, please go to
https://saxonica.plan.io/projects/saxon/issues and filter the
list of bugs for those labelled as "Fixed in Maintenance
Release 10.7".
- The gizmo script renamed to gizmo10 to avoid conflict with future
saxon11.
- Add some markup to POD documentation; adjust references to online
documentation.
- Remove the _service file.
-------------------------------------------------------------------
Wed Mar 23 11:20:05 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Build with java source and target levels 8
-------------------------------------------------------------------
Mon Jan 17 20:58:41 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Add the 10.6 version to compatibility versions for maven
metadata
-------------------------------------------------------------------
Sat Sep 18 02:51:03 UTC 2021 - Anton Shvetz <shvetz.anton@gmail.com>
- Update to v10.6
* Bug #4759: Saxon.NET: InvalidCastException in
sun.net.ftp.impl.FtpClient (Missing IKVM DLL from build)
* Bug #4837: Two documents can have the same URI
* Feature #4860: Format of numbers generated by fn:xml-to-json
* Bug #4875: Testing option -unfolded is not working
* Bug #4968: Saxon-EE 10.5: Bug #3800 reproduced
* Bug #4969: Invalid schema-aware SEF (Invalid alpha code)
* Bug #4970: line/column number in trace listener
* Bug #4971: Deleting an entry from NamespaceMap can cause
IndexOutOfBoundsException
* Bug #4973: Schema for XML namespace is being fetched using HTTP
rather than using the local copy
* Bug #4974: XQuery Update: namespace propagation is not working
* Bug #4975: Null pointer exception when outputting a warning
with missing location information
* Bug #4981: saxon:in-summer-time extension function: can it
return empty sequence?
* Bug #4982: Loading xml schemas which are stored inside
a zip archive is very slow compared to Xerces
* Bug #4985: NullPointerException in Saxon-EE
* Bug #4987: NPE when references to static XSLT parameters
appear in non-static expressions
* Bug #4995: Schema validator throws exception if there are
IDREFs with no corresponding ID
* Bug #4996: Namespace information missing from default
XML Schema attribute added by validating XMLReader
* Bug #5000: LoopLifter NPE after updating to Saxon 10.5 EE
* Bug #5004: Incorrect update of namespace maps
* Bug #5005: XdmNode.Children(uri, localname) not returning
results (.NET)
* Bug #5006: Streamed shallow copy changes type annotation
from xs:untyped to xs:anyType
* Bug #5007: Streaming of fn:subsequence#2
* Feature #5012: Support UTF-16LE and UTF-16BE in
bin:encode-string() and bin-decode-string()
* Bug #5013: saxon:capture doesn't copy accumulator
* Bug #5014: NullPointerException with use of capturing
accumulator in match pattern
* Bug #5015: `fn:uri-collection()` calls the CollectionFinder
associated with the Configuration, not the Controller
* Bug #5018: suppress-indentation should prevent word-wrapping
of HTML and XHTML output
* Bug #5023: In a streamed transformation using
distinct-values(), the xs:double value NaN
and the xs:float value NaN are considered distinct
* Bug #5026: ClassCastException:
net.sf.saxon.functions.ScalarSystemFunction$1 cannot be cast
to net.sf.saxon.expr.Literal
* Bug #5032: Saxon-HE 10.5N NuGet Package cannot simply be used
to replace binaries
* Bug #5035: SXST0067 Component cannot be streamed, although
it is guaranteed streamable according to W3C rules.
No watch implemented for locVarRef
* Bug #5044: Java reflexive calls, NullPointerException when
argument is null
* Bug #5045: HTML5 serialisation: DOCTYPE should not be output
unless the outermost element is HTML
* Bug #5047: Whitespace stripping in DocumentBuilder ignores
xml:space
* Bug #5048: Wrong result from map:merge() where one operand
is a saxon:range-key
* Bug #5049: Collation keys for alphanumeric collations are not
correctly ordered
* Bug #5054: Internal error optimising an inline function
that calls its containing named function
* Bug #5060: Overzealous type checking for lookup operator
* Bug #5061: Empty values in text constructors: data(text { ... })
* Bug #5063: Repository information at
https://www.saxonica.com/documentation10/index.html#!about/support/patches
is out of date
* Bug #5064: Lookup expression `X?(<a>1</a>)` fails to parse
* Bug #5065: xml-to-json() fails to report invalid input
* Bug #5068: saxon:assign doesn't check that the value is of
the required type
* Bug #5069: Signatures of fold-left/fold-right are incorrectly
documented
* Bug #5071: saxon:decimal-divide()
* Bug #5075: Namespace Inherit Issue on XMLStreamWriter on
Saxon 10
* Bug #5076: ClassCastException with match="$var" when the value
of $var is atomic
* Bug #5080: In .NET, the IEnumerable returned by Children
and by Steps can only be used once
* Bug #5084: Schema processing: invalid attribute reported twice
* Bug #5085: Function annotations not reported for anonymous
functions
* Bug #5086: saxon:evaluate() fails with NullPointerException
after importing from SEF
* Bug #5087: Poor diagnostics when stylesheet is not exportable
* Bug #5088: xsl:for-each with Saxon extension attribute
separator - failure on export/import
* Bug #5089: Test case deep-update-011 fails with export:on
* Bug #5090: xsl:source-document extension attributes lost
on package export/import
* Bug #5091: Tests that optimize a filter expression to use
a key fail after export/import
* Bug #5092: "java.lang.AssertionError: **** Component reference
mode xsl:unnamed is already bound" when using mode #all
and COMPILE_WITH_TRACING == true
* Bug #5093: AssertionError during trace code injection
* Bug #5094: Caching of last() at context level is not working
- Use spec-cleaner
- Set mode="localonly" in the _service file
-------------------------------------------------------------------
Fri Apr 16 17:42:29 UTC 2021 - Anton Shvetz <shvetz.anton@gmail.com>
- Update to v10.5
-------------------------------------------------------------------
Wed Nov 18 00:30:27 UTC 2020 - Anton Shvetz <tz@sectorb.msk.ru>
- Specify Maven compat version as 10 to avoid conflict with saxon9.
-------------------------------------------------------------------
Tue Nov 17 22:55:26 UTC 2020 - Anton Shvetz <tz@sectorb.msk.ru>
- Installation locations for Maven artifacts were mistakenly
accounted twice.
-------------------------------------------------------------------
Tue Nov 17 22:16:56 UTC 2020 - Anton Shvetz <tz@sectorb.msk.ru>
- Code samples were packaged twice: in "demo" and "manual"
subpackages. Now they are located in the demo subpackage.
- Files from "demo" subpackage are moved to default documentation
directory.
-------------------------------------------------------------------
Sat Oct 31 20:33:34 UTC 2020 - Anton Shvetz <tz@sectorb.msk.ru>
- Specify net.sf.saxon.TransformerFactoryImpl as a service
provider for javax.xml.transform.TransformerFactory
- Package manual source files
-------------------------------------------------------------------
Thu Oct 29 08:09:31 UTC 2020 - Anton Shvetz <tz@sectorb.msk.ru>
- Update to v10.3
- Add the gizmo script.
- Update obsolete and incomplete manual pages.
Sources for manual pages now provided as POD files.
- Remove unnecessary dependencies.
- Cleanup the spec file.
- Remove unneeded patch.
- Update package description.
-------------------------------------------------------------------
Thu Sep 24 22:10:56 UTC 2020 - Anton Shvetz <tz@sectorb.msk.ru>
- Package forgotten resources under net/sf/saxon/data/ into JAR file
-------------------------------------------------------------------
Wed Aug 26 13:54:41 UTC 2020 - Anton Shvetz <tz@sectorb.msk.ru>
- Update to v10.2
-------------------------------------------------------------------
Thu May 14 19:05:58 UTC 2020 - Anton Shvetz <tz@sectorb.msk.ru>
- Update to v10.1
-------------------------------------------------------------------
Wed Apr 1 20:29:35 UTC 2020 - Anton Shvetz <tz@sectorb.msk.ru>
- Initial commit with v10.0

753
saxon10.gizmo.pod Normal file
View File

@ -0,0 +1,753 @@
=encoding utf8
=head1 NAME
gizmo - Saxon command-line interactive or batch-mode utility
=head1 SYNOPSIS
gizmo [I<options>]
=head1 DESCRIPTION
Saxon (from 10.0) provides the Gizmo command line utility, which can be used
interactively or in batch mode, to perform simple operations such as examining
the content of a document, renaming or deletion of selected elements in the
document, or performing simple XSLT transformation and XSD validation.
The utility can be started from the command line using the Java entry-point
class C<net.sf.saxon.Gizmo>, and its actions are controlled by sub-commands
entered one per line, either on the standard input, or in a file named in the
B<-q> option.
=head1 OPTIONS
=over
=item B<-s>:I<source.xml>
Defines the source document supplied as the input to the pipeline of
sub-commands. If omitted, input is taken from standard input.
=item B<-q>:I<script.txt>
Identifies a filename containing sub-commands to be executed, one per line. By
default, sub-commands are taken from standard input.
=back
=head1 COMMANDS
Each line of input is a sub-command. The various sub-commands are listed in the
following sections.
At any point in the processing, there is (or is not) a current document. On
entry, the current document is the source document identified in the -s option,
if specified. Many of the sub-commands change the current document. The current
document may be inspected using the show sub-command, and may be saved to
filestore using the save sub-command.
Most of the sub-commands select nodes within the current document using an
XPath expression. If unprefixed element names appear within the expression,
they match nodes in the source document by local-name alone. (That is, I<X>
means C<*:>I<X>). If you only want to select no-namespace names, use the form
C<Q{}>I<X>.
Within XPath expressions, content completion is available for (a) recognized
XPath keywords such as “C<following-sibling>”, and (b) the names of elements
and attributes appearing in the current source document when it was first
loaded.
Some of the sub-commands also have a second argument which is a query.
Generally this will be an XQuery element constructor such as
C<E<lt>aE<gt>Title: {string(.)}E<lt>a/E<gt>>. It is evaluated with the context
item set to each item selected by the first expression, in turn.
=over
=item B<copy> I<expression>
Deletes everything other than the nodes selected by the expression; returns a
new document containing only the selected nodes. Note that if the expression
selects multiple elements, the new document will not be a well-formed XML
document (it will be a "fragment").
The result of the operation can be inspected using the command B<show>.
Example
The command:
copy //img
returns a document containing as its children copies of all the img elements in
the source.
=item B<call> {I<filename>}
Executes the script contained in the specified file.
The script shares the context with the calling script. It has access to the
variables and namespaces declared in the calling script, and any variables and
namespaces that it declared are available to the caller on return.
=item B<delete> I<expression>
The selected nodes (elements, attributes, or namespaces) are deleted, along
with their children and descendants.
The result of the operation can be inspected using the command B<show>.
Example
Given a source document:
<cities>
<city name="Berlin" country="DE"/>
<city name="Paris" country="FR"/>
<city name="Rome" country="IT"/>
</cities>
The command:
delete //city[@name='Rome']
produces the document:
<cities>
<city name="Berlin" country="DE"/>
<city name="Paris" country="FR"/>
</cities>
=item B<follow> I<expression> B<with> I<query>
After each node I<N> selected by the expression, the query is evaluated (with
I<N> as the context item), and its result is inserted as an immediate following
sibling of I<N>. Both the expression and the query must return nodes that are
capable of having siblings: that is, element, text, comment, or processing
instruction nodes. But if the query returns an atomic value, it is treated as a
text node with the same string value.
The result of the operation can be inspected using the command B<show>.
Examples
The command:
follow //img with <caption/>
inserts an empty CE<lt>caption/E<gt>> element after every img element in the
document.
Given a source document:
<cities>
<city name="Berlin" country="DE"/>
<city name="Paris" country="FR"/>
<city name="Rome" country="IT"/>
</cities>
The command:
follow //city[@name='Paris'] with <city name="Lyon" country="{@country}"/>
produces the document:
<cities>
<city name="Berlin" country="DE"/>
<city name="Paris" country="FR"/>
<city name="Lyon" country="FR"/>
<city name="Rome" country="IT"/>
</cities>
=item B<help> I<keyword>
If the I<keyword> is the name of a command, a brief summary of the syntax and
purpose of the command is displayed.
If the I<keyword> is omitted, a list of available commands is displayed.
=item B<list> I<expression>
Outputs a representation of the result of the expression.
If a node is selected, it is shown as a path (for example
C<DOC/SECTION[3]/PARA[2]>), preceded by a line number if one is available.
If an atomic value is selected, its string value is displayed.
Line numbers are available in documents loaded directly from filestore, but not
in documents constructed using commands such as B<rename> or B<delete>.
Example
Given a source document:
<cities>
<city name="Berlin" country="DE"/>
<city name="Paris" country="FR"/>
<city name="Rome" country="IT"/>
</cities>
The command:
list //city[@name='Paris']
displays:
Line 3: /cities/city[2]
=item B<load> I<filename>
The current document is discarded, and a new current document is loaded from
the specified file.
If the filename is relative, it is taken as being relative to the current
working directory.
The users home directory can be referred to as C<~>.
Content completion is available: use the tab key to suggest possible names at
each level.
=item B<namespace> {I<prefix>} {I<uri>}
Binds a namespace prefix to a URI. QNames using this prefix may be used in
subsequent XPath expressions within the script.
Note that the conventional prefixes C<xml>, C<xsl>, C<saxon>, C<xs>, C<xsi>,
C<fn>, C<math>, C<map>, and array are already bound to the conventional
namespace URIs.
In path expressions, unprefixed names match by local name only, so it is
usually possible to select elements without binding a namespace prefix.
=item B<paths>
Outputs a list of the distinct element paths that exist in the current source
document. They are output in order of first appearance, when scanning the tree
in document order.
This command is useful to get an overview of the structure of the source
document, especially if it is too large to display comfortably.
Example
For example, given the F<books.xml> data file included with the Saxon resources
download, the output would be:
Found 16 items
/BOOKLIST
/BOOKLIST/BOOKS
/BOOKLIST/BOOKS/ITEM
/BOOKLIST/BOOKS/ITEM/TITLE
/BOOKLIST/BOOKS/ITEM/AUTHOR
/BOOKLIST/BOOKS/ITEM/PUBLISHER
/BOOKLIST/BOOKS/ITEM/PUB-DATE
/BOOKLIST/BOOKS/ITEM/LANGUAGE
/BOOKLIST/BOOKS/ITEM/PRICE
/BOOKLIST/BOOKS/ITEM/QUANTITY
/BOOKLIST/BOOKS/ITEM/ISBN
/BOOKLIST/BOOKS/ITEM/PAGES
/BOOKLIST/BOOKS/ITEM/DIMENSIONS
/BOOKLIST/BOOKS/ITEM/WEIGHT
/BOOKLIST/CATEGORIES
/BOOKLIST/CATEGORIES/CATEGORY
=item B<precede> I<expression> B<with> I<query>
Before each node C<N> selected by the expression, the query is evaluated (with
I<N> as the context item), and its result is inserted as an immediate preceding
sibling of I<N>. Both the expression and the query must return nodes that are
capable of having siblings: that is, element, text, comment, or processing
instruction nodes. But if the query returns an atomic value, it is treated as a
text node with the same string value.
The result of the operation can be inspected using the command B<show>.
Examples
The command:
precede //img with <caption/>
inserts an empty C<E<lt>caption/E<gt>> element before every C<img> element in
the document.
Given a source document:
<cities>
<city name="Berlin" country="DE"/>
<city name="Munich" country="DE"/>
<city name="Paris" country="FR"/>
<city name="Lyon" country="FR"/>
<city name="Rome" country="IT"/>
</cities>
The command:
precede //city[not(@country=preceding-sibling::*[1]/@country)] with <country name="{@country}"/>
produces the document:
<cities>
<country name="DE"/>
<city name="Berlin" country="DE"/>
<city name="Munich" country="DE"/>
<country name="FR"/>
<city name="Paris" country="FR"/>
<city name="Lyon" country="FR"/>
<country name="IT"/>
<city name="Rome" country="IT"/>
</cities>
=item B<prefix> I<expression> B<with> I<query>
For every node I<N> selected by the expression, the query is evaluated (with
I<N> as the context item), and its result is inserted as the first child of
I<N>. The expression must return nodes that are capable of having children
(that is document or element nodes). The query must return nodes that are
capable of having siblings (that is, element, text, comment, or processing
instruction nodes). But if the query returns an atomic value, it is treated as
a text node with the same string value.
As a special case, if the query returns an attribute node, it is added as an
attribute of the selected element, replacing any existing attribute with the
same name.
The result of the operation can be inspected using the command B<show>.
Examples
The command:
prefix //section with <head>{data(@title)}</head>
copies the value of the title attribute of every C<section> element into a new
C<head> element appearing as the first child of the C<section>.
Given a source document:
<cities>
<city name="Berlin" country="DE"/>
<city name="Munich" country="DE"/>
<city name="Paris" country="FR"/>
<city name="Lyon" country="FR"/>
<city name="Rome" country="IT"/>
</cities>
The command:
prefix //city with <country name="{@country}"/>
produces the document:
<cities>
<city name="Berlin" country="DE">
<country name="DE"/>
</city>
<city name="Munich" country="DE">
<country name="DE"/>
</city>
<city name="Paris" country="FR">
<country name="FR"/>
</city>
<city name="Lyon" country="FR">
<country name="FR"/>
</city>
<city name="Rome" country="IT">
<country name="FR"/>
</city>
</cities>
With the same document, the command:
prefix //city with attribute{'id'}{count(preceding-sibling::*)+1}
produces:
<cities>
<city name="Berlin" country="DE" id="1"/>
<city name="Munich" country="DE" id="2"/>
<city name="Paris" country="FR" id="3"/>
<city name="Lyon" country="FR" id="4"/>
<city name="Rome" country="IT" id="5"/>
</cities>
=item B<quit> [B<now>]
Quits the application.
If “B<now>” is specified, the command exits immediately. Otherwise, if the
current document has been modified since it was read from filestore, the
command prompts the user asking whether the document should first be saved.
(See the B<save> command).
=item B<rename> I<expression> B<as> I<expression>
Nodes (elements or attributes) selected by the first I<expression> are renamed;
the new name is given by computing the expression in the second argument.
The second I<expression> is evaluated with the existing node as the context
item. If the result of the expression is a string, then this string is used as
the new name of the node (if it contains a prefix, this must first be declared
using the B<namespace> command). If the result of the expression is a QName,
then it defines the expanded name of the new element or attribute in its
entirety. New namespace declarations will be added to the output document if
required; existing namespace declarations are not removed, unless new bindings
are defined for existing prefixes.
Examples
rename //NOTE as "COMMENT"
renames all NOTE elements as COMMENT elements.
rename //@* as lower-case(name())
renames all attributes by converting the existing name to lower-case.
=item B<replace> I<expression> B<with> I<query>
The nodes (elements or attributes) selected by the given I<expression> are
replaced by the result of evaluating the I<query>.
Note that it is the entire node that is replaced, not just its content. To
replace the content of an element or attribute node, rather than replacing the
entire node, use the command B<update>.
The result of the operation can be inspected using the command B<show>.
Examples
Given a source document:
<cities>
<city name="Berlin" country="DE"/>
<city name="Munich" country="DE"/>
<city name="Paris" country="FR"/>
<city name="Lyon" country="FR"/>
<city name="Rome" country="IT"/>
</cities>
The command:
replace //city[@country="DE"] with <stadt @Name="{@name}"/>
produces the document:
<cities>
<stadt Name="Berlin"/>
<stadt Name="Munich"/>
<city name="Paris" country="FR"/>
<city name="Lyon" country="FR"/>
<city name="Rome" country="IT"/>
</cities>
Given a source document:
<cities>
<city><name>Berlin</name><country>DE</country></city>
<city><name>Munich</name><country>DE</country></city>
<city><name>Paris</name><country>FR</country></city>
<city><name>Lyon</name><country>FR</country></city>
<city><name>Rome</name><country>IT</country></city>
</cities>
The command:
replace //city/name[.="Munich"]/text() with "München"
produces the document:
<cities>
<city><name>Berlin</name><country>DE</country></city>
<city><name>München</name><country>DE</country></city>
<city><name>Paris</name><country>FR</country></city>
<city><name>Lyon</name><country>FR</country></city>
<city><name>Rome</name><country>IT</country></city>
</cities>
With the same source document, the command:
replace //name with {.}
produces the document:
<cities>
<city><cityName><name>Berlin</name></cityName><country>DE</country></city>
<city><cityName><name>Munich</name></cityName><country>DE</country></city>
<city><cityName><name>Paris</name></cityName><country>FR</country></city>
<city><cityName><name>Lyon</name></cityName><country>FR</country></city>
<city><cityName><name>Rome</name></cityName><country>IT</country></city>
</cities>
Note that in this expression, C<{.}> follows the XQuery rules rather than the
XSLT rules: it copies the whole element, rather than extract its string value.
=item B<save> I<filename> [I<output-param>=I<value>]…
Saves the current document to filestore, with the serialization parameters
specified.
If the file already exists, Gizmo asks “C<Overwrite existing file? (Y|N)>” and
proceeds only if the answer is “C<Y>” or “C<y>”.
If the I<filename> is relative, it is taken as being relative to the current
working directory.
The users home directory can be referred to as C<~>.
Content completion is available: use the tab key to suggest possible names at
each level.
Examples
The command:
save updated-data.xml method=xml indent=yes
saves the document to filestore using the XML output method with indentation.
=item B<schema> I<filename>
Requires Saxon-EE
Loads an XSD schema from the specified location.
The I<filename> is handled in the same way as the B<load> command.
The schema definitions are available for use in validate commands issued
subsequently in the session. The command is additive; the schema components are
added to the collection of schema components that are already loaded, which
means an error will be reported if the definitions conflict. It is not possible
to unload schema definitions once loaded, except by closing the session and
starting a new one.
=item B<set> I<name> = I<expression> | B<set . => I<expression>
The first form binds a variable to the value of the expression. The variable
name may be written as a simple NCName, or as a lexical QName, or as an EQName
in C<Q{>I<uri>B<}>I<local> format; it may also be preceded by a “C<$>” sign
(which is ignored).
The variable may be used in XPath expressions and queries appearing later in
the script.
The second form: B<set . => I<expression> may be used to set the current
document. In this case the expression must evaluate to a single document node.
For example:
set . = doc('books.xml')
achieves the same effect as:
load books.xml
Note that all updating commands (such as delete, rename etc.) create a new copy
of the current document. Variables that were set before the updating command
continue to reference the document in the state it was in before the update.
To display the value of a variable, use the B<show> or B<list> commands.
=item B<show> [I<expression>]
Outputs a representation of the result of the I<expression>.
If a node is selected, it is shown as an XML serialization of the content of
the node.
If an atomic value is selected, its string value is displayed.
The expression may be omitted, and defaults to C</>, which displays the current
document.
The document is always shown with indentation enabled, so it is not necessarily
the same as the document that will be written to filestore by the B<save> command.
Examples
show
Displays the current document, with indentation.
show //TITLE
Displays selected elements, for example:
<title>Pride and Prejudice</title>
<title>Sense and Sensibility</title>
<title>Emma</title>
<title>Northanger Abbey</title>
show count(//TITLE), sort(//TITLE)
Displays the result of an arbitrary XPath expression.
=item B<strip>
The effect is the same as:
delete //text()[not(normalize-space())]
That is, all text nodes consisting entirely of whitespace are removed from the
document.
=item B<suffix> I<expression> B<with> I<query>
For every node I<N> selected by the expression, the query is evaluated (with
I<N> as the context item), and its result is inserted as the last child of
I<N>. The expression must return nodes that are capable of having children
(that is document or element nodes). The query must return nodes that are
capable of having siblings (that is, element, text, comment, or processing
instruction nodes). But if the query returns an atomic value, it is treated as
a text node with the same string value.
Example
The command:
suffix //page with <copyright>Copyright (c) Saxonica 2020</page>
injects a copyright element at the end of every page.
=item B<transform> I<filename>
Transforms the current document using the XSLT stylesheet contained in the
specified file.
The I<filename> is handled in the same way as the B<load> command.
On completion, the result of the transformation becomes the new current
document.
Note: it is not currently possible to specify parameters to the transformation.
=item B<undo>
Reverts the most recent changes.
The current document is returned to the state it was in before the most recent
B<copy>, B<delete>, B<follow>, B<load>, B<precede>, B<prefix>, B<rename>,
B<replace>, B<strip>, B<suffix>, B<transform>, B<update>, or B<validate>
command.
It will also undo the effect of:
set . = expression
that is, it reverts to the previous current document.
It is not possible to undo the effect of B<save> or B<schema> commands.
=item B<update> I<expression> B<with> I<query>
The content of the nodes selected by the given expression is replaced by the
result of evaluating the query:
=over
=item ·
When an element or document node is selected, the existing children are
deleted, and replaced with the result of the expression.
=item ·
When the selected element is a node kind that cannot have children, for example
a comment, text node, or attribute, then its content is replaced with the
string value of the query result.
=back
Examples
Given the source document:
<cities>
<city name="Berlin" country="DE"/>
<city name="Munich" country="DE"/>
<city name="Paris" country="FR"/>
<city name="Lyon" country="FR"/>
<city name="Rome" country="IT"/>
</cities>
The command:
update //@country[.='IT'] with "ITALIA"
produces:
<cities>
<city name="Berlin" country="DE"/>
<city name="Munich" country="DE"/>
<city name="Paris" country="FR"/>
<city name="Lyon" country="FR"/>
<city name="Rome" country="ITALIA"/>
</cities>
Given a source document:
<cities>
<city><name>Berlin</name><country>DE</country></city>
<city><name>Munich</name><country>DE</country></city>
<city><name>Paris</name><country>FR</country></city>
<city><name>Lyon</name><country>FR</country></city>
<city><name>Rome</name><country>IT</country></city>
</cities>
The command:
update //city/name[.="Munich"] with "München"
produces the document:
<cities>
<city><name>Berlin</name><country>DE</country></city>
<city><name>München</name><country>DE</country></city>
<city><name>Paris</name><country>FR</country></city>
<city><name>Lyon</name><country>FR</country></city>
<city><name>Rome</name><country>IT</country></city>
</cities>
With the same source document, the command:
update //@country with lower-case(.)
produces:
<cities>
<city><name>Berlin</name><country>de</country></city>
<city><name>Munich</name><country>de</country></city>
<city><name>Paris</name><country>fr</country></city>
<city><name>Lyon</name><country>fr</country></city>
<city><name>Rome</name><country>it</country></city>
</cities>
=item B<validate>
Requires Saxon-EE
Validates the current document using the XSD schema(s) previously loaded using
the B<schema> command, supplemented with any schema found via an
C<xsi:schemaLocation> or C<xsi:noNamespaceSchemaLocation> attribute in the
source document.
On completion, the validated result (complete with type annotations) becomes
the new current document. Any expressions and queries executed against a typed
document are treated as schema-aware.
If validation fails, the validation error messages are output, and the current
document remains unchanged.
=back
=head1 SEE ALSO
L<https://www.saxonica.com/documentation10/index.html>, L<saxon10(1)>,
L<saxon10q(1)>, L<xsltproc(1)>.
=head1 AUTHOR
Michael H. Kay E<lt>L<mike@saxonica.com>E<gt>

28
saxon10.gizmo.script Normal file
View File

@ -0,0 +1,28 @@
#!/bin/sh
#
# gizmo10 script
# JPackage Project <http://www.jpackage.org/>
. /usr/share/java-utils/java-functions
MAIN_CLASS=net.sf.saxon.Gizmo
BASE_JARS="saxon10 xml-commons-apis jaxp_parser_impl jline"
# Optional jars
CLASSPATH="$CLASSPATH:"$(build-classpath \
icu4j \
jdom \
jdom2 \
xml-commons-resolver \
xom \
2>/dev/null) || :
# Set parameters
set_jvm
set_classpath $BASE_JARS
set_flags $BASE_FLAGS
set_options $BASE_OPTIONS
# Let's start
run $args "$@"

757
saxon10.saxon.pod Normal file
View File

@ -0,0 +1,757 @@
=encoding utf8
=head1 NAME
saxon10 - Saxon XSLT 3.0 processor
=head1 SYNOPSIS
saxon10 [I<options>] [I<params>]
=head1 DESCRIPTION
An XSLT processor, which can be used from the command line, or invoked from an
application, using a supplied API. Saxon implements the XSLT 3.0
Recommendation. The product can also be used to run XSLT 2.0 stylesheets, or
XSLT 1.0 stylesheets in backwards compatibility mode.
=head1 OPTIONS
=over
=item B<-a>[:(C<on>|C<off>)]
Use the xml-stylesheet processing instruction in the source document to
identify the stylesheet to be used. The stylesheet argument must not be present
on the command line. For more details see L<Using the B<-a>
option|https://www.saxonica.com/documentation10/index.html#!using-xsl/commandline/aoption>.
=item B<-catalog>:I<filenames>
I<filenames> is either a file name or a list of file names separated by
semicolons; the files are OASIS XML catalogs used to define how public
identifiers and system identifiers (URIs) used in a source document,
stylesheet, or schema are to be redirected, typically to resources available
locally. For more details see L<Using XML
Catalogs|https://www.saxonica.com/documentation10/index.html#!sourcedocs/xml-catalogs>.
=item B<-config>:I<filename>
Indicates that configuration information should be taken from the supplied
L<configuration
file|https://www.saxonica.com/documentation10/index.html#!configuration/configuration-file>.
Any options supplied on the command line override options specified in the
configuration file.
=item B<-dtd>:(C<on>|C<off>|C<recover>)
Setting B<-dtd>:C<on> requests DTD-based validation of the source file and of
any files read using the C<document()> function. Requires an XML parser that
supports validation. The setting B<-dtd>:C<off> (which is the default)
suppresses DTD validation. The setting B<-dtd>:C<recover> performs DTD
validation but treats the error as non-fatal if it fails. Note that any
external DTD is likely to be read even if not used for validation, because DTDs
can contain definitions of entities.
=item B<-ea>:(C<on>|C<off>)
Setting B<-ea>:C<on> enables assertions both at compile time and at run time.
Assertions (defined using the XSLT 3.0 C<xsl:assert> instruction) are disabled
by default at compile time, and enabled by default at run-time provided they
were enabled at compile time.
=item B<-expand>:(C<on>|C<off>)
Normally, if validation using a DTD or schema is requested, any fixed or
default values defined in the DTD or schema will be expanded. Specifying
B<-expand>:C<off> suppresses this. (In the case of DTD-defined defaults, this
might not work with all XML parsers. It does work with the Xerces parser
(default for Java) and the Microsoft parser (default for .NET).)
=item B<-explain>[:I<filename>]
Display an execution plan and other diagnostic information for the stylesheet.
This is a representation of the expression tree after rewriting by the
optimizer. It combines the XSLT instructions and the XPath expressions into a
single tree. If no file name is specified the output is sent to the standard
error stream. The output is in XML format.
=item B<-export>:I<filename>
Export the compiled stylesheet, in a form suitable for subsequent execution.
For more details, see L<Compiling a
Stylesheet|https://www.saxonica.com/documentation10/index.html#!using-xsl/compiling>.
=item B<-ext>:(C<on>|C<off>)
If B<-ext>:C<off> is specified, suppress calls on dynamically-loaded external
Java functions. This does not affect calls on integrated extension functions,
including Saxon and EXSLT extension functions. This option is useful when
loading an untrusted stylesheet, perhaps from a remote site using an C<http://>
URL; it ensures that the stylesheet cannot call arbitrary Java methods and
thereby gain privileged access to resources on your machine.
=item B<-im>:I<modename>
Selects the initial mode for the transformation. If this is namespaced, it can
be written as {I<uri>}I<localname>.
=item B<-init>:I<initializer>
The value is the name of a user-supplied class that implements the interface
C<Initializer>; this initializer will be called during the initialization
process, and may be used to set any options required on the C<Configuration>
programmatically.
=item B<-it>[:I<template-name>]
Selects the initial named template to be executed. If this is namespaced, it
can be written as {uri}localname. If the template name is omitted, the default
is C<xsl:initial-template>. When this option is used, you do not need to supply
a source file, but if you do, you must supply it using the B<-s> option.
=item B<-jit>:(C<on>|C<off>)
Determines whether just-in-time compilation of template rules is in force. The
default is on, unless the nogo or explain option is set. When JIT is enabled,
the body of a template rule is not compiled until the rule first fires. This
gives faster compilation when a stylesheet has been written to handle a large
XML vocabulary, but the source document only uses a fraction of the vocabulary.
The drawback is that static errors in the stylesheet may go undetected.
=item B<-l>[:(C<on>|C<off>)]
If B<-l> or B<-l>:C<on> is specified, causes line and column numbers to be
maintained for source documents. These are accessible using the extension
functions C<saxon:line-number()> and C<saxon:column-number()>. Line numbers are
useful when the purpose of the stylesheet is to find errors or anomalies in the
source XML file. Without this option, line numbers are available while source
documents are being parsed and validated, but they are not retained in the tree
representation of the document.
=item B<-lib>:I<filenames>
A list of filenames containing library packages. The filenames are separated by
“C<;>” on Windows systems, or “C<:>” on Linux and Mac. Each filename must
identify either (a) a top-level module in a source XSLT package, or (b) a SEF
file containing an exported library package. There is no constraint on the
order of the packages.
=item B<-license>:(C<on>|C<off>)
Relevant only when SaxonJ-PE or SaxonJ-EE software is loaded. By default, Saxon
will look for a license and report a warning if none is found, which escalates
to a fatal error if licenseable features (such as schema-awareness) are used.
If B<-license>:C<off> is specified, Saxon will not look for a license unless it
is needed, and will fall back silently if none is found (this means that the
transformation might succeed, but without taking advantage of Saxon-EE
optimizations). The option B<-license>:C<off> is useful to suppress warnings in
the case where it is known that a compiled stylesheet containing an embedded
license key is being executed.
=item B<-m>:I<classname>
Use the specified C<Receiver> to process the output from C<xsl:message>. The
class must implement the C<Receiver> interface, and it must have a public
zero-argument constructor. This interface is similar to a SAX ContentHandler,
it takes a stream of events to generate output. In general the content of a
message is an XML fragment. By default the standard XML emitter is used,
configured to write to the standard error stream, and to include no XML
declaration.
Each message is output as a new document. The sequence of calls to this
Receiver is as follows: there is a single C<open()> call at the start of the
transformation, and a single C<close()> call at the end; and each evaluation of
an C<xsl:message> instruction starts with a C<startDocument()> call and ends
with C<endDocument()>. The C<startDocument()> event has a properties argument
indicating whether C<terminate="yes"> was specified, and the locationId on
calls such as C<startElement()> and C<characters()> can be used to identify the
location in the stylesheet where the message data originated (this is achieved
by passing the supplied C<locationId> in a call to
C<getPipelineConfiguration().getLocator().getSystemId(locationId)>, or to
C<getLineNumber()> on the same object).
Select the class C<MessageWarner> to have C<xsl:message> output notified to the
JAXP ErrorListener, as described in the JAXP documentation.
=item B<-nogo>
If set, the stylesheet is analysed for errors, and any requested B<-explain> or
B<-export> output is generated, but the stylesheet is not executed.
=item B<-now>:I<yyyy-mm-ddThh:mm:ss+hh:mm>
Sets the value of C<current-dateTime()> (and C<implicit-timezone()>) for the
transformation. This is designed for testing, to enable repeatable results to
be obtained for comparison with reference results, or to test that stylesheets
can handle significant dates and times such as end-of-year processing.
=item B<-ns>:(C<uri>|C<##any>|C<##html5>)
Defines the handling of unprefixed element names appearing as name tests in
path expressions and match patterns in the stylesheet.
=over
=item ·
Supplying a URI sets the default namespace for elements and types (effectively
a default value for C<xpath-default-namespace> — note that an explicit value
for this attribute takes precedence).
=item ·
The value C<##any> declares that unprefixed names are treated as a test on the
local name of the element only: they will match regardless of namespace.
=item ·
The value C<##html5> declares that an unprefixed element name will match either
a name in the XHTML namespace, or a name in no namespace. This option is
intended primarily for use when generating stylesheets to run under Saxon-JS in
the browser, since the resulting behavior is close to that defined by the
special rules in the HTML5 specification for XSLT and XPath running against an
HTML5 DOM.
=back
=item B<-o>:I<filename>
Send output to named file.
If the source (B<-s>) argument identifies a directory, this option is mandatory
and must also identify a directory; on completion it will contain one output
file for each file in the source directory.
In other cases, this option has two effects: it defines the file where the
principal output of the transformation will be written, and it defines the base
URI used for resolving the value of the C<xsl:result-document/@href> attribute
when secondary result documents are written.
In the absence of this option, (a) the principal output is written to the
standard output stream, and (b) secondary output file locations are resolved
relative to the current working directory.
Output files are created if they do not already exist; any necessary
directories will also be created. If a file does already exist, it is generally
overwritten, though this will not necessarily happen if the transformation
fails.
=item B<-opt>:[C<->]I<flags>
Allows individual optimizations to be enabled or disabled selectively. There is
a set of single-letter flags identifying particular optimizations:
=over
=item C<c>:
generate bytecode
=item C<d>:
detect void path expressions
=item C<e>:
cache regular expressions
=item C<f>:
inline functions
=item C<g>:
extract global variables
=item C<j>:
just-in-time compilation of template rules
=item C<k>:
create keys
=item C<l>:
loop lifting
=item C<m>:
miscellaneous
=item C<n>:
constant folding
=item C<r>:
template rule-sets
=item C<s>:
extract common subexpressions
=item C<t>:
tail call optimization
=item C<v>:
inline variables
=item C<w>:
create switch statements
=item C<x>:
index predicates
=back
A value such as B<-opt>:C<gs> runs with only the selected optimizations;
B<-opt>:C<-gs> runs with the selected optimizations disabled and all others
enabled. The value B<-opt>:C<0> suppresses all optimizations. The default is
full optimization; this feature allows optimization to be suppressed in cases
where reducing compile time is important, or where optimization gets in the way
of debugging, or causes extension functions with side-effects to behave
unpredictably. (Note however, that even with no optimization, lazy evaluation
may still cause the evaluation order to be not as expected.) Disabling
optimizations may in some cases prevent streamed evaluation. For example, some
expressions only become streamable because the optimizer is able to work out
that sorting nodes into document order is unnecessary. Most of these flags
enable optimizations that cause extra work at compile time to improve run-time
performance. The C<j> option is an exception: enabling this option shifts work
from compile time to run time.
=item B<-or>:I<classname>
Use the specified C<OutputURIResolver> to process output URIs appearing in the
href attribute of C<xsl:result-document>. The C<OutputURIResolver> is a
user-defined class that implements the C<net.sf.saxon.lib.OutputURIResolver>
interface.
=item B<-outval>:(C<recover>|C<fatal>)
Normally, if validation of result documents is requested, a validation error is
fatal. Setting the option B<-outval>:C<recover> causes such validation failures
to be treated as warnings. The validation message is written both to the
standard error stream, and (where possible) as a comment in the result document
itself.
This option does not by itself cause result documents to be validated; that
happens only as a consequence of the type or validation attribute on an
C<xsl:result-document> instruction. The only effect of the option is to
determine what happens when validation fails.
Validating result documents can be very useful while debugging a stylesheet,
because it provides instant feedback when the output is incorrect. However, it
can sometimes be frustrating during development when you know that parts of the
code have not yet been written. The option B<-outval>:C<recover> is designed to
give you the best of both worlds: it tells you that the output is wrong, but
still enables you to see the complete result document that your code is
producing.
=item B<-p>[:(C<on>|C<off>)]
Enable recognition of query parameters (such as C<xinclude=yes>) in the
C<StandardURIResolver>. This option is available in Saxon-PE and Saxon-EE only.
It cannot be used in conjunction with the B<-r> option, and it automatically
switches on the B<-u> and B<-sa> options. The effect is that Saxon-specific
query parameters are recognized in a URI. One query parameter that is
recognized is C<val>. This may take the values C<strict>, C<lax>, or C<strip>.
For example, C<source.xml?val=strict> loads a document with strict schema
validation.
=item B<-quit>:(C<on>|C<off>)
With the default setting, on, the command will quit the Java VM and return an
exit code if a failure occurs. This is useful when running from an operating
system shell. With the setting B<-quit>:C<off> the command instead throws a
C<RunTimeException>, which is more useful when the command is invoked from
another Java application such as Ant.
=item B<-r>:I<classname>
Use the specified C<URIResolver> to process all URIs. The C<URIResolver> is a
user-defined class, that implements the C<javax.xml.transform.URIResolver>
interface, whose function is to take a URI supplied as a string, and return a
SAX Source object. It is invoked to process URIs used in the C<document()>
function, in the C<xsl:include> and C<xsl:import> elements, and (if B<-u> is
also specified) to process the URIs of the source file and stylesheet file
provided on the command line.
=item B<-relocate>:(C<on>|C<off>)
Used with B<-export> to produce an export package which can be deployed to a
different location, with a different base URI. If on, then C<static-base-uri()>
represents the deployed location of the package, rather than its compile time
location. The default is off.
The practical effect of this is that if B<-relocate:>C<off> (the default) is
specified, then the generated SEF file will contain references to the
stylesheets original location as its static base URI, and run-time operations
that are relative to this base URI (for example, calling C<doc()> with a
relative URI) will retrieve resources exactly as if the stylesheet had not been
exported. By contrast, if B<-relocate>:C<on> is specified, the SEF file will
contain no reference to the original location of the source stylesheet, and
operations such as C<doc()> will be relative to the location from which the SEF
file was loaded.
=item B<-repeat>:I<integer>
Performs the transformation I<N> times, where I<N> is the specified integer.
This option is useful for performance measurement, since timings for the first
transformation are often dominated by Java warm-up time.
=item B<-s>:I<filename>
Identifies the source file or directory. Mandatory unless the B<-it> option is
used. The source file is parsed to create a tree, and the document node of this
tree acts as the initial context item for the transformation.
The filename can be given as “C<->” to take the source from standard input,
in which case the base URI is taken from that of the current directory.
If the name identifies a directory, all the files in the directory will be
processed individually. In this case the B<-o> option is mandatory, and must
also identify a directory, to contain the corresponding output files. A
directory must be specified as a filename, not as a URL.
For backwards compatibility the source filename can also be specified
immediately before the stylesheet filename, without the B<-s> flag, provided
that the B<-it> option is not present.
=item B<-sa>
Invoke a schema-aware transformation. Requires Saxon-EE to be installed. This
option is not needed if either (a) another option implying schema-awareness is
present (for example B<-val>:C<strict>) or (b) the stylesheet contains an
C<xsl:import-schema> declaration.
=item B<-scmin>:I<filename>
Loads a precompiled schema component model from the given file. The file should
be generated in a previous run of C<com.saxonica.Validate> using the B<-export>
option. When this option is used, the B<-xsd> option should not be present.
Schemas loaded from an SCM file are assumed to be valid, without checking.
This option is retained for compatibility. From Saxon 9.7, SCM files can also
be supplied in the B<-xsd> option.
=item B<-strip>:(C<all>|C<none>|C<ignorable>)
Specifies what whitespace is to be stripped from source documents (applies both
to the principal source document and to any documents loaded for example using
the C<document()> function). The default is ignorable: all ignorable whitespace
is stripped. Whitespace text nodes are ignorable if they appear in elements
defined in the DTD or schema as having element-only content. Specifying all
strips all whitespace text nodes from source documents before any further
processing, regardless of any C<xsl:strip-space> declarations in the
stylesheet, or any C<xml:space> attributes in the source document. Specifying
ignorable strips all ignorable whitespace text nodes from source documents
before any further processing, regardless of any C<xsl:strip-space>
declarations in the stylesheet, or any C<xml:space> attributes in the source
document. Specifying none suppresses all whitespace stripping unless requested
elsewhere, for example using C<xsl:strip-space>.
=item B<-t>
Display version and timing information to the standard error output. The output
also traces the files that are read and written, and extension modules that are
loaded.
=item B<-T>[:I<classname>]
Display stylesheet tracing information. This traces execution of each
instruction in the stylesheet, so the output can be quite voluminous. Also
switches line numbering on for the source document. If a classname is
specified, it is a user-defined class, which must implement C<TraceListener>.
If the classname is omitted, a system-supplied trace listener is used. For
performance profiling, set classname to
C<net.sf.saxon.trace.TimingTraceListener>. This creates an output file giving
timings for each instruction executed. This output file can subsequently be
analyzed to give an execution time profile for the stylesheet. See
L<Performance
Analysis|https://www.saxonica.com/documentation10/index.html#!using-xsl/performanceanalysis>.
=item B<-target>:(C<EE>|C<PE>|C<HE>|C<JS>)
Relevant only when B<-export> is specified, identifies the target platform on
which the exported stylesheet is to run. When exporting for Saxon-JS, the value
“C<JS>” must be specified, because this adds information to the SEF file that
is required by Saxon-JS. Specifying “C<JS>” means the SEF is produced in JSON
format for use with Saxon-JS 2.x. (To generate SEF files for Saxon-JS 1.x, you
need to revert to Saxon-EE 9.9). In principle, specifying “C<HE>” or “C<PE>”
will inhibit optimizations that generate code which Saxon-HE/Saxon-PE cannot
execute; however, this is not fully tested.
=item B<-TB>:I<filename>
Monitors generation of hot-spot bytecode and produces an XML report on the
given filename giving, for each expression that was a candidate for bytecode
generation and that was actually executed, data about the number of times and
speed of execution in the interpreter, the number of times and speed of
execution in compiled form, and the cost of compilation.
=item B<-threads>:I<N>
Used only when the B<-s> option specifies a directory. Controls the number of
threads used to process the files in the directory. Each transformation runs in
a single thread.
=item B<-TJ>
Switches on tracing of the binding of calls to external Java methods. This is
useful when analyzing why Saxon fails to find a Java method to match an
extension function call in the stylesheet, or why it chooses one method over
another when several are available.
=item B<-Tlevel>:(C<none>|C<low>|C<normal>|C<high>)
Controls the level of detail of the tracing produced by the B<-T> option. The
values are:
=over
=item C<none>
effectively switches tracing off.
=item C<low>
traces function and template calls.
=item C<normal>
traces execution of instructions.
=item C<high>
traces execution of finer-grained expressions.
=back
=item B<-Tout>:I<filename>
Directs the output of tracing to a specified file (assuming that B<-T> is
enabled).
=item B<-TP>:I<filename>
This is equivalent to setting B<-T>:C<net.sf.saxon.trace.TimedTraceListener>
and B<-traceout>:I<filename>; that is, it causes trace profile information to
be set to the specified file. This output file can subsequently be analyzed to
give an execution time profile for the stylesheet. See L<Performance
Analysis|https://www.saxonica.com/documentation10/index.html#!using-xsl/performanceanalysis>.
=item B<-traceout>:I<filename>
Indicates that the output of the C<trace()> function should be directed to a
specified file. Alternatively, specify C<#out> to direct the output to
C<System.out>, C<#err> to send it to C<System.err> (the default), or C<#null>
to have it discarded. This option is ignored when a trace listener is in use:
in that case, C<trace()> output goes to the registered trace listener.
=item B<-tree>:(C<linked>|C<tiny>|C<tinyc>)
Selects the implementation of the internal tree model: C<tiny> selects the
“tiny tree” model (the default), C<linked> selects the linked tree model,
C<tinyc> selects the “condensed tiny tree” model. See L<Choosing a tree
model|https://www.saxonica.com/documentation10/index.html#!sourcedocs/choosingmodel>.
=item B<-u>
Indicates that the names of the source document and the stylesheet document are
URLs; otherwise they are taken as filenames, unless they start with C<http:>,
C<https:>, C<file:> or C<classpath:>, in which case they are taken as URLs.
=item B<-val>[:(C<strict>|C<lax>)]
Requests schema-based validation of the source file and of any files read using
the C<document()> or similar functions. Validation is available only with
Saxon-EE, and this flag automatically switches on the B<-sa> option. Specify
B<-val> or B<-val>:C<strict> to request strict validation, or B<-val>:C<lax>
for lax validation.
=item B<-warnings>:(C<silent>|C<recover>|C<fatal>)
Indicates the policy for handling recoverable errors in the stylesheet:
C<silent> means recover silently, C<recover> means recover after writing a
warning message to the system error output, C<fatal> means signal the error and
do not attempt recovery. (Note, this does not currently apply to all errors
that the XSLT recommendation describes as recoverable). The default is
recover.
=item B<-x>:I<classname>
Use the specified SAX parser for the source file and any files loaded using the
C<document()> function. The parser must be the fully-qualified class name of a
Java class that implements the C<org.xml.sax.XMLReader> or
C<javax.xml.parsers.SAXParserFactory> interface, and it must be instantiable
using a zero-argument public constructor. One use of this option is to select
an HTML parser such as John Cowans TagSoup rather than an XML parser. In this
case, the TagSoup JAR file must be on the classpath, and the class name to use
is C<org.ccil.cowan.tagsoup.Parser>. Another common use is to specify
C<org.apache.xml.resolver.tools.ResolvingXMLReader>. This parser is provided by
the Apache commons project, and it customizes the default parser by using an
C<EntityResolver> that resolves external entity references (note the reference
to an external DTD in a DOCTYPE declaration) by reference to an OASIS catalog
file. This can be used to avoid repeated calls to external web servers (such as
the W3C server) for commonly used DTDs such as the XHTML DTD. The option to
supply a C<SAXParserFactory> was introduced in 9.6 for the benefit of the Aalto
parser, whose C<XMLReader> implementation cannot be directly instantiated; this
parser can therefore be requested by nominating its factory class,
C<com.fasterxml.aalto.sax.SAXParserImpl>.
=item B<-xi>:(C<on>|C<off>)
Apply XInclude processing to all source XML documents (but not to schema and
stylesheet modules). This currently only works when documents are parsed using
the Xerces parser, which is the default on the SaxonJ platform (but not on .NET).
=item B<-xmlversion>:(C<1.0>|C<1.1>)
If B<-xmlversion>:C<1.1> is specified, allows XML 1.1 and XML Namespaces 1.1
constructs. This option must be set if source documents using XML 1.1 are to be
read, or if result documents are to be serialized as XML 1.1. This option also
enables use of XML 1.1 constructs within the stylesheet itself.
=item B<-xsd>:I<file1>;I<file2>;I<file3>…
Loads additional schema documents. The declarations in these schema documents
are available when validating source documents (or for use by the C<validate{}>
expression). This option may also be used to supply the locations of schema
documents that are imported into the stylesheet, in the case where the
C<xsl:import-schema> declaration gives the target namespace of the schema but
not its location.
=item B<-xsdversion>:(C<1.0>|C<1.1>)
If B<-xsdversion>:C<1.1> is specified (the default), allows schema documents
using XML Schema 1.1 to be read, and XML Schema 1.1 constructs such as
assertions.
=item B<-xsiloc>:(C<on>|C<off>)
If set to C<on> (the default) the schema processor attempts to load any schema
documents referenced in C<xsi:schemaLocation> and
C<xsi:noNamespaceSchemaLocation> attributes in the instance document, unless a
schema for the specified namespace (or non-namespace) is already available. If
set to C<off>, these attributes are ignored.
=item B<-xsl>:I<filename>
Specifies the file containing the principal stylesheet module. Mandatory unless
the B<-a> option is used. The value “C<->” identifies the standard input
stream, in which case the static base URI is taken from that of the current
directory. If the B<-u> option is specified then the value must be a URI rather
than a filename.
The selected file can contain either XSLT source code, or a compiled version of
the stylesheet (a SEF file) as produced using the B<-export> option.
=item B<-y>:I<classname>
Use the specified SAX parser for stylesheet files, including any loaded using
C<xsl:include> or C<xsl:import>. The supplied classname must be the
fully-qualified class name of a Java class that implements the
C<org.xml.sax.XMLReader> or C<javax.xml.parsers.SAXParserFactory> interface,
and it must be instantiable using a zero-argument public constructor.
=item B<--feature>:I<value>
Set a feature defined in the C<Configuration> interface. The names of features
are defined in the Javadoc for class Feature (alternatively see L<Configuration
Features|https://www.saxonica.com/documentation10/index.html#!configuration/config-features>):
the value used here is the part of the name after the last “C</>”, for example
B<--allow-external-functions>:C<off>. Only features accepting a string or
boolean may be set; for booleans the values C<true>/C<false>, C<on>/C<off>,
C<yes>/C<no>, and C<1>/C<0> are recognized.
=item B<-?>
Display command syntax.
=item B<--?>
Display a list of features that are available using the B<--feature>:I<value>
syntax.
=back
=head2 COMMAND LINE PARAMETERS
A param takes the form I<name>=I<value>, name being the name of the parameter,
and value the value of the parameter. These parameters are accessible within
the stylesheet as normal variables, using the C<$>I<name> syntax, provided they
are declared using a top-level C<xsl:param> element. If there is no such
declaration, the supplied parameter value is silently ignored. If the
C<xsl:param> element has an as attribute indicating the required type, then the
string value supplied on the command line is cast to this type: this may result
in an error, for example if an integer is required and the supplied value
cannot be converted to an integer. If the parameter is declared with the option
C<static="yes"> (new in XSLT 3.0) then the value is supplied as a static
parameter value.
A param preceded by a leading question mark (C<?>) is interpreted as an XPath
expression. For example, C<?time=current-dateTime()> sets the value of the
stylesheet parameter $time to the value of the current date and time, as an
instance of C<xs:dateTime>, while C<?debug=false()> sets the value of the
parameter C<$debug> to the boolean value false. If the parameter has a required
type (for example C<E<lt>xsl:param name="p" as="xs:date"/E<gt>>), then the
supplied value must be compatible with this type according to the standard
rules for converting variable values and function arguments. The static context
for this XPath expression includes only the standard namespaces conventionally
bound to the prefixes C<xs>, C<fn>, C<xsi>, and C<saxon>. The static base URI
(used when calling the C<doc()> function) is the current directory. The dynamic
context contains no context item, position, or size, and no variables.
A param preceded by a leading exclamation mark (C<!>) is interpreted as an
output parameter. For example, C<!indent=yes> requests indented output. This is
equivalent to specifying the attribute C<indent="yes"> on an C<xsl:output>
declaration in the stylesheet. An output parameter specified on the command
line overrides one specified within the stylesheet. For parameters
C<doctype-system>, C<doctype-public>, and C<saxon:next-in-chain>, a zero-length
value is treated as “absent”, that is, the effect is to cancel any value that
was set within the stylesheet. If you are using the bash shell, you will need
to escape “C<!>” as “C<\!>”.
A param preceded by a leading plus sign (C<+>) is interpreted as a filename or
directory. The content of the file is parsed as XML, and the resulting document
node is passed to the stylesheet as the value of the parameter. If the
parameter value is a directory, then all the immediately contained files are
parsed as XML, and the resulting sequence of document nodes is passed as the
value of the parameter. For example, C<+lookup=lookup.xml> sets the value of
the stylesheet parameter lookup to the document node at the root of the tree
representing the parsed contents of the file F<lookup.xml>.
Under most operating systems it is possible to supply a value containing spaces
by enclosing it in double quotes, for example C<name="John Smith">. This is a
feature of the operating system shell, not something Saxon does, so it may not
work the same way under every operating system or command processor. (In the
jEdit console plugin, for example, it has to be written as C<"name=John
Smith">.)
If the parameter name is in a non-null namespace, the parameter can be given a
value using the syntax C<{>I<uri>C<}>I<localname>=I<value>. Here uri is the
namespace URI of the parameters name, and localname is the local part of the
name.
This applies also to output parameters. For example, you can set the
indentation level to 4 by using the parameter
C<!{http://saxon.sf.net/}indent-spaces=4>. In this case, however, lexical
QNames using the prefix saxon are also recognized, for example
C<!saxon:indent-spaces=4>. See also L<Additional serialization
parameters|https://www.saxonica.com/documentation10/index.html#!extensions/output-extras>.
=head1 SEE ALSO
L<https://www.saxonica.com/documentation10/index.html>, L<gizmo10(1)>,
L<saxon10q(1)>, L<xsltproc(1)>.
=head1 AUTHOR
Michael H. Kay E<lt>L<mike@saxonica.com>E<gt>

46
saxon10.saxon.script Normal file
View File

@ -0,0 +1,46 @@
#!/bin/sh
#
# saxon10 script
# JPackage Project <http://www.jpackage.org/>
. /usr/share/java-utils/java-functions
MAIN_CLASS=net.sf.saxon.Transform
BASE_JARS="saxon10 xml-commons-apis jaxp_parser_impl"
# Optional jars
CLASSPATH="$CLASSPATH:"$(build-classpath \
icu4j \
jdom \
jdom2 \
xml-commons-resolver \
xom \
2>/dev/null) || :
# If we have resolver, add the CatalogManager.properties dir to CLASSPATH,
# and tweak command line options so that it's used.
args=
if echo "$CLASSPATH" | grep xml-commons-resolver >/dev/null 2>&1 && test -r /etc/java/resolver/CatalogManager.properties; then
CLASSPATH="$CLASSPATH:/etc/java/resolver"
# Tune options to use resolver.
r=org.apache.xml.resolver.tools.ResolvingXMLReader
for opt in -x -y ; do
if ! echo $@ | grep "\\${opt}:" >/dev/null 2>&1 ; then
args="$args ${opt}:$r"
fi
done
r=org.apache.xml.resolver.tools.CatalogResolver
if ! echo $@ | grep "\\-r:" >/dev/null 2>&1 ; then
args="$args -r:$r"
fi
fi
# Set parameters
set_jvm
set_classpath $BASE_JARS
set_flags $BASE_FLAGS
set_options $BASE_OPTIONS
# Let's start
run $args "$@"

593
saxon10.saxonq.pod Normal file
View File

@ -0,0 +1,593 @@
=encoding utf8
=head1 NAME
saxon10q - Saxon XQuery 3.0 processor
=head1 SYNOPSIS
saxon10q [I<options>] [I<params>]
=head1 DESCRIPTION
A command to run a query contained in a file.
Saxon 9.8 and later releases implement the XQuery 3.1 Recommendation dated 18
April 2017. Because XQuery 3.1 is backwards compatible with XQuery 1.0 and
XQuery 3.0, Saxon will also execute queries written according to the 1.0 or 3.0
versions of the specification. Saxon no longer has a mode to execute as an
XQuery 1.0 or 3.0 processor (that is, to reject constructs that were not
present in earlier versions of the language). For information about the
conformance of Saxon to the XQuery 3.1 specification, and about the handling of
implementation-defined features of the specification, see
L<Conformance|https://www.saxonica.com/documentation10/index.html#!conformance>.
Saxon uses the same run-time engine to support both XQuery and XSLT, reflecting
the fact that the two languages have very similar semantics. Most of the
compile-time code (in particular, the type checking logic and the optimizer) is
also common. The XQuery support in Saxon consists essentially of an XQuery
parser (which is itself an extension of the XPath parser); the parser generates
the same internal interpretable code as the XSLT processor. There are also some
constructs in the internal expression tree that will only be generated from
XQuery source rather than XSLT source; examples are the XQuery order by and
group by clauses, which have no direct XSLT equivalent.
The XQuery processor may be invoked either from the operating system command
line, or via an API from a user-written application. There is no graphical user
interface provided.
Saxon is an in-memory processor. Unless you can take advantage of streaming,
Saxon is designed to process source documents that fit in memory. Saxon has
been used successfully to process source documents of 100Mbytes or more without
streaming, but if you attempt anything this large, you need to be aware (a)
that you will need to allocate sufficient memory to the Java VM (at least 5
times the size of the source document), and (b) that complex FLWOR expressions
may be very time-consuming to execute. (In this scenario, Saxon-EE is
recommended, because it has a more powerful optimizer for complex joins.)
=head1 OPTIONS
=over
=item B<-backup>:(C<on>|C<off>)
Only relevant when B<-update>:C<on> is specified. Default is on. When backup is
enabled, any file that is updated by the query will be preserved in its
original state by renaming it, adding “C<.bak>” to the original filename. If
backup is disabled, updated files will be silently overwritten.
=item B<-catalog>:I<filenames>
I<filenames> is either a file name or a list of file names separated by
semicolons; the files are OASIS XML catalogs used to define how public
identifiers and system identifiers (URIs) used in a source document, query, or
schema are to be redirected, typically to resources available locally. For more
details see L<Using XML
catalogs|https://www.saxonica.com/documentation10/index.html#!sourcedocs/xml-catalogs>.
=item B<-config>:I<filename>
Indicates that configuration information should be taken from the supplied
configuration file. Any options supplied on the command line override options
specified in the configuration file.
=item B<-dtd>:(C<on>|C<off>|C<recover>)
Setting B<-dtd>:C<on> requests DTD-based validation of the source file and of
any files read using the C<doc()> function. Requires an XML parser that
supports validation. The setting B<-dtd>:C<off> (which is the default)
suppresses DTD validation. The setting B<-dtd>:C<recover> performs DTD
validation but treats the error as non-fatal if it fails. Note that any
external DTD is likely to be read even if not used for validation, because DTDs
can contain definitions of entities.
=item B<-expand>:(C<on>|C<off>)
Normally, if validation using a DTD or schema is requested, any fixed or
default values defined in the DTD or schema will be expanded. Specifying
B<-expand>:C<off> suppresses this. (In the case of DTD-defined defaults, this
might not work with all XML parsers. It does work with the Xerces parser
(default for Java) and the Microsoft parser (default for .NET).)
=item B<-explain>[:I<filename>]
Display a query execution plan. This is a representation of the expression tree
after rewriting by the optimizer. If no file name is specified the output is
sent to the standard error stream. The output is a tree in XML format.
=item B<-ext>:(C<on>|C<off>)
If B<-ext>:C<off> is specified, suppress calls on dynamically-loaded external
Java functions. This does not affect calls on integrated extension functions,
including Saxon and EXSLT extension functions. This option is useful when
loading an untrusted query, perhaps from a remote site using an C<http://> URL;
it ensures that the query cannot call arbitrary Java methods and thereby gain
privileged access to resources on your machine.
=item B<-init>:I<initializer>
The value is the name of a user-supplied class that implements the interface
C<Initializer>; this initializer will be called during the initialization
process, and may be used to set any options required on the C<Configuration>
programmatically.
=item B<-l>[:(C<on>|C<off>)]
If B<-l> or B<-l>:C<on> is specified, causes line and column numbers to be
maintained for source documents. These are accessible using the extension
functions C<saxon:line-number()> and C<saxon:column-number()>. Line numbers are
useful when the purpose of the query is to find errors or anomalies in the
source XML file. Without this option, line numbers are available while source
documents are being parsed and validated, but they are not retained in the tree
representation of the document.
=item B<-mr>:C<classname>
Use the specified C<ModuleURIResolver> to process all query module URIs. The
C<ModuleURIResolver> is a user-defined class that implements the
C<ModuleURIResolver> interface. It is invoked to process URIs used in the
import module declaration in the query prolog, and (if B<-u> is also specified,
or if the file name begins with C<http:>, C<https:>, C<file:> or C<classpath:>)
to process the URI of the query source file provided on the command line.
=item B<-now>:I<yyyy-mm-ddThh:mm:ss+hh:mm>
Sets the value of C<current-dateTime()> (and C<implicit-timezone()>) for the
query. This is designed for testing, to enable repeatable results to be
obtained for comparison with reference results, or to test that queries can
handle significant dates and times such as end-of-year processing.
=item B<-o>:I<filename>
Send output to named file. In the absence of this option, the results go to
standard output. The output format depends on whether the C<-wrap> option is
present. The file is created if it does not already exist; any necessary
directories will also be created. If the file does exist, it is overwritten
(even if the query fails).
=item B<-opt>:[B<->]I<flags>
Allows individual optimizations to be enabled or disabled selectively. There is
a set of single-letter flags identifying particular optimizations:
=over
=item C<c>:
generate bytecode
=item C<d>:
detect void path expressions
=item C<e>:
cache regular expressions
=item C<f>:
inline functions
=item C<g>:
extract global variables
=item C<j>:
just-in-time compilation of template rules (currently XSLT-only)
=item C<k>:
create keys
=item C<l>:
loop lifting
=item C<m>:
miscellaneous
=item C<n>:
constant folding
=item C<r>:
template rule-sets (not relevant to XQuery)
=item C<s>:
extract common subexpressions
=item C<t>:
tail call optimization
=item C<v>:
inline variables
=item C<w>:
create switch statements
=item C<x>:
index predicates
=back
A value such as B<-opt>:C<gs> runs with only the selected optimizations;
B<-opt>:C<-gs> runs with the selected optimizations disabled and all others
enabled. The value B<-opt>:C<0> suppresses all optimizations. The default is
full optimization; this feature allows optimization to be suppressed in cases
where reducing compile time is important, or where optimization gets in the way
of debugging, or causes extension functions with side-effects to behave
unpredictably. (Note however, that even with no optimization, lazy evaluation
may still cause the evaluation order to be not as expected.)
=item B<-outval>:(C<recover>|C<fatal>)
Normally, if validation of result documents is requested, a validation error is
fatal. Setting the option B<-outval>:C<recover> causes such validation failures
to be treated as warnings. The validation message is written both to the
standard error stream, and (where possible) as a comment in the result document
itself.
=item B<-p>[:(C<on>|C<off>)]
Enable recognition of query parameters (such as C<xinclude=yes>) in the
C<StandardURIResolver>. This option is available in Saxon-PE and Saxon-EE only.
It cannot be used in conjunction with the B<-r> option, and it automatically
switches on the B<-u> and B<-sa> options. The effect is that Saxon-specific
query parameters are recognized in a URI. One query parameter that is
recognized is C<val>. This may take the values C<strict>, C<lax>, or C<strip>.
For example, C<source.xml?val=strict> loads a document with strict schema
validation.
=item B<-projection>:(C<on>|C<off>)
Use (or dont use) document projection. Document Projection is a mechanism that
analyzes a query to determine what parts of a document it can potentially
access, and then while building a tree to represent the document, leaves out
those parts of the tree that cannot make any difference to the result of the
query. Requires Saxon-EE.
=item B<-q>:I<queryfile>
Identifies the file containing the query. If this is the last option then the
B<-q>: prefix may be omitted. The file can be specified as “C<->” to read the
query from standard input: in this case the base URI is that of the current
directory.
=item B<-qs>:I<querystring>
Allows the query to be specified inline (if it contains spaces, you will need
quotes around the expression to keep the command line processor happy). The
static base URI of the query is taken from the current working directory. So,
for example, C<java net.sf.saxon.Query -qs:doc('a.xml')//p[1]> selects elements
within the file F<a.xml> in the current directory.
=item B<-quit>:(C<on>|C<off>)
With the default setting, on, the command will quit the Java VM and return an
exit code if a failure occurs. This is useful when running from an operating
system shell. With the setting B<-quit>:C<off> the command instead throws a
C<RunTimeException>, which is more useful when the command is invoked from
another Java application such as Ant.
=item B<-r>:I<classname>
Use the specified C<URIResolver> to process all URIs. The C<URIResolver> is a
user-defined class, that implements the C<URIResolver> interface defined in
JAXP, whose function is to take a URI supplied as a string, and return a SAX
C<InputSource>. It is invoked to process URIs used in the C<doc()> function,
and (if B<-u> is also specified) to process the URI of the source file provided
on the command line.
=item B<-repeat>:I<integer>
Performs the transformation I<N> times, where I<N> is the specified integer.
This option is useful for performance measurement, since timings for the first
few runs of the query are often dominated by Java warm-up time.
=item B<-s>:I<filename-or-URI>
Take input from the specified file. If the B<-u> option is specified, or if the
name begins with “C<file:>” or “C<http:>”, then the name is assumed to be a URI
rather than a filename. This file must contain an XML document. The document
node of the document is made available to the query as the context item. The
filename can be specified as “C<->” to read the source document from standard
input: in this case the base URI is that of the current directory.
=item B<-sa>
Invoke a schema-aware query. Requires Saxon-EE to be installed.
=item B<-scmin>:I<filename>
Loads a precompiled schema component model from the given file. The file should
be generated in a previous run using the B<-export> option. When this option is
used, the B<-xsd> option should not be present. Schemas loaded from an SCM file
are assumed to be valid, without checking.
This option is retained for compatibility. From Saxon 9.7, SCM files can also
be supplied in the B<-xsd> option.
=item B<-stream>:(C<on>|C<off>)
Use (or dont use) streaming. Streaming allows simple queries to be executed
while the source document is being read, avoiding the need to build a tree
representation of the document in memory. For information about the kind of
queries that can be streamed, see L<Streaming
XQuery|https://www.saxonica.com/documentation10/index.html#!sourcedocs/streaming/streamed-query>.
If the query cannot be streamed, execution will fail with diagnostic errors.
Requires Saxon-EE.
=item B<-strip>:(C<all>|C<none>|C<ignorable>)
Specifies what whitespace is to be stripped from source documents (applies both
to the principal source document and to any documents loaded for example using
the C<doc()> function). The default is none: no whitespace stripping.
=item B<-t>
Display version and timing information to the standard error output. The output
also traces the files that are read and written, and extension modules that are
loaded.
=item B<-T>[:I<classname>]
Notify query tracing information. Also switches line numbering on for the
source document. If a classname is specified, it is a user-defined class, which
must implement C<TraceListener>. If the classname is omitted, a system-supplied
trace listener is used. This traces execution of function calls to the standard
error output. For performance profiling, set classname to
C<net.sf.saxon.trace.TimingTraceListener>. This creates an output file giving
timings for each instruction executed. This output file can subsequently be
analyzed to give an execution time profile for the query. See L<Performance
Analysis|https://www.saxonica.com/documentation10/index.html#!using-xquery/performanceanalysis>.
=item B<-TB>:I<filename>
Monitors generation of hot-spot bytecode and produces an XML report on the
given filename giving, for each expression that was a candidate for bytecode
generation and that was actually executed, data about the number of times and
speed of execution in the interpreter, the number of times and speed of
execution in compiled form, and the cost of compilation. Note that if an
expression I<A> contains an expression I<B> and both are candidates for
bytecode generation, then the statistics for I<B> relate only to the time
before I<A> was compiled in its own right.
=item B<-TJ>
Switches on tracing of the binding of calls to external Java methods. This is
useful when analyzing why Saxon fails to find a Java method to match an
extension function call in the query, or why it chooses one method over another
when several are available.
=item B<-Tlevel>:(C<none>|C<low>|C<normal>|C<high>)
Controls the level of detail of the tracing produced by the C<-T> option. The
values are:
=over
=item C<none>
effectively switches tracing off.
=item C<low>
traces function calls.
=item C<normal>
traces execution of significant expressions such as element constructors.
=item C<high>
traces execution of finer-grained expressions such as the clauses of a FLWOR expression.
=back
=item B<-Tout>:I<filename>
Directs the output of tracing to a specified file (assuming that B<-T> is
enabled).
=item B<-TP>:I<filename>
This is equivalent to setting B<-T>:C<net.sf.saxon.trace.TimedTraceListener>
and B<-traceout>:I<filename>; that is, it causes trace profile information to
be set to the specified file. This output file can subsequently be analyzed to
give an execution time profile for the query. See L<Performance
Analysis|https://www.saxonica.com/documentation10/index.html#!using-xquery/performanceanalysis>.
=item B<-traceout>:I<filename>
Indicates that the output of the CC<trace()> function should be directed to a
specified file. Alternatively, specify C<#out> to direct the output to
C<System.out>, C<#err> to send it to C<System.err> (the default), or C<#null>
to have it discarded. This option is ignored when a trace listener is in use:
in that case, C<trace()> output goes to the registered trace listener.
=item B<-tree>:(C<linked>|C<tiny>|C<tinyc>)
Selects the implementation of the internal tree model. C<tiny> selects the
“tiny tree” model (the default), C<linked> selects the linked tree model,
C<tinyc> selects the “condensed tiny tree” model. See L<Choosing a tree
model|https://www.saxonica.com/documentation10/index.html#!sourcedocs/choosingmodel>.
=item B<-u>
Indicates that the name of the source document is a URI; otherwise it is taken
as a filename, unless it starts with C<http:>, C<https:>, C<file:> or
C<classpath:>, in which case it is taken as a URL.
=item B<-update>:(C<on>|C<off>|C<discard>)
Indicates whether XQuery Update syntax is accepted. This option requires
Saxon-EE. The value on enables XQuery update; any eligible files updated by the
query are written back to filestore. A file is eligible for updating if it was
read using the C<doc()> or C<collection()> functions using a URI that
represents an updateable location. The context document supplied using the
B<-s> option is not eligible for updating. The default value off disables
update (any use of XQuery update syntax is an error). The value discard allows
XQuery Update syntax, but modifications made to files are not saved in
filestore. If the document supplied in the B<-s> option is updated, the updated
document is serialized as the result of the query (writing it to the B<-o>
destination); updates to any other documents are simply discarded. Use of the
B<-t> option is recommended: it gives feedback on which files have been updated
by the query.
=item B<-val>[:(C<strict>|C<lax>)]
Requests schema-based validation of the source file and of any files read using
the C<doc()> function. This option is available only with Saxon-EE, and it
automatically switches on the B<-sa> option. Specify B<-val> or
B<-val>:C<strict> to request strict validation, or B<-val>:C<lax> for lax
validation.
=item B<-wrap>
Wraps the result sequence in an XML element structure that indicates the type
of each node or atomic value in the query result. This format can handle any
type of query result. In the absence of this option, the command effectively
wraps a C<document{}> constructor around the supplied query, so that the result
is a single XML document, which is then serialized. This will fail if the query
result includes constructs that cannot be added to a document node in this way,
notably free-standing attribute nodes.
=item B<-x>:I<classname>
Use the specified SAX parser for the source file and any files loaded using the
C<doc()> function. The parser must be the fully-qualified class name of a Java
class that implements the C<org.xml.sax.XMLReader> or
C<javax.xml.parsers.SAXParserFactory> interface, and it must be instantiable
using a zero-argument public constructor.
=item B<-xi>:(C<on>|C<off>)
Apply XInclude processing to all source XML documents (but not to schema
documents). This currently only works when documents are parsed using the
Xerces parser, which is the default in JDK 1.5 and later.
=item B<-xmlversion>:(C<1.0>|C<1.1>)
If B<-xmlversion>:C<1.1> is specified, allows XML 1.1 and XML Namespaces 1.1
constructs. This option must be set if source documents using XML 1.1 are to be
read, or if result documents are to be serialized as XML 1.1. This option also
enables use of XML 1.1 constructs within the query itself.
=item B<-xsd>:I<file1>;I<file2>;I<file3>…
Loads additional schema documents. The declarations in these schema documents
are available when validating source documents (or for use by the C<validate{}>
expression). This option may also be used to supply the locations of schema
documents that are imported into the query, in the case where the import schema
declaration gives the target namespace of the schema but not its location.
=item B<-xsdversion>:(C<1.0>|C<1.1>)
If B<-xsdversion>:C<1.1> is specified (the default), allows schema documents
using XML Schema 1.1 to be read, and XML Schema 1.1 constructs such as
assertions.
=item B<-xsiloc>:(C<on>|C<off>)
If set to C<on> (the default) the schema processor attempts to load any schema
documents referenced in C<xsi:schemaLocation> and
C<xsi:noNamespaceSchemaLocation> attributes in the instance document, unless a
schema for the specified namespace (or non-namespace) is already available. If
set to C<off>, these attributes are ignored.
=item C<--feature>:I<value>
Set a feature defined in the C<Configuration> interface. The names of features
are defined in the Javadoc for class Feature (alternatively see L<Configuration
Features|https://www.saxonica.com/documentation10/index.html#!configuration/config-features>):
the value used here is the part of the name after the last “C</>”, for example
B<--allow-external-functions>:C<off>. Only features accepting a string or
boolean may be set; for booleans the values C<true>/C<false>, C<on>/C<off>,
C<yes>/C<no>, and C<1>/C<0> are recognized.
=item B<-?>
Display command syntax.
=item B<--?>
Display a list of features that are available using the B<--feature>:I<value>
syntax.
=back
=head2 COMMAND LINE PARAMETERS
A I<param> takes the form I<name>=I<value>, name being the name of the
parameter, and value the value of the parameter. These parameters are
accessible within the query as external variables, using the C<$>I<name>
syntax, provided they are declared in the query prolog. If there is no such
declaration, the supplied parameter value is silently ignored.
A param preceded by a leading question mark (C<?>) is interpreted as an XPath
expression. For example, C<?time=current-dateTime()> sets the value of the
external variable C<$time> to the value of the current date and time, as an
instance of C<xs:dateTime>, while C<?debug=false()> sets the value of the
variable C<$debug> to the boolean value false. If the parameter has a required
type (for example C<declare variable $p as xs:date external;>), then the
supplied value must be compatible with this type according to the standard
rules for converting function arguments (it doesnt need to satisfy the
stricter rules that apply to variable initialization). The static context for
the XPath expression includes only the standard namespaces conventionally bound
to the prefixes C<xs>, C<fn>, C<xsi>, and C<saxon>. The static base URI (used
when calling the C<doc()> function) is the current directory. The dynamic
context contains no context item, position, or size, and no variables.
A param preceded by a leading plus sign (C<+>) is interpreted as a filename or
directory. The content of the file is parsed as XML, and the resulting document
node is passed to the stylesheet as the value of the parameter. If the
parameter value is a directory, then all the immediately contained files are
parsed as XML, and the resulting sequence of document nodes is passed as the
value of the parameter. For example, C<+lookup=lookup.xml> sets the value of
the external variable lookup to the document node at the root of the tree
representing the parsed contents of the file F<lookup.xml>.
A param preceded by a leading exclamation mark (C<!>) is interpreted as a
serialization parameter. For example, C<!indent=yes> requests indented output,
and C<!encoding=iso-8859-1> requests that the serialized output be in ISO
8859/1 encoding. This is equivalent to specifying the option declaration
declare option C<saxon:output "indent=yes">; or declare option C<saxon:output
"encoding=iso-8859-1">; in the query prolog. If you are using the bash shell,
you will need to escape “C<!>” as “C<\!>”.
Under Windows, and some other operating systems, it is possible to supply a
value containing spaces by enclosing it in double quotes, for example
C<name="John Smith">. This is a feature of the operating system shell, not
something Saxon does, so it may not work the same way under every operating
system.
If the parameter name is in a non-null namespace, the parameter can be given a
value using the syntax C<{>I<uri>C<}>I<localname>=I<value>. Here uri is the
namespace URI of the parameters name, and localname is the local part of the
name.
This applies also to output parameters. For example, you can set the
indentation level to 4 by using the parameter
C<!{http://saxon.sf.net/}indent-spaces=4>. In this case, however, lexical
QNames using the prefix saxon are also recognized, for example
C<!saxon:indent-spaces=4>. For the extended set of output parameters supported
by Saxon, see L<Additional serialization
parameters|https://www.saxonica.com/documentation10/index.html#!extensions/output-extras>.
=head1 SEE ALSO
L<https://www.saxonica.com/documentation10/index.html>, L<saxon10(1)>,
L<gizmo10(1)>.
=head1 AUTHOR
Michael H. Kay E<lt>L<mike@saxonica.com>E<gt>

46
saxon10.saxonq.script Normal file
View File

@ -0,0 +1,46 @@
#!/bin/sh
#
# saxon10q script
# JPackage Project <http://www.jpackage.org/>
. /usr/share/java-utils/java-functions
MAIN_CLASS=net.sf.saxon.Query
BASE_JARS="saxon10 xml-commons-apis jaxp_parser_impl"
# Optional jars
CLASSPATH="$CLASSPATH:"$(build-classpath \
icu4j \
jdom \
jdom2 \
xml-commons-resolver \
xom \
2>/dev/null) || :
# If we have resolver, add the CatalogManager.properties dir to CLASSPATH,
# and tweak command line options so that it's used.
args=
if echo "$CLASSPATH" | grep xml-commons-resolver >/dev/null 2>&1 && test -r /etc/java/resolver/CatalogManager.properties; then
CLASSPATH="$CLASSPATH:/etc/java/resolver"
# Tune options to use resolver.
r=org.apache.xml.resolver.tools.ResolvingXMLReader
for opt in -x ; do
if ! echo $@ | grep "\\${opt}:" >/dev/null 2>&1 ; then
args="$args ${opt}:$r"
fi
done
r=org.apache.xml.resolver.tools.CatalogResolver
if ! echo $@ | grep "\\-r:" >/dev/null 2>&1 ; then
args="$args -r:$r"
fi
fi
# Set parameters
set_jvm
set_classpath $BASE_JARS
set_flags $BASE_FLAGS
set_options $BASE_OPTIONS
# Let's start
run $args "$@"

271
saxon10.spec Normal file
View File

@ -0,0 +1,271 @@
#
# spec file
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global saxon_version 10
%global saxon_release 9
%global saxon_compat_version 10
# net.sf.saxon.om.XMLChar is from ASL-licensed Xerces
Name: saxon%{saxon_version}
Version: %{saxon_version}.%{saxon_release}
Release: 0
Summary: The SAXON XSLT Processor from Michael Kay
License: Apache-2.0 AND MPL-2.0
Group: Productivity/Publishing/XML
URL: https://www.saxonica.com/
Source0: https://github.com/Saxonica/Saxon-HE/raw/main/%{saxon_version}/source/saxon%{saxon_version}-%{saxon_release}source.zip
# %{name}-generate-tarball.sh
Source1: saxon-resources-%{saxon_version}-cleaned.zip
Source2: https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/%{saxon_version}.%{saxon_release}/Saxon-HE-%{saxon_version}.%{saxon_release}.pom
Source3: %{name}.build.xml
Source10: %{name}.saxon.script
Source11: %{name}.saxonq.script
Source12: %{name}.gizmo.script
Source20: %{name}.saxon.pod
Source21: %{name}.saxonq.pod
Source22: %{name}.gizmo.pod
# run saxon10-generate-tarball.sh script to remove potential nonfree content from saxon-resources-10.zip.
Source100: %{name}-generate-tarball.sh
BuildRequires: ant
BuildRequires: dom4j
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: icu4j
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local >= 6
BuildRequires: jdom
BuildRequires: jdom2
BuildRequires: jetbrains-annotations
BuildRequires: jline >= 2
BuildRequires: sed
BuildRequires: unzip
BuildRequires: xml-commons-apis
BuildRequires: xml-commons-resolver
BuildRequires: xom
Requires(post): update-alternatives
Requires(postun):update-alternatives
Recommends: %{name}-scripts
Provides: jaxp_transform_impl = %{version}
BuildArch: noarch
%description
The Saxon package is a collection of tools for processing XML documents. The
main components are:
An XSLT processor, which can be used from the command line, or invoked from
an application, using a supplied API. Saxon implements the XSLT 3.0
Recommendation. The product can also be used to run XSLT 2.0 stylesheets, or
XSLT 1.0 stylesheets in backwards compatibility mode.
An XPath processor accessible to applications via a supplied API. This
supports XPath 2.0 and XPath 3.1. It can also be used in
backwards-compatibility mode to evaluate XPath 1.0 expressions.
An XQuery processor that can be used from the command line, or invoked from
an application by use of a supplied API. This supports XQuery 3.1, which also
allows XQuery 1.0 or 3.0 queries to be executed. With Saxon-EE, you can also
use the XQuery extensions defined in the XQuery Update 1.0 Recommendation, but
later working drafts of XQuery Update are not supported (W3C has abandoned work
on these versions).
An XML Schema Processor. This supports both XSD 1.0 and XSD 1.1. This can be
used on its own to validate a schema for correctness, or to validate a source
document against the definitions in a schema. It is also used to support the
schema-aware functionality of the XSLT and XQuery processors. Like the other
tools, it can be run from the command line, or invoked from an application.
On the Java platform, when using XSLT, XPath, XQuery, or XML schema
validation, Saxon offers a choice of APIs. If you need portability across
different vendors' tools, you can use the JAXP API for XSLT, XPath, and XML
Schema processing, and the XQJ interface for XQuery. On the other hand, if you
want a more integrated and complete API offering access to all Saxon's
facilities, the s9api interface is recommended. You can also dive down deeper
into the Saxon internals if you need to: there has been no particular attempt
to make interfaces private, and all public interfaces are documented in the
JavaDoc. Clearly, the deeper you go, the greater the risk of interfaces
changing in future releases.
On the .NET platform, Saxon offers an API that enables close integration with
other services available from .NET, notably the XML-related classes in the
System.Xml namespace. It isn't possible to use Saxon as a transparent plug-in
replacement for the System.Xml.Xsl processor, because the API for the Microsoft
engine using concrete classes rather than abstract interfaces. However, it is
possible to use it as a functional replacement with minor changes to your
application code.
%package manual
Summary: Manual for %{name}
Group: Productivity/Publishing/XML
%description manual
Manual for %{name}.
%package javadoc
Summary: Javadoc for %{name}
Group: Productivity/Publishing/XML
%description javadoc
Javadoc for %{name}.
%package demo
Summary: Demos for %{name}
Group: Productivity/Publishing/XML
Requires: %{name} = %{version}-%{release}
%description demo
Demonstrations and samples for %{name}.
%package scripts
Summary: Utility scripts for %{name}
Group: Productivity/Publishing/XML
Requires: %{name} = %{version}-%{release}
Requires: javapackages-tools
Requires: jaxp_parser_impl
Requires: jline
Requires: xml-commons-apis
Recommends: icu4j
Recommends: jdom
Recommends: jdom2
Recommends: xml-commons-resolver
Recommends: xom
%description scripts
Utility scripts for %{name}.
%prep
%setup -q -c
unzip -q %{SOURCE1}
cp -p %{SOURCE3} ./build.xml
# purge EE imports
find -name \*.java |xargs sed -i -e 's/\(^import com\.saxonica\..*\)/\/\/\1/'
# deadNET
rm -rf net/sf/saxon/dotnet
# This requires a EE edition feature (com.saxonica.xsltextn)
rm -rf net/sf/saxon/option/sql/SQLElementFactory.java
# cleanup unnecessary stuff we'll build ourselves
rm -rf docs/api
find . \( -name "*.jar" -name "*.pyc" \) -delete
mkdir -p build/classes
cat >build/classes/edition.properties <<__PROPERTIES__
config=net.sf.saxon.Configuration
platform=net.sf.saxon.java.JavaPlatform
__PROPERTIES__
%build
export CLASSPATH=$(build-classpath xml-commons-apis jdom jdom2 xom dom4j icu4j xml-commons-resolver jline jetbrains-annotations)
ant \
-Dj2se.javadoc=%{_javadocdir}/java \
-Djdom.javadoc=%{_javadocdir}/jdom \
-Ddom4j.javadoc=%{_javadocdir}/dom4j
pod2man --release='%{name} %{version}' --section=1 --center='User Commands' --quotes=none %{SOURCE20} %{name}.1
pod2man --release='%{name} %{version}' --section=1 --center='User Commands' --quotes=none %{SOURCE21} %{name}q.1
pod2man --release='%{name} %{version}' --section=1 --center='User Commands' --quotes=none %{SOURCE22} gizmo%{saxon_version}.1
%install
# JARs, POM, API documentation
install -dm 0755 %{buildroot}%{_javadir}
install -pm 0644 build/lib/saxon.jar %{buildroot}%{_javadir}/%{name}.jar
install -dm 0755 %{buildroot}%{_mavenpomdir}
%{mvn_install_pom} %{SOURCE2} %{buildroot}%{_mavenpomdir}/%{name}.pom
%add_maven_depmap %{name}.pom %{name}.jar
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -r build/api %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}/%{name}
# Demo
install -dm0755 %{buildroot}%{_defaultdocdir}/%{name}
cp -rf use-cases samples drivers %{buildroot}%{_defaultdocdir}/%{name}
# Scripts
install -dm0755 %{buildroot}%{_bindir}
install -m0755 %{SOURCE10} %{buildroot}%{_bindir}/%{name}
install -m0755 %{SOURCE11} %{buildroot}%{_bindir}/%{name}q
install -m0755 %{SOURCE12} %{buildroot}%{_bindir}/gizmo%{saxon_version}
# Manual pages
install -dm0755 %{buildroot}%{_mandir}/man1
install -Dm0644 {%{name}{,q},gizmo%{saxon_version}}.1 %{buildroot}%{_mandir}/man1/
# jaxp_transform_impl ghost symlink
install -dm0755 %{buildroot}%{_sysconfdir}/alternatives/
ln -sf %{_sysconfdir}/alternatives/jaxp_transform_impl.jar %{buildroot}%{_javadir}/jaxp_transform_impl.jar
# Manual
install -dm0755 %{buildroot}%{_defaultdocdir}/%{name}/{doc,source-userdoc}
cp -rf doc/{index.html,img} %{buildroot}%{_defaultdocdir}/%{name}/doc
unzip -qq -d %{buildroot}%{_defaultdocdir}/%{name}/source-userdoc source-userdoc.zip
ln -s %{_javadocdir}/%{name} %{buildroot}%{_defaultdocdir}/%{name}/javadoc
find %{buildroot}%{_defaultdocdir}/%{name} \
-name \*.class -delete -or -name \*.exe -delete
find %{buildroot}%{_defaultdocdir}/%{name} \
\( -name \*.cs \
-or -name \*.xml \
-or -name \*.xsl \
-or -name \*.xq \
-or -name \*.xqlib \
-or -name \*.dtd \
-or -name \*.xsd \
-or -name \*.resx \
-or -name \*.out \
-or -name \*.cmd \
\) -print0 \
|xargs -0 dos2unix
%fdupes %{buildroot}%{_defaultdocdir}/%{name}
%post
update-alternatives --install %{_javadir}/jaxp_transform_impl.jar \
jaxp_transform_impl %{_javadir}/%{name}.jar 25
%postun
if [ $1 -eq 0 ] ; then
update-alternatives --remove jaxp_transform_impl %{_javadir}/%{name}.jar
fi
%files -f .mfiles
%{_javadir}/jaxp_transform_impl.jar
%ghost %{_sysconfdir}/alternatives/jaxp_transform_impl.jar
%license notices/{ASM,ICU-J,JAMESCLARK,JLINE2,LICENSE,THAI,UNICODE}.txt
%files manual
%{_defaultdocdir}/%{name}
%exclude %{_defaultdocdir}/%{name}/drivers
%exclude %{_defaultdocdir}/%{name}/samples
%exclude %{_defaultdocdir}/%{name}/use-cases
%files javadoc
%{_javadocdir}/%{name}
%files demo
%{_defaultdocdir}/%{name}/drivers
%{_defaultdocdir}/%{name}/samples
%{_defaultdocdir}/%{name}/use-cases
%files scripts
%defattr(0755,root,root,0755)
%{_bindir}/*
%attr(0644,root,root) %{_mandir}/man1/*.1%{?ext_man}
%changelog