xsl-list
[Top] [All Lists]

[xsl] Comparing before and after records [SEC=UNCLASSIFIED]

2008-07-02 23:59:07

Given this XML input

<?xml version="1.0" encoding="UTF-8"?>
<Events>
      <Before>
            <Event_Type>A</Event_Type>
            <Event_Field1>1111</Event_Field1>
            <Event_Field2>2222</Event_Field2>
            <Event_Field3>3333</Event_Field3>
            <EventId>1001</EventId>
      </Before>
      <Before>
            <Event_Type>B</Event_Type>
            <Event_Field1>1111</Event_Field1>
            <Event_Field2>2222</Event_Field2>
            <Event_Field3>3333</Event_Field3>
            <EventId>1002</EventId>
      </Before>
      <After>
            <Event_Type>A</Event_Type>
            <Event_Field1>1111</Event_Field1>
            <Event_Field2>2222</Event_Field2>
            <Event_Field3>3333</Event_Field3>
            <EventId>1001</EventId>
      </After>
      <After>
            <Event_Type>B</Event_Type>
            <Event_Field1>1111</Event_Field1>
            <Event_Field2>2233</Event_Field2>
            <Event_Field3>4444</Event_Field3>
            <EventId>1002</EventId>
      </After>
      <After>
            <Event_Type>A</Event_Type>
            <Event_Field1>1122</Event_Field1>
            <Event_Field2>2233</Event_Field2>
            <Event_Field3>3344</Event_Field3>
            <EventId>1003</EventId>
      </After>
</Events>

I need to output multiple XML files based on the number of unique
EventId's.  Filenames derived from {Event_Type}-{EventId}.xml.  Comments to
be generated

A-1001.xml
<?xml version="1.0" encoding="UTF-8"?>
<Event>
      <!-- unchanged -->
      <Field1>1111</Field1>
      <!-- unchanged -->
      <Field2>2222</Field2>
      <!-- unchanged -->
      <Field3>3333</Field3>
</Event>

B-1002.xml
<?xml version="1.0" encoding="UTF-8"?>
<Event>
      <!-- unchanged -->
      <Field1>1111</Field1>
      <!-- before: 2222 -->
      <Field2>2233</Field2>
      <!-- before: 3333 -->
      <Field3>4444</Field3>
</Event>

A-1003.xml
<?xml version="1.0" encoding="UTF-8"?>
<Event>
      <!-- new -->
      <Field1>1111</Field1>
      <!-- new -->
      <Field2>2233</Field2>
      <!-- new -->
      <Field3>4444</Field3>
</Event>

The creation of the multiple output document and the transformations are
easy.  The help I need is in comparing the <Before> and <After> contents
with the same <EventId>.

Thanks in advance,

Enrico Raymundo





--------------------------------------------------------------------
Important Notice: If you have received this email by mistake, please advise the 
sender and delete the message and attachments immediately.  This email, 
including attachments, may contain confidential, sensitive, legally privileged 
and/or copyright information.  Any review, retransmission, dissemination or 
other use of this information by persons or entities other than the intended 
recipient is prohibited.  DIAC respects your privacy and has obligations under 
the Privacy Act 1988.  The official departmental privacy policy can be viewed 
on the department's website at www.immi.gov.au. See: 
http://www.immi.gov.au/functional/privacy.htm

---------------------------------------------------------------------


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--