Accessing Variables in Nuxeo Document Templates

I am using Nuxeo 5.6 RC2 for document templating. I made a custom schema to use the variables in document template.

I did the following:

  1. Created a custom schema,“template” with prefix “tem” and registered.

    < extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
    < schema name="template" prefix="tem" src="data/schemas/template.xsd" /> < /extension> `

  2. Extended it to the “Document

    < extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
    < doctype name="template" extends="Document">
    < schema name="template" />
    < schema name="dublincore" />
    < schema name="common" />
    < schema name="uid" />
    < schema name="file" />
    < facet name="Downloadable" />
    < facet name="Versionable" />

    <br>
    

    < facet name="HasRelatedText" />

    <code> < /doctype>
    

    < /extension>

  3. Created screens to store custom schema,property(e.g tem:prop).I am successfully able to store the values.Hence,this confirms that my schema registration and value storage is fine.

  4. i use the variable in the document template like this:

    <#list This as doc> ${doc[“tem:prop”]}” < /#list>

But this gives me the exception of unknown property ,“tem:prop”

If i access any dublin core schema variable,it works fine.But the custom schema extending Document is not accessed.

Can someone please guide me that the document templating in Nuxeo 5.6 RC2 can be used with dublin core schema only or i have missed something.? Please help

0 votes

1 answers

910 views

ANSWER



Use ${doc.template.prop} to access properties in FTL.

0 votes



Although ${doc[&quot;tem:prop&quot;]} should work as well, I'm not sure what's wrong. Are you sure doc is the document you expect? What does ${doc.type} give?
08/30/2012