我正在计算A学校报告中的数量.
这是报告:
<class>
<student>
<first-name>Jane</first-name>
<last-name>Doe</last-name>
<grade>A</grade>
</student>
<student>
<first-name>John</first-name>
<last-name>Smith</last-name>
<grade>B</grade>
</student>
<student>
<first-name>Harry</first-name>
<last-name>Grandson</last-name>
<grade>A</grade>
</student>
<student>
<first-name>Lacy</first-name>
<last-name>Jones</last-name>
<grade>C</grade>
</student>
</class>
Run Code Online (Sandbox Code Playgroud)
我如何获得报告中的数量A?
我提出了:
<xsl:value-of select="count(/class/student/grade)"/>
Run Code Online (Sandbox Code Playgroud)
但这算上了一切 - 所以我试图只得到A这个:
<xsl:value-of select="count(/class/student/grade/A)"/>
Run Code Online (Sandbox Code Playgroud)
但这也不起作用.
我也试过这个:
<xsl:value-of select="count(/class/student[grade=A])"/>
Run Code Online (Sandbox Code Playgroud)
但这也不起作用 - 你们怎么想?
在我的网站上实施lightgallery时遇到问题.我已经搜索了堆栈溢出并阅读了lightgallery页面上的文档,无法弄清楚问题是什么!这是我的网站的代码:
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>W3 Alchemy | My Portfolio of Work</title>
<link href="stylesheets/normalize.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="stylesheets/app.css" />
<link type="text/css" rel="stylesheet" href="stylesheets/lightGallery.css" />
<script src="bower_components/modernizr/modernizr.js"></script>
</head>
<body>
<div class="contain-to-grid header-section">
<nav class="top-bar important-class" data-topbar>
<ul class="title-area">
<li class="name">
<a href="http://www.w3alchemy.com"><img src="img/W3HeadLogo1.png" alt="" id="logo-image"></a>
</li>
<li class="toggle-topbar menu-icon"><a href="#"><span></span></a></li>
</ul>
<section class="top-bar-section">
<ul class="right">
<li class="active"><a href="portfolio.html">Portfolio</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</section>
</nav>
</div>
<div class="header-fill"></div>
<div class="row"> …Run Code Online (Sandbox Code Playgroud) 我在从 6.2.5 更新到 7.0.4 时遇到了一个可怕的问题。在我使用inputMask这样的方式之前:
<p:inputMask id="input" value="#{bean.inputs.id}" mask="^^ ^^ ^^ ^^ ^^"
requiredMessage="#{label.lblRequired}" >
<f:validator validatorId="Validator"/>
</p:inputMask>
Run Code Online (Sandbox Code Playgroud)
还有一个 javascript 部分,我定义了“^”的用法
$.mask.definitions['^'] = '[A-Fa-f0-9]';
Run Code Online (Sandbox Code Playgroud)
使用 primefaces 7.0.4 我不能再使用这种模式,正如您在此提交中看到的:Link to primefaces github。另外,如果我使用这种方式,没有错误,但值一直为空,但在网页上以正确的方式填充。
我的问题是是否还有其他方法可以向我输入的每个字段添加正则表达式?或者是否有我遗漏的模式
我试过的票价是:
<f:validateRegex pattern="[regex]"/>--> 不好<p:keyFilter regEx="[regex]" />--> 仅适用于 inputText我有一个包含整数数组的字段,例如:
_source: {
...
prices: [
20001,
30001
]
}
Run Code Online (Sandbox Code Playgroud)
我想过滤结果,使得价格至少包含一个值列表,例如:
[20002,30000] #不会返回上述文档,因为没有值介于20002和30000之间,但[10000,20002]会返回上面的文档,因为价格字段中的20001以上文件的数据介于10000和20002之间
在我所了解到的其中一个博客中,它.bind()只是将传递的对象硬绑定到'this',另外.call()还会执行该函数.但是,将其分配.call()给其他变量将实现相同的目的.我试图理解为什么.bind()要介绍或者我错过了什么?以下是证明我上面所说的代码:
function foo () {
console.log( this.a );
}
let obj = {
a: 2,
foo: foo
};
let a = 'oops! global';
let foocall = foo.call (obj);
let foobind = foo.bind (obj);
foo.call (obj);
setTimeout ( foocall , 100);
setTimeout ( foo , 100);
Run Code Online (Sandbox Code Playgroud)
输出:
[xyz:〜/ sandboxes/js] $ node --use-strict binding.js 2 2 2
javascript ×2
filter ×1
html ×1
jsf ×1
lightgallery ×1
primefaces ×1
range ×1
xhtml ×1
xml ×1
xslt ×1