I am using the XML->XHTL conversion for printing a model based window. What I do is to convert my model into a well formed xml. And then applying xsl to it.
A few attributes in my model have large text value. Occasionally this text may contain, "<" and ">". Whenever such text appears, the text between "<" and ">" is skipped.
For example, if my text is "This <item name> belongs to me.
"
The output I get is "This belongs to me.
" <item name> is skipped. It looks like these characters in the attribute's value are also identified as the beginning and end of xml tags. They get converted to < and >. And so the value is not printed.
Can anyone please tell me, how can i retain the angular brackets in the attribute's value in output as well? Any help is greatly appreciated.
Thanks, Sahitya
P.S.-I am a newbie to xml handling and xsl as well.
XML with the CData section:
"<descriptionText><![CDATA[This <item name> belongs to me.]]></descriptionText>
"
XSL excerpt:
<tr><td><xsl:value-of select="descriptionText" disable-output-escaping="yes"/></td></tr>
expectedOutput:
This <item name> belongs to me.
ActualOutput:
This belongs to me.
EDIT:
For implementing the print functionality at the application level, I am using the APIs of WebFrameLoadDelegate and NSPrintOperation. Once the webview is created successfully, the delegate API,
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame;
of the printer class, is called. Please see the implementation of this API below:
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
{
NSPrintInfo *pi = [NSPrintInfo sharedPrintInfo];
if ([NSPrintInfo defaultPrinter])
{
[pi setPrinter:[NSPrintInfo defaultPrinter]];
}
[pi setTopMargin:5.0];
[pi setLeftMargin:5.0];
[pi setBottomMargin:10.0];
[pi setRightMargin:5.0];
[pi setHorizontalPagination:NSFitPagination];
[pi setVerticalPagination:NSFitPagination];
[pi setVerticallyCentered:YES];
[pi setHorizontallyCentered:YES];
[[self.webView preferences] setAutosaves: NO];
[[self.webView preferences] setShouldPrintBackgrounds:YES];
NSPrintOperation *printOperation = [[[self.webView mainFrame] frameView] printOperationWithPrintInfo:pi];
[printOperation runOperationModalForWindow:self.window delegate:self.delegate didRunSelector:self.callbackSelector contextInfo:nil];
}