我正嘗試使用XSLT將xml文件轉換爲另一個文件。由於我是一個相當新手,請幫助我創建xslt以將輸入xml文件轉換爲輸出xml文件。 在此先感謝。使用XSLT將XML文件轉換爲另一個XML文件
輸入XML
<?xml version="1.0" encoding="UTF-8"?>
<title>
<subtitle1>
<OrganizationDetails>
<OrgName>qwe</EmpNumber>
<OrgAddress>asdfg 123</EmpName>
</OrginzationDetails >
</subtitle1>
<subtitle2>
<ResourceDetails>
<EmpNumber>1</EmpNumber>
<EmpName>xyz</EmpName>
</ResourceDetails>
<ResourceDetails>
<EmpNumber>2</EmpNumber>
<EmpName>abc</EmpName>
</ResourceDetails>
<ResourceDepartment>
<EmpNumber>1</EmpNumber>
<DepartmentNo>IT</DepartmentNo>
</ResourceDepartment>
<ResourceDepartment>
<EmpNumber>2</EmpNumber>
<DepartmentNo>SALES</DepartmentNo>
</ResourceDepartment>
</subtitle2>
</title>
預期輸出XML
<?xml version="1.0" encoding="UTF-8"?>
<title>
<subtitle1>
<OrginzationDetails>
<OrgName>qwe</EmpNumber>
<OrgAddress>asdfg 123</EmpName>
</OrginzationDetails >
</subtitle1>
<subtitle2>
<ResourceDetails>
<EmpNumber>1</EmpNumber>
<EmpName>xyz</EmpName>
</ResourceDetails>
<ResourceDepartment>
<EmpNumber>1</EmpNumber>
<DepartmentNo>IT</DepartmentNo>
</ResourceDepartment>
</subtitle2>
</title>
<title>
<subtitle1>
<OrginzationDetails>
<OrgName>qwe</EmpNumber>
<OrgAddress>asdfg 123</EmpName>
</OrginzationDetails >
</subtitle1>
<subtitle2>
<ResourceDetails>
<EmpNumber>2</EmpNumber>
<EmpName>abc</EmpName>
</ResourceDetails>
<ResourceDepartment>
<EmpNumber>2</EmpNumber>
<DepartmentNo>SALES</DepartmentNo>
</ResourceDepartment>
</subtitle2>
</title>
一般情況下,你會想利用[關鍵](https://www.w3.org/TR/xslt/#鍵)以解決輸入中的交叉引用。 –