首页 \ 问答 \ xsd:XSLT 1.0中的boolean与XSLT 2.0(xsd:boolean in XSLT 1.0 vs XSLT 2.0)

xsd:XSLT 1.0中的boolean与XSLT 2.0(xsd:boolean in XSLT 1.0 vs XSLT 2.0)

根据这个答案的前几行,我推断出来

<xsl:if test="not(@dothis) or @dothis=true()">

属性dothis将被视为节点集而不是布尔值。 此外,除非未定义,否则此值将始终为true。 但是,我观察到在XLST 2.0转换中(在JAVA中使用SAXON引擎),上述条件得到满足并且如下所示的节点

<entry node="node1" dothis="false">Dr.Manhattan in rebirth!</entry>

被适当跳过。

但是,当我使用XSLT 1.0(在Perl中使用libxslt引擎)时,我必须将条件修改为

<xsl:if test="not(@dothis) or (@dothis = 'true')">

然后才会跳过像node1这样的节点。

为什么Perl XSLT 1.0引擎无法正确理解true()并且需要将值显式为'true'


Based on first few lines of this answer, I infer that

<xsl:if test="not(@dothis) or @dothis=true()">

attribute dothis will be treated as node-set and not boolean value. Also, this value will always be true unless its not defined. However, I have observed that in XLST 2.0 transformation (using SAXON engine in JAVA), above condition gets satisfied and nodes such as following

<entry node="node1" dothis="false">Dr.Manhattan in rebirth!</entry>

are skipped appropriately.

However when I use XSLT 1.0 (using libxslt engine in Perl), I have to modify the condition as

<xsl:if test="not(@dothis) or (@dothis = 'true')">

and only then does the nodes like node1 are skipped.

Why can't the Perl XSLT 1.0 engine understands true() correctly and needs the value as 'true' explicitly?


原文:https://stackoverflow.com/questions/39017729
更新时间:2023-02-02 08:02

最满意答案

您需要解析val,并设置ops的顺序(如果需要),例如:

$(document).ready(function() {
  $("input").blur(
    function() {
      var sum = 0;
      $('input[name="y"]').val(function() {
        var valA = parseFloat($('input[name="a"]').val()),
            valB = parseFloat($('input[name="b"]').val()),
            valE = parseFloat($('input[name="e"]').val()),
            sum = (valA + valB) - valE;//set your order of ops here
        return sum.toFixed(2);
      });
    }
  );
});

请参阅此更新


You need to parse the vals, and set your order of ops (if need be), like:

$(document).ready(function() {
  $("input").blur(
    function() {
      var sum = 0;
      $('input[name="y"]').val(function() {
        var valA = parseFloat($('input[name="a"]').val()),
            valB = parseFloat($('input[name="b"]').val()),
            valE = parseFloat($('input[name="e"]').val()),
            sum = (valA + valB) - valE;//set your order of ops here
        return sum.toFixed(2);
      });
    }
  );
});

See this update

相关问答

更多
  • 我改变你的代码,使其正确对齐 body { background-color: Yellow; display: table; } h1 { color: blue; font-family: Impact, Charcoal, sans-serif; } h3 { font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; } .left { color ...
  • 不要使用表格进行布局 使用标签标签 将样式float: left分配给:标签和输入字段。 然后在它们下方添加清除(如果元素相互重叠有任何问题)。 替代方案是指定display: inline到输入字段。 Don't use tables for layout use label tag Assign style float: left to both: labels and input fields. Then add clear below them (if you have any issues wit ...
  • 单击按钮,调用此功能 function fillValuesInTextBoxes() { var text = document.getElementById("firsttextbox").value; document.getElementById("secondtextbox").value = text; document.getElementById("thirdtextbox").value = text; document.getElementById("f ...
  • 您可以使用.submit()事件处理程序。 然后使用return false或e.preventDefault()来停止提交。 另请注意, id是唯一的,因此$('#data')只是一个元素,因此.each() : $('#formIDHere').submit(function(e){ if ($('#data').val() == "" || $('#data').val() == null) { alert("Write Data must be filled out or Re ...
  • 您需要解析val,并设置ops的顺序(如果需要),例如: $(document).ready(function() { $("input").blur( function() { var sum = 0; $('input[name="y"]').val(function() { var valA = parseFloat($('input[name="a"]').val()), valB = parseFloat($('input ...
  • 输入元素的name属性中的方括号语法将表单输入转换为数组。 所以,当你使用name="input_text[]"你会得到一个数组。 这个数组可以在使用request.form.getlist方法的Flask路由中处理。 让我们看看这是行动。 app.py : from flask import Flask, render_template, url_for, request app = Flask(__name__) @app.route('/') def search(): return re ...
  • 我没有你的HTML ,所以我将使用我认为你将在你的document使用的元素。 测试一下: 纯JavaScript : var form = document.getElementsByTagName("form")[0]; form.onsubmit = function(){ // on form submit var input = document.querySelectorAll("input"); for(var i = 0; i < input.length; i++){ ...
  • while($namerow=mysqli_fetch_array($names)) { $name=$namerow["name"]; echo "$name will use points."; } 每当代码在循环中重复时,它会给你一个不同的输入名称。 你也可以使用name="points[]" 它会返回数组中 ...
  • $("input[type='checkbox']").change(function(){ var status = this.checked; $(this).next().attr("disabled", !status); }); 在更改checkbox获取是否已选中时,相应地在单击的复选框旁边设置input的禁用属性。 在这里播放。 $("input[type='checkbox']").change(function(){ var status = this.check ...
  • 是的,你可以得到这些值。 如果您使用JQuery: var minDate = $('input.highcharts-range-selector:eq(0)').val(); var maxDate = $('input.highcharts-range-selector:eq(1)').val(); Yes you can get these values. If you are using JQuery: var minDate = $('input.highcharts-range-select ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)