Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 如何使用两个表编写xslt查询 大街11163号BC111 11abhishekasdm01-Feb-199112211 大街11163号BC111A333423111 22dsf33gdf343 23dsfddfsd3423 23dfg01-Feb-1991dgfsdsd 34111101-1991年2月_Xml_Xslt - Fatal编程技术网

Xml 如何使用两个表编写xslt查询 大街11163号BC111 11abhishekasdm01-Feb-199112211 大街11163号BC111A333423111 22dsf33gdf343 23dsfddfsd3423 23dfg01-Feb-1991dgfsdsd 34111101-1991年2月

Xml 如何使用两个表编写xslt查询 大街11163号BC111 11abhishekasdm01-Feb-199112211 大街11163号BC111A333423111 22dsf33gdf343 23dsfddfsd3423 23dfg01-Feb-1991dgfsdsd 34111101-1991年2月,xml,xslt,Xml,Xslt,这就是我用来创建xml文件的内容 分行(分行、街道、城市、邮政编码) 员工(员工编号、姓名、职位、性别、出生日期、工资、分支机构) 物业费用(物业编号、街道、城市、邮政编码、类型、房间、租金、业主编号、员工编号、, 布兰奇诺) 客户端(客户端号、名称、电话号码、prefType、maxRent) 私有所有者(所有者编号、姓名、地址、电话号码) 查看(客户端号、属性号、查看日期、注释) 注册(客户号、布兰奇诺、员工号、日期) 我必须为此编写xslt 列出在街道地址为“163 Main street

这就是我用来创建xml文件的内容

分行(分行、街道、城市、邮政编码)

员工(员工编号、姓名、职位、性别、出生日期、工资、分支机构)

物业费用(物业编号、街道、城市、邮政编码、类型、房间、租金、业主编号、员工编号、, 布兰奇诺)

客户端(客户端号、名称、电话号码、prefType、maxRent)

私有所有者(所有者编号、姓名、地址、电话号码)

查看(客户端号、属性号、查看日期、注释)

注册(客户号、布兰奇诺、员工号、日期)

我必须为此编写xslt
列出在街道地址为“163 Main street”的分行工作的员工姓名。

我写的是这个,它不起作用。PLZ帮助

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<Company_Y>
    <Branch>
        <branchNo>11</branchNo><street>163 Main street</street><city>abc</city><postcode>111</postcode>
    </Branch>
    <Staff>
        <staffNo>11</staffNo><Name>abhishek</Name><position>asd</position><sex>m</sex><DOB>01-Feb-1991</DOB><salary>122</salary><branchNo>11</branchNo>
    </Staff>
    <PropertyforRent>
        <propertyNo>11</propertyNo><street>163 Main street</street><city>abc</city><postcode>111</postcode><type>a</type><rooms>3</rooms><rent>334</rent><ownerNo>23</ownerNo><staffNo>11</staffNo><branchNo>11</branchNo>
    </PropertyforRent>
    <Client>
        <clientNo>22</clientNo><Name>dsf</Name><telNo>33</telNo><prefType>gdf</prefType><maxRent>343</maxRent>
    </Client>
    <PrivateOwner>
        <ownerNo>23</ownerNo><Name>dsfd</Name><address>dfsd</address><telNo>3423</telNo>
    </PrivateOwner> 
    <Viewing>
        <clientNo>23</clientNo><propertyNo>dfg</propertyNo><viewDate>01-Feb-1991</viewDate><comment>dgfsdsd</comment>
    </Viewing>
    <Registration>
        <clientNo>34</clientNo><branchNo>11</branchNo><staffNo>11</staffNo><dateJoined>01-Feb-1991</dateJoined>
    </Registration> 
</Company_Y>

列出在街道地址为“163 Main street”的分行工作的员工姓名
名称
街道
p=选择的值=“branchNo”

您可以将目标branchNo分配给xsl变量,并在for each循环中使用该变量

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
    <h2>List the name of staff who work in the branch whose street address is ‘163 Main street’</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th>name</th>
        <th>street</th>
      </tr>
      <xsl:for-each select="Company_Y/Branch">
      <xsl:if test="street='163 Main street'">
         p=value-of select="branchNo"
           <xsl:for-each select="Company_Y/Staff">
              <xsl:if test1="branchNo=p">
              <tr>
                   <td><xsl:value-of select="branchNo"/></td>
                   <td><xsl:value-of select="Name"/></td>
              </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet> 

您可以将目标branchNo分配给xsl变量,并在for each循环中使用该变量

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
    <h2>List the name of staff who work in the branch whose street address is ‘163 Main street’</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th>name</th>
        <th>street</th>
      </tr>
      <xsl:for-each select="Company_Y/Branch">
      <xsl:if test="street='163 Main street'">
         p=value-of select="branchNo"
           <xsl:for-each select="Company_Y/Staff">
              <xsl:if test1="branchNo=p">
              <tr>
                   <td><xsl:value-of select="branchNo"/></td>
                   <td><xsl:value-of select="Name"/></td>
              </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet> 


开始和结束标记不匹配,因此xsl无效打开和结束标记不匹配,因此xsl无效