XML with multiple signature

Hi,
I use J2SE and I try to create a SIGNED XML file. I would know if is possible to generate a xml file with multiple digital signature(i.e. signs of two or more signers).
Any help is appreciated.
Thanks in advance.
Ramengo.

Many thanks to Bhushan Khaladkar fro the answer
The following xsl works.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:inp="http://xmlns.oracle.com/InvoiceIntegrationDemo">
<xsl:template match="/">
<html>
<body>
<table border="1">
<tr bgcolor="#9acd32">
<th>Customer Name</th>
<th>Invoice Number</th>
<th>Invoice Value</th>
<th>Invoice Date</th>
<th>Backoffice System</th>
</tr>
<xsl:for-each select="inp:InvoiceIntegrationDemoProcessResponse/Xxinvoice">
<tr>
<td><xsl:value-of select="customerName"/></td>
<td><xsl:value-of select="invoiceNumber"/></td>
<td><xsl:value-of select="invoiceValue"/></td>
<td><xsl:value-of select="invoiceDate"/></td>
<td>System XX</td> </tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Similar Messages

  • XML with multiple signatures

    Hello,
    I am trying to find examples showing how I could implement multiple signatures from multiple signers within a single XML file. I read textual confirmation that this can be done, but I hanen't found an example of implementation so far.
    I would like to follow a "business-document-approval-along-hierarchy"-like process and produce an XML similar to the following:<NewIdea>
      <ApprovalCTO id="CTO">
        <ApprovalProjMngr id="ProjMngr">
          <ProgrammersIdea id="Programmer">...</ProgrammersIdea>
          <Signature id="Programmer">...</Signature>
        </ApprovalProjMngr>
        <Signature id="ProjMngr">...</Signature>
      </ApprovalCTO>
      <Signature id="CTO">...</Signature>
    </NewIdea>1. Is it possible in general to include multiple signatures in a single XML file?
    2. If yes, is the above a correct and suggested approach? Should I use enveloped or enveloping signature instead? Or is this irrelevant?
    3. If no, can this be done using multiple XML files with references of one into the other?
    4. Do you have any pointers to examples and sample code?
    5. I am using Apache XML Security. I guess since it conforms to the W3C XML-DigSig specification it could work for this case, right?
    Sorry for the many questions. Any suggestions are welcome.
    Thanks in advance.

    1 -- yes.
    2 -- There are no 100% correct and suggested approach. You can skin the cat anyway you want to.
    3 -- N/A
    4 -- Sample code to do what? You've already provided an XML file. If you want Parser codes go to w3schools.com. or Google them.
    5 -- no idea. Beyond my scope of little knowledges. :-)

  • Can't submit form with multiple signatures

    I have a form with multiple signatures. I've enabled Reader Rights. After the first signature signs, the user must save the document. When the document is saved, then the user cannot submit the form to the next signer. Is there a way to change how this is working?
    Thanks,
    MDawn

    MDawn
    Did you design the form with Adobe Designer?  Assuming you did, when you add a signature field, there is a property enabled by default that "Locks all fields" after signing.  A submit button is also considered a field so it will be locked after the first signature is applied.
    You need to either disable this property (I would not recommend this) or create field collections that are assigned to specific signature fields.  A field collection controls which fields are locked by each signature field when signed.
    Regards
    Steve

  • Workflow process with multiple signatures

    Hi,
      I have a form with 3 signatures. Initially, user will fill the form, sign it & submit it. Then it reaches manager with additional fields (comments & signature field). He will enter comments and sign it. Then it goes to HR and he signs it and the final form would go to employee with all the three signatures.
    I tried implementing it this way.
    1. User submits it as PDF.
    2. Export XDP data from inputPDF in process using exportData service.
    3. Use setValue service to change some flags. (this enables Manager fields to show on form)
    4. Merge inputPDF with XDP using importData service.
    5. Reader extend inputPDF document.
    6. Inject FormBridge.
    7. Assign Task (selected use a Document Variable)
    Am I missing something in this process. I'm looking for a sample process who implemented this. This must be a generic requirement and I'm not finding it in any samples.
    I want to upload my lca so that you can check where it went wrong. Please show me the pointers for uploading attachments in forums.
    Any help is highly appreciated.
    Thanks,
    Kris

    Hi Steve,
    Sorry about that.
    Problem - nothing is hapenning when I click submit button on workspace.
    Without switching to XDP, how can we update the flags of xml? Because I have to make the manager fields visible based on flags when form goes to next level.
    I tried this process and the signature is coming well on the form.
    I'm looking for the missing piece. (I have process fields and form bridge on the form).
    Kindly advise if there is a better practice in implementing these kind of scenarios.
    Thanks,
    Kris

  • Form with multiple signatures, each with sigDate, only one date fills

    I have a form with two signature fields, Sig1 and Sig2.  Each sig field has an associated date field Sig1Date and Sig2Date.
    I have a Topaz signature pad, so the form users physically sign the document.
    When the first signature is entered (in either Sig1 or Sig2), the associated date field autofills as expected.
    When the second signature is entered the associiated date remains blank.
    I have other forms from vendors with up to six signature fields, each with dates, where each date fills as the signatures are entered... what am I doing wrong?
    Thank you.

    The problem must be in the way the form is constructed. There must be a JavaScript associated with your signature fields that autofill the date, and perhaps it is working on Sig1 but not on Sig2. If you sign the second signature field first, does its date field get populated? Do you know that other people are able to sign both fields in the same PDF and have both dates populated? I am sceptic about that. IMO this is more a question to the author of the PDF that you are signing.

  • Content based routing and XML with multiple objects

    I have some structure:
    <contracts>
      <contract>
         <department>1</department>
      </contract>
      <contract>
         <department>1</department>
       </contract>
      <contract>
         <department>2</department>
       </contract>
    </contracts>
    I need to route contract to 2 system based on <department> value:
    contracts/department = 1 --> System1
    contracts/department = 2 --> System2
    Will XI split my XML (based on Content Routing rules in ID) into 2 structures (with departmet=1 and department=2 accordingly) ?
    Or I have to perform 1ToN mapping? I don't like it bacause it will be diffucult to monitor hundred of messages.

    Alternatively if you donot like 1:n mapping and BPM.
    Create two message mappings in the IR
    1.Source :<contracts>
    <contract>
    <department>1</department>
    </contract>
    <contract>
    <department>1</department>
    </contract>
    <contract>
    <department>2</department>
    </contract>
    </contracts>
    Target:
    <contracts>
    <contract>
    <department>1</department>
    </contract>
    <contract>
    <department>1</department>
    </contract>
    Basically mapping generates a target structure which has only department 1.
    2.Same like step1 but the mapping should generate the XML with department = 2.
    Once requires steps are done in the ID , do the content based routing in the reciever determination and give the appropraite message mapping in the interface determination.
    That should your problem and also you will like doing it as it does not involve any split level mapping..:)

  • Generate Query in PLSQL to return Well Formed XML with Multiple records

    Hi there
    This is very urgent. I am trying to create a PLSQL query that should retrieve all records from oracle database table "tbl_Emp" in a well formed xml format. The format is given below
    *<Employees xmlns="http://App.Schemas.Employees" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">*
    *<Employee>*
    *<First_Name></First_Name>*
    *<Last_Name></Last_Name>*
    *</Employee>*
    *<Employee>*
    *<First_Name></First_Name>*
    *<Last_Name></Last_Name>*
    *</Employee>*
    *</Employees>*
    To retrieve data in above format, I have been trying to create a query for long time as below
    SELECT XMLElement("Employees",
    XMLAttributes('http://App.Schemas.Employees' AS "xmlns",
    *'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"),*
    XMLElement("Employee", XMLForest(First_Name, Last_Name)))
    AS "RESULT"
    FROM tbl_Emp;
    But it does not give me the required output. It creates <Employees> tag with each individual record which I don't need. I need <Employees> tag to be the root tag and <Employee> tag to repeat and wrap each individual record. Please help me in this as this is very urgent. Thanks.

    Hi,
    Please remember that nothing is "urgent" here, and repeating that it is will likely produce the opposite effect.
    If you need a quick answer, provide all necessary details in the first place :
    - db version
    - test case with sample data and DDL
    That being said, this one's easy, you have to aggregate using XMLAgg :
    SELECT XMLElement("Employees"
           , XMLAttributes(
               'http://App.Schemas.Employees' AS "xmlns"
             , 'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"
           , XMLAgg(
               XMLElement("Employee"
               , XMLForest(
                   e.first_name as "First_Name"
                 , e.last_name  as "Last_Name"
           ) AS "RESULT"
    FROM hr.employees e
    ;

  • Submit a form through email with multiple signatures

    I have a form, where a number of people can digitally sign the form and email it to the next person. Designed in LiveCycle, with javascript and reader extended.
    On the first sign and email, everything works great. However when the next person gets the form signs it and tries to email it, the body and subject is replaced by:
    The attached file contains data that was entered into a form. It is not the form itself.
    The recipient of this data file should save it locally with a unique name. Adobe Acrobat Professional 7 or later can process this data by importing it back into the blank form or creating a spreadsheet from several data files. See Help in Adobe Acrobat Professional 7 or later for more details.
    Whats all the hocus pocus?
    edit: Something I noticed is that, with some digital signatures, I disable a good majority of the form to read only "lock fields", then when I email I get the above text replaced in the body of the email.

    I have a form, where a number of people can digitally sign the form and email it to the next person. Designed in LiveCycle, with javascript and reader extended.
    On the first sign and email, everything works great. However when the next person gets the form signs it and tries to email it, the body and subject is replaced by:
    The attached file contains data that was entered into a form. It is not the form itself.
    The recipient of this data file should save it locally with a unique name. Adobe Acrobat Professional 7 or later can process this data by importing it back into the blank form or creating a spreadsheet from several data files. See Help in Adobe Acrobat Professional 7 or later for more details.
    Whats all the hocus pocus?
    edit: Something I noticed is that, with some digital signatures, I disable a good majority of the form to read only "lock fields", then when I email I get the above text replaced in the body of the email.

  • Validate XML with multiple XML Sechme in the same namespace

    In my program, i use multiple xml schemas to validate against my xml files.
    However, i found the following code do not work because all schemas in the same namespace.
    Does any one have some solutions to validate multiple XML Schemas in the same namespace?
    Thanks~~
    static final String[] schemas = { partyInformationSchema,
    itemInformationSchema,
    exceptionsSchema,
    salesForecastSchema,
    exceptionCriteriaSchema };
    factory.setAttribute(JAXP_SCHEMA_SOURCE, schemas);

    I have used the Object arrsy too, but it didn't work.
    static final Object[] schemas = { partyInformationSchema,
    itemInformationSchema,
    exceptionsSchema,
    salesForecastSchema,
    exceptionCriteriaSchema };

  • Complex xml with multiple namespaces giving LPX-00601: Invalid token error

    Hi
    Apologies if this is a really simple question.
    I have not worked with xml before and I'm drowning in different ways to do the extract.
    I have a very complex xml, sample below, which I'm trying to do one siple extract to get myself going.
    I have the data in a table in an xmltype column,
    I am trying to extract containernumber first and get the error.
    select xml_column, extract(xml_column,'/env:Envelope/env:Body/ns0:QueryCntrNumberResponse/ns0:QueryResContainerDetail/ns1:ContainerNumber/ns2:ContainerNumber')
    from test_xml;
    Not sure if I should use the namespaces and have tried without but results are always NULL
    I would really appreciate any pointers around these ultiple namespaces.
    Thanks
    Nicki
    XML Sample
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:ns0="http://com.cargosmart.cargotracking.webservice.cntr.dto"
                  xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto"
                  xmlns:ns2="http://com.cargosmart.cargotracking.webservice.basic.dto"
                  xmlns:ns3="http://com.cargosmart.cargotracking.webservice.bl.dto"
                  xmlns:ns4="http://com.cargosmart.cargotracking.webservice.bkg.dto">
      <env:Body>
        <ns0:QueryByCntrNumberResponse>
          <ns0:QueryRes ult="">
            <ns0:QueryCriteria>
              <ns1:CarrierSCACCode>APLU</ns1:CarrierSCACCode>
              <ns1:ContainerNumber>APZU344693-1</ns1:ContainerNumber>
            </ns0:QueryCriteria>
            <ns0:ContainerDetail>
              <ns1:ContainerNumber>
                <ns2:ContainerNumber>APZU344693</ns2:ContainerNumber>
                <ns2:ContainerCheckDigit>1</ns2:ContainerCheckDigit>
                <ns2:GrossWeight>
                  <ns2:Weight>20260.8</ns2:Weight>
                  <ns2:WeightUnit>KGS</ns2:WeightUnit>
                </ns2:GrossWeight>
              </ns1:ContainerNumber>
    NOT THE FULL COLUMN

    Could I just ask you one more question.
    I had already expanded the query to include the repeating sections using xmlsequence.
    Has that been replaced too?
                select extractvalue(xml_column,'/env:Envelope/env:Body/ns0:QueryByCntrNumberResponse/ns0:QueryResult/ns0:ContainerDetail/ns1:ContainerNumber/ns2:ContainerNumber',
                  'xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
                  xmlns:ns0="http://com.cargosmart.cargotracking.webservice.cntr.dto"
                  xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto"
                  xmlns:ns2="http://com.cargosmart.cargotracking.webservice.basic.dto"
                  xmlns:ns3="http://com.cargosmart.cargotracking.webservice.bl.dto"
                  xmlns:ns4="http://com.cargosmart.cargotracking.webservice.bkg.dto"') col1,
                  extractvalue(value(t2),'/ns1:Event/ns1:EventDescription', 'xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto"') Event_Description,
                  extractvalue(value(t2),'/ns1:Event/ns1:EventDT/ns2:LocDT', 'xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto" xmlns:ns2="http://com.cargosmart.cargotracking.webservice.basic.dto"') Event_DT,
                  extractvalue(value(t2),'/ns1:Event/ns1:Location/ns2:LocationName', 'xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto" xmlns:ns2="http://com.cargosmart.cargotracking.webservice.basic.dto"') location
    from test_xml t1,
    table(xmlsequence(extract(t1.xml_column,'/env:Envelope/env:Body/ns0:QueryByCntrNumberResponse/ns0:QueryResult/ns0:ContainerDetail/ns1:Event','xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
                  xmlns:ns0="http://com.cargosmart.cargotracking.webservice.cntr.dto"
                  xmlns:ns1="http://com.cargosmart.cargotracking.webservice.common.dto"
                  xmlns:ns2="http://com.cargosmart.cargotracking.webservice.basic.dto"
                  xmlns:ns3="http://com.cargosmart.cargotracking.webservice.bl.dto"
                  xmlns:ns4="http://com.cargosmart.cargotracking.webservice.bkg.dto"'))) t2;

  • Loading an XML with multiple nested tags

    I've got some problems dealing with loading a nested tags XML file.
    Let's suppose I have such a very simple myxml.xml file:
    <ROWDATA>
    <ROW>
      <EMPNO>7369</EMPNO>
      <ENAME>SMITH</ENAME>
       </ROW>
    <ROW>
      <EMPNO>7902</EMPNO>
      <ENAME>FORD</ENAME>
    </ROW>
    </ROWDATA>
    I can create the following table:
    create table EMP
    empno NUMBER(4) not null,
    ename VARCHAR2(10),
    and then inserting the XML file in this way:
    insert into EMP
        (empno, ename)
      select extractvalue (column_value, '/ROW/EMPNO'),
          extractvalue (column_value, '/ROW/ENAME'),
      from   table
               (xmlsequence
              (extract
               (xmltype
                 (bfilename ('MY_DIR', 'myxml.xml'),
                   nls_charset_id ('AL32UTF8')),
                 '/ROWDATA/ROW')))
    so as to get inserted two rows into my table:
    EMPNO   ENAME
    7369         SMITH
    7902         FORD
    Now, and this is my question, let's suppose I have such a “more difficult” XML:
    <ROWDATA>
    <ROW>
      <COMPANY>
        <EMPNO>7369</EMPNO>
        <ENAME>SMITH</ENAME>
        <EMPNO>1111</EMPNO>
        <ENAME>TAYLOR</ENAME>
      </COMPANY>
    </ROW>
    <ROW>
      <COMPANY>
       <EMPNO>7902</EMPNO>
       <ENAME>FORD</ENAME>
      </COMPANY>
    </ROW>
    <ROW>
      <COMPANY>
      </COMPANY>
    </ROW>
    </ROWDATA>
    In this case it seems to me things look harder 'cause for every row that I should insert into my table, I don't know how many “empno” and “ename” I'll find for each /ROW/COMPANY and so how could I define a table since the number of empno and ename columns are “unknown”?
    According to you, in that case should I load the whole XML file in an unique XMLType column and than “managing” its content by using EXTRACT and EXTRACTVALUE built-in funcions? But this looks a very difficult job.
    My Oracle version is 10gR2 Express Edition
    Thanks in advance!

    Here's a possible solution using a single pass through the XML data :
    with sample_data as (
      select xmltype(
        '<ROWDATA>
        <ROW>
          <COMPANY>
            <EMPNO>7369</EMPNO>
            <ENAME>SMITH</ENAME>
            <EMPNO>1111</EMPNO>
            <ENAME>TAYLOR</ENAME>
          </COMPANY>
        </ROW>
        <ROW>
          <COMPANY>
           <EMPNO>7902</EMPNO>
           <ENAME>FORD</ENAME>
          </COMPANY>
        </ROW> 
      </ROWDATA>'
      ) doc
      from dual
    select min(case when node_name = 'EMPNO' then node_value end) as empno
         , min(case when node_name = 'ENAME' then node_value end) as ename
    from (
      select trunc((rownum-1)/2) as rn
           , extractvalue(value(x), '.') as node_value
           , value(x).getrootelement() as node_name
      from sample_data t
         , table(
             xmlsequence(extract(t.doc, '/ROWDATA/ROW/COMPANY/*'))
           ) x
    group by rn ;
    I would be cautious with this approach though, as I'm not sure the ROWNUM projection is entirely deterministic.
    As Jason said, it's probably safer to first apply a transformation in order to get a more friendly format.
    For example :
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="node()|@*">
        <xsl:copy>
          <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
      </xsl:template>
      <xsl:template match="COMPANY">
        <xsl:apply-templates select="EMPNO"/>
      </xsl:template>
      <xsl:template match="EMPNO">
        <EMP>
          <xsl:copy-of select="."/>
          <xsl:copy-of select="following-sibling::ENAME[1]"/>
        </EMP>
      </xsl:template>
    </xsl:stylesheet>

  • Why can't I save a form under the same file name with multiple signatures

    I have a form the requires several signature but after the first signature is placed and the form is saved (the lock document is not activated) when the form is opened again and the next signature is added the form now can't be saved under the same name. Why?

    Oh your good....you've been doing this TOO long.....I give you THE COOKIE!!!
    Yes I had explore open and minimized "in preview mode"...you know come to think about it this "preview mode" may be the reason I've had trouble saving other documents....wow....you get TWO COOKIES....

  • Importing a XML with multiple entitties?

    Is it possible importing an XML file containing several entities of a Oracle BBDD into the correspondant tables at the same time?
    Thanks in advance!

    Xavi,
    Does your question refer to Berkeley DB? If so, to which product, Berkeley DB Core (BDB), Berkeley DB Java Edition (BDB JE), Berkeley DB XML (BDB XML)? Could you better clarify what exactly is it you are trying to perform?
    Probably BDB XML; if so, then post your issue on the BDB XML forum Berkeley DB XML.
    Regards,
    Andrei

  • XML with multiple namespaces

    I have an XML file
    <?xml version="1.0"?>
    -<Document xmlns="http://www.taleo.com/ws/integration/toolkit/2011/05">
    +<Attributes>
    -<Content>
    -<ExportXML xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07/action/export">
    -<record>
    <field name="ContestNumber">12000000RT</field>
    <field name="JobInformation,JobType,Description">Experienced</field>
    </record>
    </ExportXML>
    </Content>
    </Document>
    I am using the following file to retrieve the data
    SELECT *
       FROM XMLTable(XMLNAMESPACES('http://www.taleo.com/ws/integration/toolkit/2011/05' as "n1",
       'http://www.taleo.com/ws/integration/toolkit/2005/07/action/export' as  "n2"), '//n1:Document/Content/n2:ExportXML/record'
                passing xmltype(
                     bfilename('TEST','TALEOOUT-12-26.xml')
                     , nls_charset_id('AL32UTF8')
         columns
         ContestName varchar2(1000) path 'field[1]'
         )What am i doing wrong

    This was the code that worked.Thanks A_Non .
    SELECT *
       FROM XMLTable(XMLNAMESPACES('http://www.taleo.com/ws/integration/toolkit/2011/05' as "n1",
       'http://www.taleo.com/ws/integration/toolkit/2005/07/action/export' as  "n2"),
       '/n1:Document/n1:Content/n2:ExportXML/n2:record'
                passing xmltype(
                     bfilename('TEST','TALEOOUT-12-26.xml')
                     , nls_charset_id('AL32UTF8')
         columns
         ContestNumber VARCHAR2 (4000) path 'n2:field[1]',
         Job_Info_JobTypDesc VARCHAR2 (4000) path 'n2:field[2]',
         JobFamily VARCHAR2 (4000) path 'n2:field[3]',.........
    )Edited by: Rameshkumar T on Nov 30, 2012 10:59 AM

  • Generate XML with multiple parent nodes

    I have the following test data
    CREATE TABLE #TEST1 (
    HS VARCHAR(20),
    HN VARCHAR(20),
    NC FLOAT
    INSERT INTO #TEST1
    VALUES ('COMPLETE','ABC123',1234.56789),
    ('REJECTED','ABC124',1234.56789),
    ('PLANNED','ABC125',1234.56789),
    ('COMPLETE','ABC126',1234.56789),
    ('COMPLETE','ABC127',1234.56789),
    ('REJECTED','ABC128',1234.56789),
    ('COMPLETE','ABC129',1234.56789),
    ('PLANNED','ABC130',1234.56789),
    ('COMPLETE','ABC131',1234.56789),
    ('COMPLETE','ABC132',1234.56789),
    ('REJECTED','ABC133',1234.56789),
    ('COMPLETE','ABC134',1234.56789),
    ('PLANNED','ABC135',1234.56789),
    ('COMPLETE','ABC136',1234.56789),
    ('REJECTED','ABC137',1234.56789),
    ('COMPLETE','ABC138',1234.56789),
    ('COMPLETE','ABC139',1234.56789),
    ('PLANNED','ABC140',1234.56789)
    SELECT ( SELECT *
    FROM #TEST1 T
    FOR XML PATH('STATUS'), TYPE
    FOR XML PATH('Document'), ROOT('kml')
    DROP TABLE #TEST1
    Which produces the following results.
    <kml>
    <Document>
    <STATUS>
    <HS>COMPLETE</HS>
    <HN>ABC123</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>REJECTED</HS>
    <HN>ABC124</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>PLANNED</HS>
    <HN>ABC125</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>COMPLETE</HS>
    <HN>ABC126</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>COMPLETE</HS>
    <HN>ABC127</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>REJECTED</HS>
    <HN>ABC128</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>COMPLETE</HS>
    <HN>ABC129</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>PLANNED</HS>
    <HN>ABC130</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>COMPLETE</HS>
    <HN>ABC131</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>COMPLETE</HS>
    <HN>ABC132</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>REJECTED</HS>
    <HN>ABC133</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>COMPLETE</HS>
    <HN>ABC134</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>PLANNED</HS>
    <HN>ABC135</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>COMPLETE</HS>
    <HN>ABC136</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>REJECTED</HS>
    <HN>ABC137</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>COMPLETE</HS>
    <HN>ABC138</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>COMPLETE</HS>
    <HN>ABC139</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    <STATUS>
    <HS>PLANNED</HS>
    <HN>ABC140</HN>
    <NC>1.234567890000000e+003</NC>
    </STATUS>
    </Document>
    </kml>
    What I really want to produce is this
    <kml>
    <Document>
    <STATUS>
    <HS>
    COMPLETE
    <Data>
    <HN>ABC123</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC126</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC127</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC129</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC131</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC132</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC134</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC136</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC138</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC139</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    </HS>
    </STATUS>
    <STATUS>
    <HS>
    REJECTED
    <Data>
    <HN>ABC124</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC128</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC133</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC137</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    </HS>
    </STATUS>
    <STATUS>
    <HS>
    PLANNED
    <Data>
    <HN>ABC125</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC130</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC135</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    <Data>
    <HN>ABC140</HN>
    <NC>1.234567890000000e+003</NC>
    </Data>
    </HS>
    </STATUS>
    </Document>
    </kml>
    Is it possible to group header and then group data under those headers using one SQL statement?
    Thanks in advance
    Q

    E.g.
    DECLARE @TEST1 TABLE
    HS VARCHAR(20) ,
    HN VARCHAR(20) ,
    NC FLOAT
    INSERT INTO @TEST1
    VALUES ( 'COMPLETE', 'ABC123', 1234.56789 ),
    ( 'REJECTED', 'ABC124', 1234.56789 ),
    ( 'PLANNED', 'ABC125', 1234.56789 ),
    ( 'COMPLETE', 'ABC126', 1234.56789 ),
    ( 'COMPLETE', 'ABC127', 1234.56789 ),
    ( 'REJECTED', 'ABC128', 1234.56789 ),
    ( 'COMPLETE', 'ABC129', 1234.56789 ),
    ( 'PLANNED', 'ABC130', 1234.56789 ),
    ( 'COMPLETE', 'ABC131', 1234.56789 ),
    ( 'COMPLETE', 'ABC132', 1234.56789 ),
    ( 'REJECTED', 'ABC133', 1234.56789 ),
    ( 'COMPLETE', 'ABC134', 1234.56789 ),
    ( 'PLANNED', 'ABC135', 1234.56789 ),
    ( 'COMPLETE', 'ABC136', 1234.56789 ),
    ( 'REJECTED', 'ABC137', 1234.56789 ),
    ( 'COMPLETE', 'ABC138', 1234.56789 ),
    ( 'COMPLETE', 'ABC139', 1234.56789 ),
    ( 'PLANNED', 'ABC140', 1234.56789 )
    SELECT O.HS ,
    ( SELECT I.HN ,
    I.NC
    FROM @TEST1 I
    WHERE I.HS = O.HS
    FOR XML PATH('') ,ROOT('Data'), TYPE
    ) AS HS
    FROM @TEST1 O
    GROUP BY O.HS
    FOR XML PATH('Document') , ROOT('kml');
    Caveat: You're using mixed element name casing.

Maybe you are looking for