removed old libs
[TestXSLT.git] / XSLTProcessorJAXPBase.m
1 //
2 //  XSLTProcessorJAXPBase.m
3 //  TestXSLT
4 //
5 //  Created by Marc Liyanage on Mon Aug 18 2003.
6 //  Copyright (c) 2003 __MyCompanyName__. All rights reserved.
7 //
8
9 #import "XSLTProcessorJAXPBase.h"
10
11
12 @implementation XSLTProcessorJAXPBase
13
14
15
16
17
18
19 - (BOOL)processStrings:(NSData *)xmlCode withXslt:(NSData *)xsltCode andParameters:(const char **)params {
20         
21         [self clearError];
22         
23         NSString *jaxpBaseUri = @"";
24         if ([self baseUri] != nil) {
25                 jaxpBaseUri = [self baseUri];
26         }
27         
28         
29         NSMutableString *paramBuffer = [[NSMutableString alloc] init];
30         int i = 0;
31         while (params && params[i]) {
32                 
33                 [paramBuffer appendString:[NSString stringWithFormat:@"%s==_=!=_==%s", params[i], params[i+1]]];
34                 
35                 if (params[i+2]) {
36                         // more parameters to follow
37                         [paramBuffer appendString:@"--_-!-_--"];
38                 }
39                 
40                 i += 2;
41         }
42         
43         JAXPWrapper *jw = (JAXPWrapper *)[[NSClassFromString(@"JAXPWrapper") alloc] init];
44         BOOL swresult = [jw transform:[self getJAXPProcessorName] :xmlCode :xsltCode :paramBuffer :jaxpBaseUri];
45         
46         [self setResultEncodingFromData:xsltCode];
47         
48         if (swresult) {
49                 [self setResult:[jw getResult]];
50         } else {
51                 [self setError:[jw getErrorMessage] atLine:[jw getErrorLine] inSource:[jw getErrorSource]];     
52         }
53         
54         
55         [jw release];
56         
57         return ![self errorOccurred];
58         
59 }
60
61
62 - (NSString *) getJAXPProcessorName {
63         
64         NSLog(@"subclass must override getJAXPProcessorName in XSLTProcessorJAXPBase!");
65         return nil;
66         
67 }
68
69
70
71 @end