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
最满意答案
您需要解析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
相关问答
更多-
使用css对齐输入框(Align input boxes using css)[2022-06-19]
我改变你的代码,使其正确对齐 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 ...
-
输入框上的操作(Operations on input boxes)[2022-06-09]
您需要解析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循环中输入框(Input boxes in while loop)[2023-08-15]
while($namerow=mysqli_fetch_array($names)) { $name=$namerow["name"]; echo " "; } 每当代码在循环中重复时,它会给你一个不同的输入名称。 你也可以使用name="points[]" 它会返回数组中 ...$name will use 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 ...