有没有办法获取如下所示的XML文件:
<?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>
答案 0 :(得分:1)
听起来像XSLT 2.0 isn't supported in Biztalk,所以这个答案与XSLT 1.0有关。
假设您的XML输入文件格式正确,即包装在单个顶级元素中......
这种分组问题的标准方法是Meunchian分组。例如,请参阅https://stackoverflow.com/a/1929273/423105或https://stackoverflow.com/a/2334224/423105。如果您在应用这些答案时遇到问题,请留下具体问题的评论。