saxon

Saxon XPath API returns TinyElementImpl instead of org.w3c.dom.Node

I have the following code: // xpath evaluates to net.sf.saxon.xpath.XPathEvaluator XPath xpath = XPathFactory.newInstance().newXPath(); XPathExpression expression = xpath.compile("/foo/bar"); Object evaluate = expression.evaluate(someXML, XPathConstants.NODE); Object evaluate2 = expression.evaluate(someXML, XPathConstants.NODESET); S...

How do I get XSLT to stop using scientific notation when outputting the results of numeric operations?

I have a bit of XSLT which is performing some magic on integer database identifiers. The relevant code snippit is <xsl:variable name="releaseId" select="@ID + $contentOffsetId"/> <xsl:attribute name="OLD_ID"> <xsl:value-of select="@ID" /> </xsl:attribute> <xsl:attribute name="RELEASE_ID"> <xsl:value-of select="$releas...

How to validate XQuery source file for XSD schema

I mean without input XML file. I'm using Saxon-EE 9.2. ...

org.xml.sax.SAXParseException: The entity "ndash" was referenced, but not declared.

I'm parsing the the following... <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE tox:message SYSTEM "http://tox.sf.net/tox/dtd/tox.dtd"&gt; <tox:message xmlns:tox="http://tox.sourceforge.net/"&gt; <tox:model owner="scott" package="queue" function="appendFact"> <tox:parameter value=" By John Smith &ndash; Thu Feb 25, 4:54 pm ET&lt;br...

Saxon XSLT-Transformation: How to change serialization of an empty tag from <x/> to <x></x>?

Hello folks! I do some XSLT-Transformation using Saxon HE 9.2 with the output later being unmarshalled by Castor 1.3.1. The whole thing runs with Java at the JDK 6. My XSLT-Transformation looks like this: <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://my/own/custom/namespace/for/...

Using XSLT, how do I separate nodes based on their value?

I have a pretty flat XML structure that I need to reorder into categorised sections and, for the life of me, I can't figure out how to do it in XSLT (not that I'm by any means an expert.) Basically, the original XML looks kinda like: <things> <thing> <value>one</value> <type>a</type> </thing> <thing> <value>two</value...

Difficulty getting Saxon into XQuery mode instead of XSLT

I'm having difficulty getting XQuery to work. I downloaded Saxon-HE 9.2. It seems to only want to work with XSLT. When I type: java -jar saxon9he.jar I get back usage information for XSLT. When I use the command syntax for XQuery, it doesn't recognize the parameters (like -q), and gives XSLT usage information. Here are some command ...

Saxon PDF tutorials?

Does anyone know a good set of Saxon XML, XSLT, PDF (link text) tutorials for .net? ...

Cannot access updated Java object from Saxon XSLT processor

I am working with an open source version of the Saxon XSLT processor "Saxon 9.0.0.2J from Saxonica" and am trying to make use of the java extensibility for the first time. I am running into an issue I suspect may be a limitation on the open source version, but wanted to check first whether there might be something I am just missing here...

XSLT: Transform XML files tree

I have the following file structure (XML files 'index.xml' in nested folders): index.xml foo/index.xml foo/sub/index.xml foo/.../index.xml bar/.../index.xml Now I have to transform each of this XML files with a given XSL stylesheet. The result should be the same folder structure (overwriting would be OK). What would be your approach t...

Improving the performance of XSL

I am using the below XSL 2.0 code to find the ids of the text nodes that contains the list of indices that i give as input. the code works perfectly but in terms for performance it is taking a long time for huge files. Even for huge files if the index values are small then the result is quick in few ms. I am using saxon9he Java processor...

Set saxon DocumentBuilderFactoryImpl features using javax.xml interface.

Here what I have. System.setProperty( "javax.xml.parsers.DocumentBuilderFactory", "net.sf.saxon.dom.DocumentBuilderFactoryImpl"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); //factory.setNamespaceAware(true); //factory.setIgnoringElementContentWhitespace(true); //factory.setValidating(fal...

XSLT workflow with variable number of source files

I have a bunch of XML files with a fixed, country-based naming schema: report_en.xml, report_de.xml, report_fr.xml, etc. Now I want to write an XSLT style sheet that reads each of these files via the document() XPath function, extracts some values and generates one XML files with a summary. My question is: How can I iterate over the sour...

Why does Saxon evaluate the result-document URI to be the same?

My XSL source document looks like this <Topology> <Environment> <Id>test</Id> <Machines> <Machine> <Id>machine1</Id> <modules> <module>m1</module> <module>m2</module> </modules> </Machine> </Machines> </Environment> <Environment> <Id>prod...

XSLT 1.1 nodeset

I have this... <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common"&gt; <xsl:variable name="data"> <root> <test>1000</test> <test>2000</test> <test>3000</test> </root> </xsl:variable> <xsl:template match="/"> <xsl:for-each select...

how to set xquery context document in java using saxon 9.2he?

how do I execute this xquery for $elem in /root/element() return $elem on an xml file using java without using fn:doc? i keep getting XPDY0002: The context item for axis step child::element(xml, xs:anyType) is undefined --the rundown: I need a simple solution to load an xml file, load an xquery and process ...

XALAN register Extension Function like in SAXON

Hi, i want to transform a XML by XSLT with XALAN. Now i want to use a extension-function, this function have to be added in JAVA source like in SAXON: Method: TransformerFactory tFactory = TransformerFactory.newInstance(); Configuration c = ((net.sf.saxon.TransformerFactoryImpl) tFactory).getConfiguration(); c.registerExtensionFunctio...

Saxon 9.2 / Java / XSLT: setting transformer parameters using setParameters()

Hi all, I have the following XSLT 2.0 template: <xsl:template name="t1"> <xsl:variable name="totalpos" as="xsd:double" select="$currentTotal"/> .. I am struggling to programmatticaly provide currentTotal as a parameter to the transformer, like this: transformer.setParameter("currentTotal", new Double("100")) .. but without any posi...

Sorting a subtree and storing it in an xsl:variable

I'm working with an XSL stylesheet, and I'm trying to use the method shown here to store a sorted subtree as a variable. I'm using saxon 8.7 vis the xml-maven-plugin to transform my XML file. Here's the code that I have: <xsl:variable name="miniDays"> <xsl:for-each select="//day[position() > $firstPosToShow]"> <xsl:sort se...

saxon in eclipse

hello, my appli generate xml files and I want to make a query to get all or some generated objects to make some tests is saxon the expected tool? if yes could you give an example of use? ...