2017-04-04 134 views
0

我努力實現以下目標:查找具有特定值的節點,並返回子節點的值在XSLT

我需要找到DepartmentIdentifier = 7IM0,但我需要接收來自值子節點= 7IMU

由於文檔具有相同的結構,應始終獲取與我搜索的值相關的子值的值。

希望有人能幫忙。

 <sd:DepartmentReference> 
      <sd:DepartmentIdentifier>7IM0</sd:DepartmentIdentifier> 
      <sd:DepartmentUUIDIdentifier>95837aa7-947f-4a00-9600-0000012c0001</sd:DepartmentUUIDIdentifier> 
      <sd20080201:DepartmentLevelIdentifier>Afdelings-niveau</sd20080201:DepartmentLevelIdentifier> 
      <sd:DepartmentReference> 
      <sd:DepartmentIdentifier>7IMU</sd:DepartmentIdentifier> 
      <sd:DepartmentUUIDIdentifier>9f5a74a7-947f-4a00-b600-000001320001</sd:DepartmentUUIDIdentifier> 
      <sd20080201:DepartmentLevelIdentifier>NY3-niveau</sd20080201:DepartmentLevelIdentifier> 
      <sd:DepartmentReference> 
       <sd:DepartmentIdentifier>7PKU</sd:DepartmentIdentifier> 
       <sd:DepartmentUUIDIdentifier>c28ffaa0-947f-4a00-8000-000001320001</sd:DepartmentUUIDIdentifier> 
       <sd20080201:DepartmentLevelIdentifier>NY4-niveau</sd20080201:DepartmentLevelIdentifier> 
      </sd:DepartmentReference> 
      </sd:DepartmentReference> 
     </sd:DepartmentReference> 
     <sd:DepartmentReference> 
      <sd:DepartmentIdentifier>10FF</sd:DepartmentIdentifier> 
      <sd:DepartmentUUIDIdentifier>320e71a7-947f-4a00-a200-000001340001</sd:DepartmentUUIDIdentifier> 
      <sd20080201:DepartmentLevelIdentifier>Afdelings-niveau</sd20080201:DepartmentLevelIdentifier> 
      <sd:DepartmentReference> 
      <sd:DepartmentIdentifier>10FE</sd:DepartmentIdentifier> 
      <sd:DepartmentUUIDIdentifier>2f176da7-947f-4a00-8600-000001340001</sd:DepartmentUUIDIdentifier> 
      <sd20080201:DepartmentLevelIdentifier>NY3-niveau</sd20080201:DepartmentLevelIdentifier> 
      <sd:DepartmentReference> 
       <sd:DepartmentIdentifier>10ØV</sd:DepartmentIdentifier> 
       <sd:DepartmentUUIDIdentifier>6252c1a6-947f-4a00-ae00-000001360001</sd:DepartmentUUIDIdentifier> 
       <sd20080201:DepartmentLevelIdentifier>NY4-niveau</sd20080201:DepartmentLevelIdentifier> 
      </sd:DepartmentReference> 
      </sd:DepartmentReference> 
     </sd:DepartmentReference> 
+0

蔭能夠與XPath查找值時,它返回的部分我有 – Per

+0

麻煩請添加你希望得到的輸出。 – weirdan

回答

0

DepartmentIdentifier = 7IM0沒有任何子節點。你的意思是它父母的孩子嗎?如果是這樣,你可以試試這個:

<xsl:variable name="value" select="sd:DepartmentReference[sd:DepartmentIdentifier='7IM0']/sd:DepartmentReference/sd:DepartmentIdentifier"/> 
相關問題