Hello,
 
I believe you can use the copyDocument() method. I use it to rename pages, I copy a document to a newly named document, then delete the old one.
All objects and attachments are also copied in the process, so that may interest you (as far as all objects are included in the template document I believe)
 
$xwiki.copyDocument($sourceDoc, $targetDoc)
 

Jeremie, Bousquet
GSE Solution CMO
Gemalto
Tel: +33 4 42 36 42 93
Avenue du Jujubier, Z.I Athelia IV
13705 La Ciotat, FRANCE
Jeremie.Bousquet@gemalto.com
www.gemalto.com



From: Esbach, Brandon [mailto:Esbachb@tycoelectronics.com]
Sent: vendredi 25 août 2006 12:58
To: xwiki-users@objectweb.org
Subject: [xwiki-users] "Clone" another documents objects when creating a new document

Hi All,

Is there any way to clone all objects in an existing document to a different document with one server request?
So that a template document can be maintained with default object values; and can be brought in painlessly to a new document.



Brandon Esbach
Software Engineer
M/A-Com Eurotec Operations
LoughMahon Technology Park,
Skehard Road,
Blackrock,
Cork, Ireland
Tel  +353 21 4808305