[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Trying to Detect corrupt data
On 25/10/2007, Arthur Maloney <ArthurM@xxxxxxxxxx> wrote: > Depending on user choice. The Xml file contains 500-50,000 row elements > > In the Xml file each row element contains between 2-15 agent elements > (there is always more than 1). The agent name should be the same in all agent elements. > > > > Example of Xml file > 1. AppicantNumber is always unique for each row element > 2. row 1 is not corrupt. All agent names the same > 3. rows 2 and 3 are corrupt. Contain more than one agent name (row2 > contains 4 names, row3 2 names). > > <table> > ... > <row> > <applicantNumber>56789</applicantNumber> > <agent>John1</agent> > <agent>John1</agent> > <agent>John1</agent> > <agent>John1</agent> > </row> > ... > <row> > <applicantNumber>127789</applicantNumber> > <agent>John27</agent> > <agent>John1</agent> > <agent>Fred13</agent> > <agent>John27</agent> > <agent>John27</agent> > <agent>John27</agent> > <agent>Paul8</agent> > <agent>John27</agent> > </row> > ... > <row> > <applicantNumber>16789345</applicantNumber> > <agent>Fred9</agent> > <agent>Fred9</agent> > <agent>Fred9</agent> > <agent>John1</agent> > <agent>Fred9</agent> > <agent>Fred9</agent> > <agent>Fred9</agent> > <agent>Fred9</agent> > <agent>Fred9</agent> > </row> > ... > </table> You haven't shown any XSLT or given a clue to what version you're using (which is always a good idea)... However in this case the solution is probably the same for both: to check the applicant number is unique define a key and check that it only ever contains a single item with that value eg: <xsl:key name="appNum" match="applicantNumber" use="."/> and then when matching <row>: count(key('appNum', applicantNumber)) = 1 To check that all <agent>s contain the same value use: agent != agent (one of the few times you want to use != ....!) or maybe in 2.0: count(distinct-values(agent) eq 1) I hope this helps... cheers -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|