saxon

namespace-unaware XPath expression fails if Saxon is on the CLASSPATH

有些话、适合烂在心里 提交于 2019-12-07 05:09:38
问题 I have the following sample XML file: <a xmlns="http://www.foo.com"> <b> </b> </a> Using the XPath expression /foo:a/foo:b (with 'foo' properly configured in the NamespaceContext ) I can correctly count the number of b nodes and the code works both when Saxon-HE-9.4.jar is on the CLASSPATH and when it's not. When, however, I parse the same file with a namespace- unaware DocumentBuilderFactory , the XPath expression "/a/b" correctly counts the number of b nodes only when Saxon-HE-9.4.jar is

How can I format a decimal in xquery?

陌路散爱 提交于 2019-12-07 03:08:06
问题 I'm trying to format decimals in XQuery. The decimals are currency, so the format should be ,###.## . For example: 5573652.23 should be 5,573,652.23 and 352769 should be 352,769 (or 352,769.00 if it's easier/cleaner) Right now I'm using this function from http://www.xqueryhacker.com/2009/09/format-number-in-xquery/, but I can't use decimals with it: declare function local:format-int($i as xs:int) as xs:string { let $input := if ($i lt 0) then fn:substring(fn:string($i), 2) else fn:string($i)

Saxon 9 XSLT transformer vs Xalan 2.7

蹲街弑〆低调 提交于 2019-12-07 02:42:54
问题 I am currently using Xalan 2.7.0 for XSLT transformations over XML, but thinking over to switch to Saxon 9 version for XSLT transformations. So could someone list me the major cons and prons of using Saxon over Xalan . Although i know that Saxon supports XSLT 2.0 and other major changes but instead i would like to know more about personal experiences with Saxon 9 and its prons and cons and other benefits. 回答1: I used Xalan 10 years ago. I have been using Saxon almost exclusively for the last

Saxon error with XSLT import statement

南楼画角 提交于 2019-12-07 00:51:48
问题 The Saxon processor gives me an error whenever I have an XSLT import statement. Here is the error: XTSE0165: I/O error reported by XML parser processing file: shared/test.xslt (The system cannot find the path specified): Here is how my XSLT document looks like: <?xml version='1.0' encoding='UTF-8'?> <xsl:stylesheet version='2.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:fn='http://www.w3.org/2005/02/xpath-functions' xmlns:xs='http://www.w3.org/2001/XMLSchema' > <xsl:import href=

Calling jQuery-UI components in XSL using Saxon-JS and its global Javascript function namespace?

六眼飞鱼酱① 提交于 2019-12-07 00:31:34
Related to this question, you can call Javascript functions from XSL 2.0 transforms running in the browser using Saxon-JS. But I can't seem to invoke the jQuery-UI calls. My only thought is that it may be a timing issue where the jQuery selector can not find the target object's ID because Saxon-JS has yet to render it to the DOM. My simple test follows... The XML... <?xml version="1.0" encoding="UTF-8"?> <data> <date month="7" day="17" year="2017"/> </data> The XSL... <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:js="http://saxonica.com/ns/globalJS" xmlns:xsl="http://www.w3.org

XSLT filter nodes based on given node list

那年仲夏 提交于 2019-12-06 15:46:44
This may have already be answered somewhere, but I do not have right words to search it : Lets say I have data file which has list of cities : <cities> <city abbr='A'>NameA</city> <city abbr='b'>NameB</city> </cities> The cities list is long and I want to filter the cities based on abbr [filter data] <skip> <abbr>A</abbr> <abbr>B</abbr> </skip> How could I use the this filter data(in xml form) to skip some nodes from original data file , specifically how I can use in for-each loop e.g <xsl:template match="/"> <xsl:for-each select="not in skip list"> ??? </xsl:for-each> </xsl:template> I want

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

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 15:33:59
问题 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 positive results: Error at /xsl:transform/xsl:template[3]/xsl:variable[1] XPST0008: XPath syntax error at char 13 on line -1 in {$currentTotal}: Variable $currentTotal has not

How to parse HTML using XPath with Saxon-HE in command line?

。_饼干妹妹 提交于 2019-12-06 14:38:21
I use saxon HE 9.6, and it's great for playing with XPath 3 while you are parsing well formed XML files. But I would like to know how to combine expath-http-client (or any other working solution) with Saxon to have the power to parse realLife©®™ (possibly broken) HTML. (Java is not my better skill). I searched google quite many hours without any working solution. I tried something like : xquery_file.xsl : xquery version "1.0"; declare namespace http="http://expath.org/ns/http-client"; let $url := 'http://stackoverflow.com' let $response := http:send-request( <http:request href="{$url}" method=

How can I call jQuery-UI components from a browser side XSL rendering of HTML using Saxon-JS?

自闭症网瘾萝莉.ら 提交于 2019-12-06 14:23:26
问题 All mainstream browsers still support XSLT for rendering HTML from XML using XSLT, although most only support XSLT 1.0. Version 2.0 and some 3.0 can be used via Saxon-JS. The advent of popular Javascript libraries for rendering HTML (I happen to use jQuery-UI), not only produces the visual HTML, but connects the components to event listeners for behavior. I would like the best of both worlds. I would like to send XML to the browser to be rendered via XSL, but for interactive components, I

XALAN register Extension Function like in SAXON

五迷三道 提交于 2019-12-06 13:37:36
问题 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.registerExtensionFunction(new FooExtension()); FooExtension: public class FooExtension extends ExtensionFunctionDefinition { private static final long serialVersionUID =