• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
XML to RTF transformation via XSL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XML to RTF transformation via XSL


  • Subject: XML to RTF transformation via XSL
  • From: Ian Jackson <email@hidden>
  • Date: Sat, 22 Mar 2008 21:46:45 +1300

I'd like to have my XML file read by my app, and save the file, or display it in a NSTextView, as RTF (with the appropriate formatting etc).

So I have been trying to use:

- (id)objectByApplyingXSLTAtURL:(NSURL *)xsltURL arguments: (NSDictionary *)argumentserror:(NSError **)error

Which is happily giving me the HTML document that would be expected.

The dev docs say that the return value for this method depends on the intended output. For RTF, an NSData object is returned.

So, how do I get this NSData object that I'd like?

I've tried:

<xsl:output method="text"/> in my xsl file.

[xmlDoc setDocumentContentKind:NSXMLDocumentTextKind]; before doing the objectByApplyingXSLTAtURL

I've set the target properties to handle RTF.

I've cast the objectByApplyingXSLTAtURL message -

i.e. NSData *xmlData = (NSData *)[xmlDoc objectByApplyingXSLTAtURL: [NSURL fileURLWithPath:xsltPath] arguments:nil error:&err];

And these things either give an error in the console, or at best just give HTML. Also, I can't see how any of these settings (except the target properties) would give me RTF (rather than plain text).

Am I barking up the wrong tree here? I was expecting RTF output with bigger bolder text corresponding to <h2> etc.

Ian.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: XML to RTF transformation via XSL
      • From: Andrew Farmer <email@hidden>
  • Prev by Date: Re: Synchronising across multiple NSUndoManager stacks
  • Next by Date: NSTreeController, "canRemove" binding
  • Previous by thread: Re: View with sliding rearranging thumbnails
  • Next by thread: Re: XML to RTF transformation via XSL
  • Index(es):
    • Date
    • Thread