Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3956992
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:26:04+00:00 2026-05-20T02:26:04+00:00

I am trying to create an xml file from a SSRS report. I am

  • 0

I am trying to create an xml file from a SSRS report.

I am having a problem with the following:

<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>

My output for this is(my sample has records that meet 2 of the criteria above):

<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>

And i would like it to display as(order of records is not important):

<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>

Is there a way that i can do this?

Edit: Here is the source XML file:

<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>

And here is the expected output:

<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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:26:05+00:00Added an answer on May 20, 2026 at 2:26 am

    I think you need:

    <xsl:template match="AWL_KeySub_Events"/>
    <xsl:template match="AWL_KeySub_Events[
                            Invalid_Reason_Formated[
                               .='Valid records to be sent'
                               or
                               contains(.,'will be removed from waitlist')
                            ]
                         ][1]">
        <AWL_KeySub_Events>
             <xsl:apply-templates
                  select="../AWL_KeySub_Events[
                             Invalid_Reason_Formated[
                                .='Valid records to be sent'
                                or
                                contains(.,'will be removed from waitlist')
                             ]
                          ]/node()"/>
        </AWL_KeySub_Events>
    </xsl:template>
    

    Note: Matching the first one meeting requeriments and then apply templates to children of the whole group. An empty rule with less priority will match any one else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create an XML file based on data fields from a
I am trying to create an XSD schema file from an existing XML file
I am trying to create java objects from xml file. I am using jaxb(unmarshalling)
I am trying to create a dynamically generated XML file from Java. This is
I am trying to use Python and LXML to create an XML file from
Trying to create a custom component that gets it's layout from an XML file
Im trying to create a HTML table with links from a XML file using
I'm trying create an immutable object and initialise it from xml config file in
I am trying to create hash from xml file Hash.from_xml <<-EOX <user> <id>1</id> <user-name>ryan</user-name>
I am trying to create a new XML file from an exisiting one using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.