Note that there are some explanatory texts on larger screens.

plurals
  1. PORetaining "<" while applying XSLT to an xml
    text
    copied!<p>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.</p> <p>A few attributes in my model have large text value. Occasionally this text may contain, "&lt;" and "&gt;". Whenever such text appears, the text between "&lt;" and "&gt;" is skipped. For example, if my text is "<code>This &lt;item name&gt; belongs to me.</code>" The output I get is "<code>This belongs to me.</code>" &lt;item name&gt; 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 &amp;lt; and &amp;gt;. And so the value is not printed.</p> <p>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.</p> <p>Thanks, Sahitya</p> <p>P.S.-I am a newbie to xml handling and xsl as well.</p> <p>XML with the CData section: "<code>&lt;descriptionText&gt;&lt;![CDATA[This &lt;item name&gt; belongs to me.]]&gt;&lt;/descriptionText&gt;</code>"</p> <p>XSL excerpt: <code>&lt;tr&gt;&lt;td&gt;&lt;xsl:value-of select="descriptionText" disable-output-escaping="yes"/&gt;&lt;/td&gt;&lt;/tr&gt;</code></p> <p>expectedOutput: <code>This &lt;item name&gt; belongs to me.</code></p> <p>ActualOutput: <code>This belongs to me.</code></p> <p><strong>EDIT:</strong></p> <p>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, </p> <p><code>- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame;</code> </p> <p>of the printer class, is called. Please see the implementation of this API below:</p> <pre><code>- (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]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload