How to create a page based on a template with style

We are using XWiki 9.11.3 . I am trying to figure out how to create a page based on a template with the style of that template automatically. The below velocity works except the style is not used:

$newDoc.setContent(’{{include document=“XWiki.template1.WebHome”}}’)

If I remove the WebHome from the above line as I saw in a document, it fails.

Any advice? Thanks.

Hello,
fullname of pages parents is MyPageParent.WebHome.
You must check if XWiki.template1 is a Terminale page or page parent.

To use style, you can use SSX object:

Pascal B