小编use*_*959的帖子

XPath中的translate和replace之间有什么区别

我正在浏览一些XSLT函数并遇到两个主要命名为,translate并且replace,据我所知,在一天结束时,这两个函数的工作正在替换声明的实体上的一些内容(请在此更多地启发我).

此外,我正在编写一个XSLT,我希望用下面的一堆值替换单个值.

<div class="translate">
            <xsl:value-of select="translate(current(),' ', 'XXXXX')"/>
        </div>
        <div class="replace">
            <xsl:value-of select="replace(current(),' ', 'XXXXX')"/>
        </div>
Run Code Online (Sandbox Code Playgroud)

该translate是只增加一个X,虽然我已经添加了XXXXX,在那里作为替换工作正常.

有人可以让我知道背景中发生了什么吗?

这是一个工作示例http://xsltransform.net/6rewNxE/2

xml xslt xpath

8
推荐指数
2
解决办法
2万
查看次数

负数不会进入int

我在java中有以下代码.在这里,我试图看到一个数组的随机组合.

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Random;

public class Dummy {
    public static void main(String args[]) throws Exception {
        Random rand = new Random();

        int[] a = { 1, 2, 3, 4, 5 };
        int[] b = { 1, 0, 1, 0, 1 };
        Arrays.sort(a);
        Arrays.sort(b);
        int x = a.length * b.length;
        System.out.println(x);

        ArrayList<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < 25; i++) {

            System.out.println("random of i is" + a[rand.nextInt(i)]
                    + "and j is …
Run Code Online (Sandbox Code Playgroud)

java random arraylist

2
推荐指数
1
解决办法
116
查看次数

完整内容不会写入文件

我在我的文本文件中有以下数据集.

10
100
3
5 75 25
200
7
150 24 79 50 88 345 3
8
8
2 1 9 4 4 56 90 3
542
100
230 863 916 585 981 404 316 785 88 12 70 435 384 778 887 755 740 337 86 92 325 422 815 650 920 125 277 336 221 847 168 23 677 61 400 136 874 363 394 199 863 997 794 587 124 321 212 957 764 173 314 422 …
Run Code Online (Sandbox Code Playgroud)

java arraylist

1
推荐指数
1
解决办法
101
查看次数

第一次看到三个奇怪的错误

我一直在研究数组,当我声明一个方法时,它会给出3个错误,请帮我修复它们.

我的代码是

public class Dummy {
    public static void main(String args[]) throws Exception {
         Random rand=new Random();

         int[] a={1,3,-3};
         int[] b={2,1,-4};


         public int sum()    {

         }
     }
}
Run Code Online (Sandbox Code Playgroud)

我得到的错误是

Syntax error on token "int", @ expected
Syntax error, insert "enum Identifier" to complete EnumHeaderName
Syntax error, insert "EnumBody" to complete BlockStatement
Run Code Online (Sandbox Code Playgroud)

我通过查看报告的类似错误尝试了一些替代方案,但没有找到任何其他解决方案

谢谢

java

0
推荐指数
1
解决办法
44
查看次数

模板被调用在它不应该的地方

我有以下两个XML案例.

情况1:

<para>Rent is the sum of money paid by the Tenant to the Landlord for the exclusive use of premises. The Landlord and Tenant signs a <page num="4"/>tenancy agreement which has to be stamped with the tax authorities as required under the Stamp Duties Act. The stamping of a tenancy agreement gives it validity but if the tenancy agreement is not stamped that does not mean</para>
Run Code Online (Sandbox Code Playgroud)

案例2:

<para><page num="5"/>The Writ of Distress proceedings is an effective way to recover …
Run Code Online (Sandbox Code Playgroud)

xslt

0
推荐指数
1
解决办法
77
查看次数

标签 统计

java ×3

arraylist ×2

xslt ×2

random ×1

xml ×1

xpath ×1