问题标签 [saxon-js]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 在 Saxon 10.6 HE 中使用 XSLT 转换 XML 时出现 NotSerializableException
我正在尝试在 Saxon 10.6 HE 中使用 XSLT 转换 XML。得到如下错误。
错误:java.io.WriteAbortedException:写入中止;java.io.NotSerializableException:net.sf.saxon.om.StructuredQName
输入 XML:
XSLT:
Java代码:
请帮助解决此问题。有什么方法可以在不使用 Serializer 的情况下实现这一点。
xml - XSLT - 条件中的变量未分配数组值
使用 xslt3 (Saxon JS) 并且不绑定到特定的 XSLT 版本
鉴于此 sample.xml
这个sample.xsl
我希望$depTasks
变量包含一个数组(属性中列出的所有depdeps
)或单个值(属性中列出的depparent
),并获得如下转换:
但是相反,我得到了这个结果(似乎只分配了标记化的第一个元素)
条件内部变量分配是否存在问题或限制?或者我在这里错过了什么?
请注意,如果我稍微更改样式表并将变量 OUTSIDE 声明为条件,则会按预期分配一个数组。
样本2.xsl
导致这种转变
node.js - SaxonJS.XPath.evaluate throws 超出最大调用堆栈大小
我正在尝试使用 saxon JS 来评估一些 xPaths
我正在运行以下代码
引发以下错误
我尝试过的任何网页都出现同样的错误。如何解析源代码并使用 saxon-js 评估页面
注意:我对使用 xpath 3.0 的替代方案持开放态度 注意2:上面的代码适用于 npm xpath 但它使用 xpath 1
node.js - Is it possible to use Saxon-JS to convert a JSON file to a different JSON file without transiting through XML?
I'm doing research to solve a transformation problem that is fundamentally based entirely in JSON, and while imperative code-based solutions are possible, there is appeal in using an established technology like XSLT and leveraging its many features rather than trying to in-house everything from scratch. I'm fairly inexperienced with XSLT but I would love for this effort to provide a reason to learn it.
I've read that JSON is included in XSLT 3.0 and XPath 3.1 specs, and that Saxon-JS supports these, and furthermore that Saxon-JS has a node.js version. This has me very interested, but I haven't found much in the way of tutorials that provide instruction about how to transform JSON into other JSON; instead the focus appears to be on transforming JSON into XML.
This question is kind of broad and so I'd be happy to know just whether this is possible, and maybe where to look to start learning, but stackoverflow likes examples. With that in mind, what would a stylesheet look like that converts the first of these JSON documents to the second?
Source:
Output: