2014-05-08 125 views
2

我有这样的XML我从一个REST调用接收到SharePoint网站:XSLT从REST API转换XML

<?xml version="1.0" encoding="UTF-8"?> 
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xml:base="https://XYZ.net/_api/"> 
    <id>95d0968b-bc93-400d-9bd4-14f8a04f7933</id> 
    <title /> 
    <updated>2014-05-08T12:30:49Z</updated> 
    <entry m:etag="&quot;1&quot;"> 
    <id>df1dbe72-22e1-45af-9290-1c6571696169</id> 
    <category term="SP.Data.XYZABCBudgetLinesListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> 
    <link rel="edit" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FirstUniqueAncestorSecurableObject" type="application/atom+xml;type=entry" title="FirstUniqueAncestorSecurableObject" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)/FirstUniqueAncestorSecurableObject" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RoleAssignments" type="application/atom+xml;type=feed" title="RoleAssignments" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)/RoleAssignments" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AttachmentFiles" type="application/atom+xml;type=feed" title="AttachmentFiles" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)/AttachmentFiles" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContentType" type="application/atom+xml;type=entry" title="ContentType" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)/ContentType" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsHtml" type="application/atom+xml;type=entry" title="FieldValuesAsHtml" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)/FieldValuesAsHtml" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsText" type="application/atom+xml;type=entry" title="FieldValuesAsText" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)/FieldValuesAsText" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesForEdit" type="application/atom+xml;type=entry" title="FieldValuesForEdit" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)/FieldValuesForEdit" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/File" type="application/atom+xml;type=entry" title="File" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)/File" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folder" type="application/atom+xml;type=entry" title="Folder" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)/Folder" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentList" type="application/atom+xml;type=entry" title="ParentList" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(2)/ParentList" /> 
    <title /> 
    <updated>2014-05-08T12:30:49Z</updated> 
    <author> 
     <name /> 
    </author> 
    <content type="application/xml"> 
     <m:properties> 
     <d:FileSystemObjectType m:type="Edm.Int32">0</d:FileSystemObjectType> 
     <d:Id m:type="Edm.Int32">2</d:Id> 
     <d:ContentTypeId>0x009BF34D7FE1615746BB818211276E2E75</d:ContentTypeId> 
     <d:XYZBudgetLinesIDInXYZABCBudgetLines m:type="Edm.Int32">13154</d:XYZBudgetLinesIDInXYZABCBudgetLines> 
     <d:XYZIDInXYZABCBudgetLinesId m:type="Edm.Int32">4041</d:XYZIDInXYZABCBudgetLinesId> 
     <d:XYZABCIDInXYZABCBudgetLinesId m:type="Edm.Int32">3</d:XYZABCIDInXYZABCBudgetLinesId> 
     <d:ABCIsFromActivatedPAL m:type="Edm.Boolean">false</d:ABCIsFromActivatedPAL> 
     <d:ABCBudgetCode>16;9030172;10703</d:ABCBudgetCode> 
     <d:ABCBudgetDonorReportCodeLineNumber m:type="Edm.Double">1</d:ABCBudgetDonorReportCodeLineNumber> 
     <d:ABCBudgetLineDescription>Thematic - Partner Costs</d:ABCBudgetLineDescription> 
     <d:ABCTotalEstimatedAmount m:null="true" /> 
     <d:ABCTotalEstimatedAmountToFundingOffice m:type="Edm.Double">0</d:ABCTotalEstimatedAmountToFundingOffice> 
     <d:ABCTotalEstimatedAmountToAllImplementingOffices m:null="true" /> 
     <d:ABCTotalCommittedAmount m:null="true" /> 
     <d:ABCTotalCommittedAmountToFundingOffice m:type="Edm.Double">0</d:ABCTotalCommittedAmountToFundingOffice> 
     <d:ABCTotalCommittedAmountToAllImplementingOffices m:null="true" /> 
     <d:ID m:type="Edm.Int32">2</d:ID> 
     <d:Modified m:type="Edm.DateTime">2014-02-17T12:59:08Z</d:Modified> 
     <d:Created m:type="Edm.DateTime">2014-02-17T12:59:08Z</d:Created> 
     <d:AuthorId m:type="Edm.Int32">1028</d:AuthorId> 
     <d:EditorId m:type="Edm.Int32">1028</d:EditorId> 
     <d:OData__UIVersionString>1.0</d:OData__UIVersionString> 
     <d:Attachments m:type="Edm.Boolean">false</d:Attachments> 
     <d:GUID m:type="Edm.Guid">e5794096-6fc2-48f1-8c8f-0d2fd5244b14</d:GUID> 
     </m:properties> 
    </content> 
    </entry> 
    <entry m:etag="&quot;1&quot;"> 
    <id>ad8cb0b2-6a8b-4dff-8da4-623527d1034a</id> 
    <category term="SP.Data.XYZABCBudgetLinesListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> 
    <link rel="edit" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FirstUniqueAncestorSecurableObject" type="application/atom+xml;type=entry" title="FirstUniqueAncestorSecurableObject" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)/FirstUniqueAncestorSecurableObject" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RoleAssignments" type="application/atom+xml;type=feed" title="RoleAssignments" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)/RoleAssignments" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AttachmentFiles" type="application/atom+xml;type=feed" title="AttachmentFiles" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)/AttachmentFiles" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContentType" type="application/atom+xml;type=entry" title="ContentType" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)/ContentType" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsHtml" type="application/atom+xml;type=entry" title="FieldValuesAsHtml" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)/FieldValuesAsHtml" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsText" type="application/atom+xml;type=entry" title="FieldValuesAsText" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)/FieldValuesAsText" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesForEdit" type="application/atom+xml;type=entry" title="FieldValuesForEdit" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)/FieldValuesForEdit" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/File" type="application/atom+xml;type=entry" title="File" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)/File" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folder" type="application/atom+xml;type=entry" title="Folder" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)/Folder" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentList" type="application/atom+xml;type=entry" title="ParentList" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(3)/ParentList" /> 
    <title /> 
    <updated>2014-05-08T12:30:49Z</updated> 
    <author> 
     <name /> 
    </author> 
    <content type="application/xml"> 
     <m:properties> 
     <d:FileSystemObjectType m:type="Edm.Int32">0</d:FileSystemObjectType> 
     <d:Id m:type="Edm.Int32">3</d:Id> 
     <d:ContentTypeId>0x009BF34D7FE1615746BB818211276E2E75</d:ContentTypeId> 
     <d:XYZBudgetLinesIDInXYZABCBudgetLines m:type="Edm.Int32">13155</d:XYZBudgetLinesIDInXYZABCBudgetLines> 
     <d:XYZIDInXYZABCBudgetLinesId m:type="Edm.Int32">4041</d:XYZIDInXYZABCBudgetLinesId> 
     <d:XYZABCIDInXYZABCBudgetLinesId m:type="Edm.Int32">3</d:XYZABCIDInXYZABCBudgetLinesId> 
     <d:ABCIsFromActivatedPAL m:type="Edm.Boolean">false</d:ABCIsFromActivatedPAL> 
     <d:ABCBudgetCode>16;9030172;10704</d:ABCBudgetCode> 
     <d:ABCBudgetDonorReportCodeLineNumber m:type="Edm.Double">2</d:ABCBudgetDonorReportCodeLineNumber> 
     <d:ABCBudgetLineDescription>Thematic - Direct Implementation</d:ABCBudgetLineDescription> 
     <d:ABCTotalEstimatedAmount m:null="true" /> 
     <d:ABCTotalEstimatedAmountToFundingOffice m:type="Edm.Double">0</d:ABCTotalEstimatedAmountToFundingOffice> 
     <d:ABCTotalEstimatedAmountToAllImplementingOffices m:null="true" /> 
     <d:ABCTotalCommittedAmount m:null="true" /> 
     <d:ABCTotalCommittedAmountToFundingOffice m:type="Edm.Double">0</d:ABCTotalCommittedAmountToFundingOffice> 
     <d:ABCTotalCommittedAmountToAllImplementingOffices m:null="true" /> 
     <d:ID m:type="Edm.Int32">3</d:ID> 
     <d:Modified m:type="Edm.DateTime">2014-02-17T12:59:08Z</d:Modified> 
     <d:Created m:type="Edm.DateTime">2014-02-17T12:59:08Z</d:Created> 
     <d:AuthorId m:type="Edm.Int32">1028</d:AuthorId> 
     <d:EditorId m:type="Edm.Int32">1028</d:EditorId> 
     <d:OData__UIVersionString>1.0</d:OData__UIVersionString> 
     <d:Attachments m:type="Edm.Boolean">false</d:Attachments> 
     <d:GUID m:type="Edm.Guid">ca568284-a65b-4081-85e5-5c783a51d4f5</d:GUID> 
     </m:properties> 
    </content> 
    </entry> 
    <entry m:etag="&quot;1&quot;"> 
    <id>f00d3036-ed85-49fd-8838-a20b0eaf7026</id> 
    <category term="SP.Data.XYZABCBudgetLinesListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> 
    <link rel="edit" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FirstUniqueAncestorSecurableObject" type="application/atom+xml;type=entry" title="FirstUniqueAncestorSecurableObject" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)/FirstUniqueAncestorSecurableObject" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RoleAssignments" type="application/atom+xml;type=feed" title="RoleAssignments" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)/RoleAssignments" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AttachmentFiles" type="application/atom+xml;type=feed" title="AttachmentFiles" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)/AttachmentFiles" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContentType" type="application/atom+xml;type=entry" title="ContentType" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)/ContentType" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsHtml" type="application/atom+xml;type=entry" title="FieldValuesAsHtml" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)/FieldValuesAsHtml" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsText" type="application/atom+xml;type=entry" title="FieldValuesAsText" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)/FieldValuesAsText" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesForEdit" type="application/atom+xml;type=entry" title="FieldValuesForEdit" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)/FieldValuesForEdit" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/File" type="application/atom+xml;type=entry" title="File" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)/File" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folder" type="application/atom+xml;type=entry" title="Folder" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)/Folder" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentList" type="application/atom+xml;type=entry" title="ParentList" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(4)/ParentList" /> 
    <title /> 
    <updated>2014-05-08T12:30:49Z</updated> 
    <author> 
     <name /> 
    </author> 
    <content type="application/xml"> 
     <m:properties> 
     <d:FileSystemObjectType m:type="Edm.Int32">0</d:FileSystemObjectType> 
     <d:Id m:type="Edm.Int32">4</d:Id> 
     <d:ContentTypeId>0x009BF34D7FE1615746BB818211276E2E75</d:ContentTypeId> 
     <d:XYZBudgetLinesIDInXYZABCBudgetLines m:type="Edm.Int32">13156</d:XYZBudgetLinesIDInXYZABCBudgetLines> 
     <d:XYZIDInXYZABCBudgetLinesId m:type="Edm.Int32">4041</d:XYZIDInXYZABCBudgetLinesId> 
     <d:XYZABCIDInXYZABCBudgetLinesId m:type="Edm.Int32">3</d:XYZABCIDInXYZABCBudgetLinesId> 
     <d:ABCIsFromActivatedPAL m:type="Edm.Boolean">false</d:ABCIsFromActivatedPAL> 
     <d:ABCBudgetCode>16;9030172;10705</d:ABCBudgetCode> 
     <d:ABCBudgetDonorReportCodeLineNumber m:type="Edm.Double">3</d:ABCBudgetDonorReportCodeLineNumber> 
     <d:ABCBudgetLineDescription>Thematic - Partner Capacity Building</d:ABCBudgetLineDescription> 
     <d:ABCTotalEstimatedAmount m:null="true" /> 
     <d:ABCTotalEstimatedAmountToFundingOffice m:type="Edm.Double">0</d:ABCTotalEstimatedAmountToFundingOffice> 
     <d:ABCTotalEstimatedAmountToAllImplementingOffices m:null="true" /> 
     <d:ABCTotalCommittedAmount m:null="true" /> 
     <d:ABCTotalCommittedAmountToFundingOffice m:type="Edm.Double">0</d:ABCTotalCommittedAmountToFundingOffice> 
     <d:ABCTotalCommittedAmountToAllImplementingOffices m:null="true" /> 
     <d:ID m:type="Edm.Int32">4</d:ID> 
     <d:Modified m:type="Edm.DateTime">2014-02-17T12:59:08Z</d:Modified> 
     <d:Created m:type="Edm.DateTime">2014-02-17T12:59:08Z</d:Created> 
     <d:AuthorId m:type="Edm.Int32">1028</d:AuthorId> 
     <d:EditorId m:type="Edm.Int32">1028</d:EditorId> 
     <d:OData__UIVersionString>1.0</d:OData__UIVersionString> 
     <d:Attachments m:type="Edm.Boolean">false</d:Attachments> 
     <d:GUID m:type="Edm.Guid">afc2ed93-d36c-49d8-912e-8af3bac351af</d:GUID> 
     </m:properties> 
    </content> 
    </entry> 
    <entry m:etag="&quot;1&quot;"> 
    <id>365f7548-ba26-4363-b6a2-de7ee4bba2d4</id> 
    <category term="SP.Data.XYZABCBudgetLinesListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> 
    <link rel="edit" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FirstUniqueAncestorSecurableObject" type="application/atom+xml;type=entry" title="FirstUniqueAncestorSecurableObject" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)/FirstUniqueAncestorSecurableObject" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RoleAssignments" type="application/atom+xml;type=feed" title="RoleAssignments" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)/RoleAssignments" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AttachmentFiles" type="application/atom+xml;type=feed" title="AttachmentFiles" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)/AttachmentFiles" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContentType" type="application/atom+xml;type=entry" title="ContentType" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)/ContentType" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsHtml" type="application/atom+xml;type=entry" title="FieldValuesAsHtml" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)/FieldValuesAsHtml" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsText" type="application/atom+xml;type=entry" title="FieldValuesAsText" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)/FieldValuesAsText" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesForEdit" type="application/atom+xml;type=entry" title="FieldValuesForEdit" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)/FieldValuesForEdit" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/File" type="application/atom+xml;type=entry" title="File" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)/File" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folder" type="application/atom+xml;type=entry" title="Folder" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)/Folder" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentList" type="application/atom+xml;type=entry" title="ParentList" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(5)/ParentList" /> 
    <title /> 
    <updated>2014-05-08T12:30:49Z</updated> 
    <author> 
     <name /> 
    </author> 
    <content type="application/xml"> 
     <m:properties> 
     <d:FileSystemObjectType m:type="Edm.Int32">0</d:FileSystemObjectType> 
     <d:Id m:type="Edm.Int32">5</d:Id> 
     <d:ContentTypeId>0x009BF34D7FE1615746BB818211276E2E75</d:ContentTypeId> 
     <d:XYZBudgetLinesIDInXYZABCBudgetLines m:type="Edm.Int32">13157</d:XYZBudgetLinesIDInXYZABCBudgetLines> 
     <d:XYZIDInXYZABCBudgetLinesId m:type="Edm.Int32">4041</d:XYZIDInXYZABCBudgetLinesId> 
     <d:XYZABCIDInXYZABCBudgetLinesId m:type="Edm.Int32">3</d:XYZABCIDInXYZABCBudgetLinesId> 
     <d:ABCIsFromActivatedPAL m:type="Edm.Boolean">false</d:ABCIsFromActivatedPAL> 
     <d:ABCBudgetCode>17;9030173;10703</d:ABCBudgetCode> 
     <d:ABCBudgetDonorReportCodeLineNumber m:type="Edm.Double">4</d:ABCBudgetDonorReportCodeLineNumber> 
     <d:ABCBudgetLineDescription>Thematic - Partner Costs</d:ABCBudgetLineDescription> 
     <d:ABCTotalEstimatedAmount m:null="true" /> 
     <d:ABCTotalEstimatedAmountToFundingOffice m:type="Edm.Double">0</d:ABCTotalEstimatedAmountToFundingOffice> 
     <d:ABCTotalEstimatedAmountToAllImplementingOffices m:null="true" /> 
     <d:ABCTotalCommittedAmount m:null="true" /> 
     <d:ABCTotalCommittedAmountToFundingOffice m:type="Edm.Double">0</d:ABCTotalCommittedAmountToFundingOffice> 
     <d:ABCTotalCommittedAmountToAllImplementingOffices m:null="true" /> 
     <d:ID m:type="Edm.Int32">5</d:ID> 
     <d:Modified m:type="Edm.DateTime">2014-02-17T12:59:08Z</d:Modified> 
     <d:Created m:type="Edm.DateTime">2014-02-17T12:59:08Z</d:Created> 
     <d:AuthorId m:type="Edm.Int32">1028</d:AuthorId> 
     <d:EditorId m:type="Edm.Int32">1028</d:EditorId> 
     <d:OData__UIVersionString>1.0</d:OData__UIVersionString> 
     <d:Attachments m:type="Edm.Boolean">false</d:Attachments> 
     <d:GUID m:type="Edm.Guid">19206a69-1850-4e97-8103-f3f00c21911a</d:GUID> 
     </m:properties> 
    </content> 
    </entry> 
    <entry m:etag="&quot;1&quot;"> 
    <id>8ed0cc40-8623-4856-bb47-a2d97fdaa3c2</id> 
    <category term="SP.Data.XYZABCBudgetLinesListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> 
    <link rel="edit" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FirstUniqueAncestorSecurableObject" type="application/atom+xml;type=entry" title="FirstUniqueAncestorSecurableObject" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)/FirstUniqueAncestorSecurableObject" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RoleAssignments" type="application/atom+xml;type=feed" title="RoleAssignments" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)/RoleAssignments" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AttachmentFiles" type="application/atom+xml;type=feed" title="AttachmentFiles" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)/AttachmentFiles" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContentType" type="application/atom+xml;type=entry" title="ContentType" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)/ContentType" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsHtml" type="application/atom+xml;type=entry" title="FieldValuesAsHtml" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)/FieldValuesAsHtml" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsText" type="application/atom+xml;type=entry" title="FieldValuesAsText" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)/FieldValuesAsText" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesForEdit" type="application/atom+xml;type=entry" title="FieldValuesForEdit" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)/FieldValuesForEdit" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/File" type="application/atom+xml;type=entry" title="File" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)/File" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folder" type="application/atom+xml;type=entry" title="Folder" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)/Folder" /> 
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentList" type="application/atom+xml;type=entry" title="ParentList" href="Web/Lists(guid'7f4df39b-61e1-4657-bb81-8211276e2e75')/Items(6)/ParentList" /> 
    <title /> 
    <updated>2014-05-08T12:30:49Z</updated> 
    <author> 
     <name /> 
    </author> 
    <content type="application/xml"> 
     <m:properties> 
     <d:FileSystemObjectType m:type="Edm.Int32">0</d:FileSystemObjectType> 
     <d:Id m:type="Edm.Int32">6</d:Id> 
     <d:ContentTypeId>0x009BF34D7FE1615746BB818211276E2E75</d:ContentTypeId> 
     <d:XYZBudgetLinesIDInXYZABCBudgetLines m:type="Edm.Int32">13158</d:XYZBudgetLinesIDInXYZABCBudgetLines> 
     <d:XYZIDInXYZABCBudgetLinesId m:type="Edm.Int32">4041</d:XYZIDInXYZABCBudgetLinesId> 
     <d:XYZABCIDInXYZABCBudgetLinesId m:type="Edm.Int32">3</d:XYZABCIDInXYZABCBudgetLinesId> 
     <d:ABCIsFromActivatedPAL m:type="Edm.Boolean">false</d:ABCIsFromActivatedPAL> 
     <d:ABCBudgetCode>17;9030173;10704</d:ABCBudgetCode> 
     <d:ABCBudgetDonorReportCodeLineNumber m:type="Edm.Double">5</d:ABCBudgetDonorReportCodeLineNumber> 
     <d:ABCBudgetLineDescription>Thematic - Direct Implementation</d:ABCBudgetLineDescription> 
     <d:ABCTotalEstimatedAmount m:null="true" /> 
     <d:ABCTotalEstimatedAmountToFundingOffice m:type="Edm.Double">0</d:ABCTotalEstimatedAmountToFundingOffice> 
     <d:ABCTotalEstimatedAmountToAllImplementingOffices m:null="true" /> 
     <d:ABCTotalCommittedAmount m:null="true" /> 
     <d:ABCTotalCommittedAmountToFundingOffice m:type="Edm.Double">0</d:ABCTotalCommittedAmountToFundingOffice> 
     <d:ABCTotalCommittedAmountToAllImplementingOffices m:null="true" /> 
     <d:ID m:type="Edm.Int32">6</d:ID> 
     <d:Modified m:type="Edm.DateTime">2014-02-17T12:59:08Z</d:Modified> 
     <d:Created m:type="Edm.DateTime">2014-02-17T12:59:08Z</d:Created> 
     <d:AuthorId m:type="Edm.Int32">1028</d:AuthorId> 
     <d:EditorId m:type="Edm.Int32">1028</d:EditorId> 
     <d:OData__UIVersionString>1.0</d:OData__UIVersionString> 
     <d:Attachments m:type="Edm.Boolean">false</d:Attachments> 
     <d:GUID m:type="Edm.Guid">f3eb8e7c-e6fd-4dde-9bbd-f9b36dd6da4f</d:GUID> 
     </m:properties> 
    </content> 
    </entry> 
    <link rel="next" href="https://XYZ.net/_api/web/lists/getByTitle('XYZ%20ABC%20budget%20lines')/items?%24skiptoken=Paged%3dTRUE%26p_ID%3d6&amp;%24top=5" /> 
</feed> 

有人可以帮助我使用XSLT来获得这样的输出。

<XYZABCBudgetLines> 
    <XYZABCBudgetLinesItem> 
    <ContentTypeID>0x009BF34D7FE1615746BB818211276E2E75</ContentTypeID> 
    <OriginalID>13154</OriginalID> 
    <XYZIDId>4041</XYZIDId> 
    <ABCId>3</ABCId> 
    <IsFromActivatedPAL>false</IsFromActivatedPAL> 
    <Code>16;9030172;10703</Code> 
    <DonorReportCodeLineNumber>1</DonorReportCodeLineNumber> 
    <Description>Thematic - Partner Costs</Description> 
    <EstimatedAmount /> 
    <ToBeSpentByFundingOffice>0</ToBeSpentByFundingOffice> 
    <AmountToImplementingOfficeS /> 
    <CommittedAmount /> 
    <ToBeSpentByFundingOffice0>0</ToBeSpentByFundingOffice0> 
    <AmountToImplementingOfficeS0 /> 
    <Id>2</Id> 
    <ContentType>XYZ ABC budget lines</ContentType> 
    <Modified>2014-02-17T12:59:08</Modified> 
    <Created>2014-02-17T12:59:08</Created> 
    <CreatedById>1028</CreatedById> 
    <ModifiedById>1028</ModifiedById> 
    <Owshiddenversion>1</Owshiddenversion> 
    <Version>1.0</Version> 
    <Path>/Lists/XYZABCBudgetLines</Path> 
    </XYZABCBudgetLinesItem> 
    <XYZABCBudgetLinesItem> 
    <ContentTypeID>0x009BF34D7FE1615746BB818211276E2E75</ContentTypeID> 
    <OriginalID>13155</OriginalID> 
    <XYZIDId>4041</XYZIDId> 
    <ABCId>3</ABCId> 
    <IsFromActivatedPAL>false</IsFromActivatedPAL> 
    <Code>16;9030172;10704</Code> 
    <DonorReportCodeLineNumber>2</DonorReportCodeLineNumber> 
    <Description>Thematic - Direct Implementation</Description> 
    <EstimatedAmount /> 
    <ToBeSpentByFundingOffice>0</ToBeSpentByFundingOffice> 
    <AmountToImplementingOfficeS /> 
    <CommittedAmount /> 
    <ToBeSpentByFundingOffice0>0</ToBeSpentByFundingOffice0> 
    <AmountToImplementingOfficeS0 /> 
    <Id>3</Id> 
    <ContentType>XYZ ABC budget lines</ContentType> 
    <Modified>2014-02-17T12:59:08</Modified> 
    <Created>2014-02-17T12:59:08</Created> 
    <CreatedById>1028</CreatedById> 
    <ModifiedById>1028</ModifiedById> 
    <Owshiddenversion>1</Owshiddenversion> 
    <Version>1.0</Version> 
    <Path>/Lists/XYZABCBudgetLines</Path> 
    </XYZABCBudgetLinesItem> 
</XYZABCBudgetLines> 

这是我将尝试使用,但犯规改造XSLT

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"> 
<xsl:output method="xml" version="1.0" encoding="UTF-8" /> 
<xsl:template match="feed"> 
    <xsl:if test="link[@rel='self']/@title"> 
     <xsl:element name="{link[@rel='self']/@title}"> 
      <xsl:apply-templates select="entry"/> 
     </xsl:element> 
    </xsl:if> 
</xsl:template> 
<xsl:template match="entry"> 
    <xsl:if test="link[@rel='edit']/@title"> 
     <xsl:element name="{link[@rel='edit']/@title}"> 
      <xsl:for-each select="content/m:properties/*"> 
       <xsl:element name="{local-name()}"> 
        <xsl:value-of select="."/> 
       </xsl:element> 
      </xsl:for-each> 
      <xsl:apply-templates select="link[@rel!='edit']"/> 
     </xsl:element> 
    </xsl:if> 
</xsl:template> 
<xsl:template match="link[@rel!='edit']"> 
    <xsl:apply-templates select="m:inline/entry" /> 
</xsl:template> 

jdshfgsjdhfskdjfkjdfhlkajdflaksjdflaksdgaljhscbl

+3

当然,我们可以试着帮你。请发布您想要帮助的XSLT代码。 – Tomalak

+0

Microsoft数据服务返回AFAIK oDATA数据。所以你可能会更好地使用Java或dotNet中的oData库,然后从那里写出你的XML。 – stwissel

回答

2

此任务的一个好方法是添加小型的单一用途模板。例如

<OriginalID>13154</OriginalID> 

将由

<xsl:template match="d:XYZBudgetLinesIDInXYZABCBudgetLines"> 
    <OriginalID><xsl:value-of select="." /></OriginalID> 
</xsl:template> 

创建添加的这些模板供您需要每输出一个元素。

现在你需要做的就是创建一个处理输入个人​​元素一个模板

<xsl:template match="atom:entry"> 
    <XYZABCBudgetLinesItem> 
    <xsl:apply-templates select="atom:content/m:properties/*" /> 
    </XYZABCBudgetLinesItem> 
</xsl:template> 

注:您需要声明的原子命名空间前缀在XSLT(xmlns:atom="http://www.w3.org/2005/Atom")或该模板不会匹配任何内容。作为交换,您可以删除该默认名称空间(xmlns="http://www.w3.org/2005/Atom"),因为您对为输出创建​​元素并不感兴趣。

<xsl:apply-templates select="atom:content/m:properties/*" />将处理<entry>的元数据属性,正确执行您创建的所有这些小型单一用途模板。

最后应该是作为一个起点,一个模板:

<xsl:template match="/atom:feed"> 
    <XYZABCBudgetLines> 
    <xsl:apply-templates select="atom:entry" /> 
    </XYZABCBudgetLines> 
</xsl:template> 

最后但并非最不重要,你应该添加一个通用空的模板赶上没有分配任何特定模板的所有元素:

<xsl:template match="*" /> 

这样你就可以抑制你不想在输出中看到的节点。


下面将让您一开始,您可以通过添加更多的模板自己完成它:

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet 
    version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:atom="http://www.w3.org/2005/Atom" 
    xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" 
    xmlns:georss="http://www.georss.org/georss" 
    xmlns:gml="http://www.opengis.net/gml" 
    xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" 
    xml:base="https://XYZ.net/_api/" 
    exclude-result-prefixes="atom m d gml georss" 
> 
    <xsl:template match="/atom:feed"> 
     <XYZABCBudgetLines> 
     <xsl:apply-templates select="atom:entry" /> 
     </XYZABCBudgetLines> 
    </xsl:template> 

    <xsl:template match="atom:entry"> 
     <XYZABCBudgetLinesItem> 
     <xsl:apply-templates select="atom:content/m:properties/*" /> 
     </XYZABCBudgetLinesItem> 
    </xsl:template> 

    <xsl:template match="d:XYZBudgetLinesIDInXYZABCBudgetLines"> 
     <OriginalID><xsl:value-of select="." /></OriginalID> 
    </xsl:template> 

    <xsl:template match="*" /> 
</xsl:stylesheet> 

将输出

<XYZABCBudgetLines> 
    <XYZABCBudgetLinesItem> 
    <OriginalID>13154</OriginalID> 
    </XYZABCBudgetLinesItem> 
    <XYZABCBudgetLinesItem> 
    <OriginalID>13155</OriginalID> 
    </XYZABCBudgetLinesItem> 
    <XYZABCBudgetLinesItem> 
    <OriginalID>13156</OriginalID> 
    </XYZABCBudgetLinesItem> 
    <XYZABCBudgetLinesItem> 
    <OriginalID>13157</OriginalID> 
    </XYZABCBudgetLinesItem> 
    <XYZABCBudgetLinesItem> 
    <OriginalID>13158</OriginalID> 
    </XYZABCBudgetLinesItem> 
</XYZABCBudgetLines> 
0

我不知道,但你可以尝试这样的:

<xsl:for-each select="entry/content/m:properties"> 
    <xsl:value-of select="d:ContentTypeId"/> 
    <xsl:value-of select="d:XYZBudgetLinesIDInXYZABCBudgetLines "/> 
    ... 
</xsl:for-each>