中分組項有沒有辦法採取看起來像這樣的XML文件:的Biztalk:映射
<?xml version="1.0" encoding="utf-8"?>
<spMyStoredProc xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo">
<StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>1</Item>
<Property>something</property>
</StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>2</Item>
<Property>something</property>
</StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>3</Item>
<Property>something</property>
<Group>1</Group>
</StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>4</Item>
<Property>something</property>
<Group>1</Group>
</StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>5</Item>
<Property>something</property>
<Group>2</Group>
</StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo/spMyStoredProc">
<Item>6</Item>
<Property>something</property>
<Group>2</Group>
</StoredProcedureResultSet0>
</StoredProcedureResultSet0>
<ReturnValue>0</ReturnValue>
</spMyStoredProc>
出來的格式如下:
<MyRequests>
<Request>
<Item ID="1" Property="Something" />
</Request>
<Request>
<Item ID="2" Property="Something" />
</Request>
<Request GroupID="1">
<Item ID="3" Property="Something" />
<Item ID="4" Property="Something" />
</Request>
<Request GroupID="2">
<Item ID="5" Property="Something" />
<Item ID="6" Property="Something" />
</Request>
</MyRequests>
我親近只是用從源模式到目的地的直接映射,但它不會將具有相同組ID的項組合在一起。
基本上,我能夠得到沒有functoid的是這樣的:
<MyRequests>
<Request>
<Item ID="1" Property="Something" />
</Request>
<Request>
<Item ID="2" Property="Something" />
</Request>
<Request GroupID="1">
<Item ID="3" Property="Something" />
</Request>
<Request GroupID="1">
<Item ID="4" Property="Something" />
</Request>
<Request GroupID="2">
<Item ID="5" Property="Something" />
</Request>
<Request GroupID="2">
<Item ID="6" Property="Something" />
</Request>
</MyRequests>
您顯示的輸入不是XML文檔,而是XML片段,因此XSLT將無法解析它。它需要包裝在一個頂層元素中。 – LarsH
P.S.你在使用XSLT 1.0還是2.0?在2.0中,分組問題的答案通常要容易得多。 – LarsH
更新了原始XML以顯示原始文檔的更接近的表示。由於我公司的「衛生處理」規則,只提前張貼了片段。 – SpaceCowboy74