我有一个来自 Lotus Notes DB 的 XML 输出。以下是 XML 结构:
<Exec>
<project id='C000253' type='Approved' >
<DaysInOnHold>39</DaysInOnHold>
<DaysInCompleted>0</DaysInCompleted>
<ProjectComplexity type='1280'>Complex</ProjectComplexity>
<ChangeRequest>
<OnGoingAmt type='768'>-112</OnGoingAmt>
<EAmt type='768'>123</EAmt>
</ChangeRequest>
<ChangeRequest>
<ItemNbr type='768'>2</ItemNbr>
<EAmt type='768'>321</EAmt>
</ChangeRequest>
<IncidentalItem>
<ACost type='768'>0</ACost>
<Billable type='1280'>Billable</Billable>
</IncidentalItem>
<IncidentalItem>
<ACost type='768'>33</ACost>
<Billable type='1280'>Billable</Billable>
</IncidentalItem>
<MaterialItem>
<AQty type='768'>1</AQty>
<ItemNbr type='768'>4</ItemNbr>
</MaterialItem>
<MaterialItem>
<AQty type='768'>0</AQty>
<ItemNbr type='768'>5</ItemNbr>
</MaterialItem>
</project>
<project id='C110011' type='Not Approved'>
...
...
</project>
</Exec>
当我在我的 SSIS 包中加载 XML 源时,它会为每个列名创建一个表,这当然不是很理想。
我想以这样一种方式对其进行转换,使我能够拥有一个项目表、MaterialItem 和 ChangeRequest 表(随后将与单个项目条目相关联。
XSLT 会是一个答案吗?如果是这样,任何帮助将不胜感激。
我想我会添加所需的输出应该是什么(似乎所有类型属性都导致了问题)。所以似乎我需要一个可以摆脱所有属性的转换 - 特别是 type="...."
<Exec>
<project id='C0001111'>
<DaysInOnHold>33</DaysInOnHold>
<DaysInCompleted>0</DaysInCompleted>
<ProjectComplexity>Complex</ProjectComplexity>
<ChangeRequest>
<OnGoingAmt>52</OnGoingAmt>
<EAmt>123</EAmt>
</ChangeRequest>
<ChangeRequest>
<ItemNbr>2</ItemNbr>
<EAmt>321</EAmt>
</ChangeRequest>
<IncidentalItem>
<ACost>0</ACost>
<Billable>Not Billable</Billable>
</IncidentalItem>
<IncidentalItem>
<ACost>33</ACost>
<Billable>Billable</Billable>
</IncidentalItem>
<MaterialItem>
<AQty>1</AQty>
<ItemNbr>4</ItemNbr>
</MaterialItem>
<MaterialItem>
<AQty>0</AQty>
<ItemNbr>5</ItemNbr>
</MaterialItem>
</project>
</Exec>