0
我想從SSRS報告創建一個xml文件。來自SSRS報告的XSLT轉換 - 組結果
我有以下問題:
<xsl:template match="AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events[Invalid_Reason_Formated='Emergency Record: will be removed from waitlist'] |
AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events[Invalid_Reason_Formated='Entry Error: will be removed from waitlist'] |
AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events[Invalid_Reason_Formated='Entry Error or Emergency Record: will be removed from waitlist']">
<AWL_KeyDel_Events>
<xsl:apply-templates/>
</AWL_KeyDel_Events>
</xsl:template>
我對這個輸出是(我的樣品有符合上述標準的2條記錄):
<AWL_KeyDel_Events>
<Event_Key>101</Event_Key>
<Event_Key>102</Event_Key>
<Event_Key>103</Event_Key>
</AWL_KeyDel_Events>
<AWL_KeyDel_Events>
<Event_Key>99</Event_Key>
<Event_Key>100</Event_Key>
</AWL_KeyDel_Events>
,我想它顯示爲(記錄的順序並不重要):
<AWL_KeyDel_Events>
<Event_Key>101</Event_Key>
<Event_Key>102</Event_Key>
<Event_Key>103</Event_Key>
<Event_Key>99</Event_Key>
<Event_Key>100</Event_Key>
</AWL_KeyDel_Events>
有沒有辦法我可以做到這一點?
編輯:這是源XML文件:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output method="xml" indent="yes" encoding="ascii" standalone="no" media-type="text/plain" omit-xml-declaration="yes"/>
<xsl:output
doctype-system="http://portal2.albertawellnet.org/dtd/waitlist/KeyModeSurgicalEvent.dtd"
doctype-public="-//AHW//DTD WAITLIST 1.0//EN"></xsl:output>
<xsl:template match="*">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="/">
<AWL_Document>
<AWL_Header>
<Facility_Code>
<xsl:value-of select="//FacilityIdentifier" />
</Facility_Code>
<Service_Type>S</Service_Type>
<File_Name>
<xsl:value-of select="//SubmissionFileName"/>
</File_Name>
<Create_Timestamp>
<xsl:value-of select="//CurrentDate" />
</Create_Timestamp>
</AWL_Header>
<AWL_Waitlist_Events>
<xsl:apply-templates/>
</AWL_Waitlist_Events>
<AWL_Footer>
<Total_Waitlist_Count>
<xsl:value-of select="count(//AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events/Detail_Collection/Detail[Invalid_Reason=''] |
//AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events/Detail_Collection/Detail[Invalid_Reason='Emergency Deletes'] |
//AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events/Detail_Collection/Detail[Invalid_Reason='Deletes'] |
//AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events/Detail_Collection/Detail[Invalid_Reason='entry error'])"/>
</Total_Waitlist_Count>
<KeySub_Waitlist_Count>
<xsl:value-of select="count(//AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events/Detail_Collection/Detail[Invalid_Reason=''])"/>
</KeySub_Waitlist_Count>
<KeyDel_Waitlist_Count>
<xsl:value-of select="count(//AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events/Detail_Collection/Detail[Invalid_Reason='Emergency Deletes'] |
//AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events/Detail_Collection/Detail[Invalid_Reason='Deletes'] |
//AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events/Detail_Collection/Detail[Invalid_Reason='entry error'])"/>
</KeyDel_Waitlist_Count>
</AWL_Footer>
</AWL_Document>
</xsl:template>
<xsl:template match="AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events">
</xsl:template>
<xsl:template match="AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events[Invalid_Reason_Formated='Valid records to be sent']">
<AWL_KeySub_Events>
<xsl:apply-templates/>
</AWL_KeySub_Events>
</xsl:template>
<xsl:template match="AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events[Invalid_Reason_Formated='Emergency Record: will be removed from waitlist'] |
AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events[Invalid_Reason_Formated='Entry Error: will be removed from waitlist'] |
AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events[Invalid_Reason_Formated='Entry Error or Emergency Record: will be removed from waitlist']
">
<AWL_KeyDel_Events>
<xsl:apply-templates/>
</AWL_KeyDel_Events>
</xsl:template>
<xsl:template match="AWL_Document/AWL_KeySub_Events_Collection/AWL_KeySub_Events/Detail_Collection/Detail">
<Waitlist_Event>
<Event_Key>
<xsl:value-of select="Facility_Event_Key"/>
</Event_Key>
<ULI>
<xsl:value-of select="ULI"/>
</ULI>
<Gender>
<xsl:value-of select="Gender"/>
</Gender>
<Birth_Date>
<xsl:value-of select="Birth_Date"/>
</Birth_Date>
<Section_Code>
<xsl:value-of select="Section_Code"/>
</Section_Code>
<Group_Code_1>
<xsl:value-of select="Group_Code_1"/>
</Group_Code_1>
<Group_Code_2>
<xsl:value-of select="Group_Code_2"/>
</Group_Code_2>
</Waitlist_Event>
</xsl:template>
,這裏是預期輸出:
<AWL_Document>
<AWL_Header>
<Facility_Code>001</Facility_Code>
<Service_Type>S</Service_Type>
<File_Name>FileName.xml</File_Name>
<Create_Timestamp>201102140143</Create_Timestamp>
</AWL_Header>
<AWL_Waitlist_Events>
<AWL_KeySub_Events>
<Waitlist_Event>
<Event_Key>107</Event_Key>
<ULI>000000000</ULI>
<Gender>F</Gender>
<Birth_Date>20000101</Birth_Date>
<Section_Code>1</Section_Code>
<Group_Code_1>Y</Group_Code_1>
<Group_Code_2>^</Group_Code_2>
</Waitlist_Event>
</AWL_KeySub_Events>
<AWL_KeyDel_Events>
<Waitlist_Event>
<Event_Key>101</Event_Key>
<ULI>000000000</ULI>
<Gender>F</Gender>
<Birth_Date>19700101</Birth_Date>
<Section_Code>1</Section_Code>
<Group_Code_1>Y</Group_Code_1>
<Group_Code_2>^</Group_Code_2>
</Waitlist_Event>
<Waitlist_Event>
<Event_Key>99</Event_Key>
<ULI>000000000</ULI>
<Gender>F</Gender>
<Birth_Date>19700202</Birth_Date>
<Section_Code>1</Section_Code>
<Group_Code_1>Y</Group_Code_1>
<Group_Code_2>^</Group_Code_2>
</Waitlist_Event>
<Waitlist_Event>
<Event_Key>102</Event_Key>
<ULI>000000000</ULI>
<Gender>F</Gender>
<Birth_Date>19800101</Birth_Date>
<Section_Code>1</Section_Code>
<Group_Code_1>Y</Group_Code_1>
<Group_Code_2>^</Group_Code_2>
</Waitlist_Event>
</AWL_KeyDel_Events>
</AWL_Waitlist_Events>
<AWL_Footer>
<Total_Waitlist_Count>4</Total_Waitlist_Count>
<KeySub_Waitlist_Count>1</KeySub_Waitlist_Count>
<KeyDel_Waitlist_Count>3</KeyDel_Waitlist_Count>
</AWL_Footer>
</AWL_Document>
可能*有*的方式,尤其是如果您提供源XML文件和想要的結果... – 2011-02-15 03:45:58
-1。沒有源XML,明確downvote。 – Flack 2011-02-15 09:24:34
源文件和要發佈的結果。我希望這能讓問題更清楚。 – VirtualLiz 2011-02-15 16:26:48