XML文件1:
<?xml version="1.0"?>
<rentalProperties>
<property contact ="1">
<type>House </type>
<price>420</price>
<address>
<streetNo>1</streetNo>
<street>Wavell Street</street>
<suburb>Box Hill</suburb>
<state>VIC</state>
<zipcode>3128</zipcode>
</address>
<numberOfBedrooms>3</numberOfBedrooms>
<numberOfBathrooms>1</numberOfBathrooms>
<garage>1</garage>
</property>
Run Code Online (Sandbox Code Playgroud)
XML文件2:
<?xml version="1.0"?>
<rentalProperties>
<property contact ="1">
<type>House </type>
<price>420</price>
<address>1 wavell street,Box Hill,VIC,Australia</address>
<numberOfBedrooms>3</numberOfBedrooms>
<numberOfBathrooms>1</numberOfBathrooms>
<garage>1</garage>
</property>
Run Code Online (Sandbox Code Playgroud)
我应该如何使用xslt将xml文件1转换为xml文件?我想将地址表示为单行,并将新属性[country- Australia]添加到行尾.我完成了剩下的工作.我正在努力解决地址问题
XSLT文件:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" type="text/css" href="style.css">
<xsl:template match="/">
<rentalProperties>
<property>
<xsl:attribute name="contact"><xsl:value-of select='@contact'/></xsl:attribute>
<type><xsl:value-of select="type"/></type>
<price><xsl:value-of select="price"/></price>
<numberOfBedrooms><xsl:value-of select="numberOfBedrooms"/></numberOfBedrooms>
<numberOfBathrooms><xsl:value-of select="numberOfBathrooms"/></numberOfBathrooms>
<garage><xsl:value-of select="garage"/></garage>
</property>
</rentalProperties>
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud) 我想搜索一个多维数组并打印大于7的数字及其位置.
此代码编译并运行时没有任何错误,但不提供任何输出.
请帮我解决这个问题.
class Sarr{
public static void main(String args[]){
int[][] numArray = {{1,2,5,6,4,0},{6,0,1,2},{1,7,3,4},{3,5,6,8,5}};
arr(numArray);
}
private static void arr(int [][] array){
int val = 7;
for (int r = 0; r < array.length; r++) {
for (int c = 0; c < array[r].length; c++) {
if (array[r][c] > val){
System.out.println("Value found was " + val + "["+r+"]"+"["+c+"]");
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)