Good point. The trigger could be smartened up to run on both create and modify, and then only apply the transform if the expected pre-transform root element exists. An empty document has a binary root node, not an element. Plain text documents have a root text node.
On Mar 10, 2011, at 10:46 PM, Keith L. Breinholt wrote: > There is one caveat to using pre-commit triggers with WebDAV. When the > Windows WebDAV client writes a file it first writes a zero length file and > then does an update to the zero length file with the real contents. > > So as long as you are not using Windows WebDAV to load your content using a > precommit trigger on create is fine. > > - Keith > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Ron Hitchens > Sent: Thursday, March 10, 2011 3:15 PM > To: General MarkLogic Developer Discussion > Subject: Re: [MarkLogic Dev General] Royal Road to CPF using XSLT? > > > You should certainly look at Information Studio, but I'm unfamiliar with it > so I will ignore it for now. > > Assuming you're on 4.2 (and don't want to use IS) you wouldn't need > full-blown CPF. You could do it with a simple trigger. > > When a document is inserted in the appropriate directory domain your > trigger module could apply the stylesheet to the document. > > Just make sure you only run the transform on create, because updating the > newly inserted document will re-fire the trigger for modification (in which > case you don't want to do anything). > > Triggers are a power tool, so be careful. But CPF is driven from triggers, > so it's basically a more formalized way of doing the same thing. > > With a pre-commit trigger, your document will never be visible in it's > non-transformed state. With post-commit, the transform is done > asynchronously after the initial document insert commits. CPF is always > post-commit. > > -- > Ron Hitchens, [email protected] > > On 10 Mar 2011, at 09:05 PM, David Sewell <[email protected]> wrote: > >> To paraphrase Euclid, I'm guessing there's no royal road to >> auto-applying XSLT to a document at load time into the database? >> >> Our use case is simply that for a given directory in one of our >> databases, we want to run all XML files through a particular XSLT >> stylesheet. We have managed to coexist with MarkLogic for a number of >> years without needing to use the Content Processing Framework Guide. >> Section 6.4.6 of that document is precisely "Using XSLT Stylesheets >> Instead of Action Modules". So... we bite the bullet and read up, or is >> there a cheat-sheet method? >> >> David s. >> >> -- >> David Sewell, Editorial and Technical Manager ROTUNDA, The University >> of Virginia Press PO Box 400314, Charlottesville, VA 22904-4314 USA >> Email: [email protected] Tel: +1 434 924 9973 >> Web: http://rotunda.upress.virginia.edu/ >> _______________________________________________ >> General mailing list >> [email protected] >> http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > > > NOTICE: This email message is for the sole use of the intended recipient(s) > and may contain confidential and privileged information. Any unauthorized > review, use, disclosure or distribution is prohibited. If you are not the > intended recipient, please contact the sender by reply email and destroy all > copies of the original message. > > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general --- Ron Hitchens {mailto:[email protected]} Ronsoft Technologies +44 7879 358 212 (voice) http://www.ronsoft.com +1 707 924 3878 (fax) Bit Twiddling At Its Finest "No amount of belief establishes any fact." -Unknown _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
