带有param的XSLT模板(XSLT templates with param)
设置: Apache,Xalan 2.7.1,xslt 1.0 输入: 3个文件xml aprox。 750MB
给定一个
template with param
名称的template with param
通过param传递当前上下文还是使用模板内部的current()
函数可以获得性能提升吗?<xsl:call-template name="one"> <xsl:with-param name="context" select = "." /> </xsl:call-template> <!-- OR --> <xsl:call-template name="two"/> <xsl:template name="one"> <xsl:param name = "context" /> <xsl:value-of select="$context/something"/> </xsl:template> <xsl:template name="two"> <xsl:value-of select="current()/somthing"/> </xsl:template>
Setup: Apache, Xalan 2.7.1, xslt 1.0 Input: 3 Files xml aprox. 750mb
Given a
template with param
called by its name, is there a performance gain from passing current context by param or by using thecurrent()
function from inside the template?<xsl:call-template name="one"> <xsl:with-param name="context" select = "." /> </xsl:call-template> <!-- OR --> <xsl:call-template name="two"/> <xsl:template name="one"> <xsl:param name = "context" /> <xsl:value-of select="$context/something"/> </xsl:template> <xsl:template name="two"> <xsl:value-of select="current()/somthing"/> </xsl:template>
原文:https://stackoverflow.com/questions/31163589
更新时间:2023-12-25 12:12
最满意答案
你应该跑步
groups username
列出用户所属的组。
如果用户不存在,则输出为
groups: username: No such user
所以bash脚本可以
output=$(groups username) if [[ $output == *"groupname"* ]]; then echo yes fi
You should run
groups username
to list the groups the user belongs.
If the user does not exist, the output is
groups: username: No such user
So the bash script can be
output=$(groups username) if [[ $output == *"groupname"* ]]; then echo yes fi
相关问答
更多-
来自“ man 1 passwd ”: --stdin This option is used to indicate that passwd should read the new password from standard input, which can be a pipe. 所以在你的情况下 adduser "$1" echo "$2" | passwd "$1" --stdin [ 更新 ]意见中提出了几个问题: 您的passwd命令可能没有-- ...
-
简单地将git用户和组视为保留给gitlab内部使用。 如果你想为你的shell用户创建一个组,请将其命名为其他名称。 请参阅Gitlab文档以重命名Gitlab使用的组。 Simply treat the git user and group as reserved for gitlab's internal use. If you wish to create a group for your shell users, name it something else. See the Gitlab doc ...
-
如果你知道用户名和组(你看起来像),你可以像这样使用id : id -Gn username | grep '\bgroupname\b' id -Gn将显示用户id -Gn所有组名,则如果该组存在,则grep将返回0,否则将返回1。 \b仅匹配单词边界,这使您无法匹配组名的子串(例如, everyone )。 我相信所有的Unix和类Unix系统都可以使用id 。 它在Linux,OS X和OpenBSD中的确存在并且功能相同。 但是, \b不适用于后者,因为它使用的是BSD grep而不是GNU gr ...
-
Linux命令'getent group'不会为某些组返回用户?(Linux command 'getent group' not returning users for some groups?)[2021-11-18]
缺少的是每个用户都有一个主要组,通常存储在/etc/passwd (通常在域4中),并且可能有一个或多个补充组。 只有补充组关联位于/etc/group ,因此, getent group将显示唯一的关联getent group 。 为了获得特定用户的整个组列表,您可以使用id -a,但是您必须遍历用户列表以获取完整信息转储... What you are missing is that each user has a primary group, which is stored in /e ... -
知道用户是否已存在的Linux本机方法是检入/etc/passwd文件,如下所示: if grep "${username}" /etc/passwd >/dev/null 2>&1; then # do something if the user exists fi 另一种方法是使用finger命令(默认情况下并不总是安装): $ finger ineumann Login: ineumann Name: Idriss Neumann Directory: /home ...
-
您可以将任务放在新的yml文件中并使用条件包括: # subtasks.yml --- - name: Setting up user {{ user }} user: > generate_ssh_key=yes name="{{ user }}" - name: Capturing user's home directory shell: "getent passwd {{ user }} | awk -F: '{ print $6 }'" register: user_h ...
-
你应该跑步 groups username 列出用户所属的组。 如果用户不存在,则输出为 groups: username: No such user 所以bash脚本可以 output=$(groups username) if [[ $output == *"groupname"* ]]; then echo yes fi You should run groups username to list the groups the user belongs. If the user ...
-
您需要使用useradd使用散列密码,例如 $password = escapeshellarg( crypt('password') ); shell_exec("useradd username -p $password"); -p, - password PASSWORD crypt(3)返回的加密密码。 默认设置是禁用该帐户。 ( man useradd ) You need to use the hashed password using useradd, e.g. $password = es ...
-
将由getent_passwd提供的值getent_passwd为一个由“:”加入的扁平字符串的正确方法是什么? 例如,使用带有join过滤器的Jinja2模板: - debug: msg: "{{ user.username }}:{{getent_passwd[user.username]|join(':')}}" 可以运行getent passwd user1 user2 - 是否有可能以某种方式将两个密钥提供给可信任的getent模块? 不可以是单个或全部。 使用外部循环在第一种情况下请求 ...
-
这全是一种不必要的重载! 在我的覆盖文件夹中,我有一个passwd (通常位于etc文件夹中的那个),它正在替换/ bin文件夹中的二进制文件并导致问题。 It was all an unwanted override! In my overrides folder I had a passwd (the one that usually sits in etc folder) which was replacing the binary in /bin folder and causing the pro ...