cancel
Showing results for 
Search instead for 
Did you mean: 

Expression simple.string is instead a freemarker.ext.dom.No

darsat_8
Champ in-the-making
Champ in-the-making
Hi All,
i m suffering from Freemarker template..
i got this error several times when i creating content in web form…

freemarker_template Expecting a string, date or number here, Expression simple.string is instead a freemarker.ext.dom.NodeListModel


i have very little knowledge about freemarker template…
plz anyone know guide me how to solve this error??

I really appreciate to your reply.
Thanks in advance
18 REPLIES 18

darsat_8
Champ in-the-making
Champ in-the-making
right now i do not  changed XSD i just changed ftl file ..
still i got this error:-
    * Error generating rendition using Freemarker62feb.ftl: freemarker.core.NonStringException: Error on line 5, column 6 in freemarker_template Expecting a string, date or number here, Expression pressrelease.Email is instead a freemarker.ext.dom.NodeListModel

   

   

updated new FTL file:-

<#ftl ns_prefixes={"D":"http://www.alfresco.org/alfresco/pr"}> <html>   <body>   ${pressrelease.CustomerName}   ${pressrelease.Email}    ${pressrelease.city}    ${pressrelease.CompanyName}    ${pressrelease.Processor}    ${pressrelease.Ram}    ${pressrelease.ScreenSize}    ${pressrelease.HardDisk}    ${pressrelease.DVDWriter}    ${pressrelease.ExtraFeatures}    </body> </html>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

rather than this i also want to publish bulk of HTML Pages from single XSL file?i also suffering from this problem from last 15 days..
bt still i didnt got any solution for tht also..

dgenard
Champ on-the-rise
Champ on-the-rise
So, the CustomerName seems to be correctly output.
Small progress.

Next property is E-mail that you wrote with a '-' (E-mail) in xsd, and without '-' (Email) in ftl.

Try removing the '-' in both xsd and ftl.

Denis

darsat_8
Champ in-the-making
Champ in-the-making
No i did not got any output ..
ftl file should not be created until this this error occurred..
i already update XSD file according to ftl file..
i will be take of tht…

darsat_8
Champ in-the-making
Champ in-the-making
Hi dgenard,
if u have official Gmail account then we can discuss this thing very easily…
plz this is very urgent for me…
once again i really appreciate to ur reply…
thanks….

dgenard
Champ on-the-rise
Champ on-the-rise
If it can help, here is an example, working fine with Alfresco 2.1.1E.

Press-release-plain-text.ftl
<#ftl ns_prefixes={"D", "http://www.alfresco.org/alfresco/pr"}><#macro show_heading heading>${heading}<#list 1..heading?length as index>-</#list></#macro><@show_heading heading="Title: ${press_release.title}"/><@show_heading heading="Abstract: ${press_release.abstract}"/><#list press_release.body as body>  <#if body_index = 0>${press_release.location}–${press_release.launch_date}–  </#if>${body?trim}</#list><#list press_release.include_company_footer as cf><#assign cf_document=alf.parseXMLDocument(cf)><@show_heading heading="About ${cf_document.name}"/>  <#list cf_document.body as body>${body?trim}  </#list></#list>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

press-release.xsd
<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"      xmlns:pr="http://www.alfresco.org/alfresco/pr"           targetNamespace="http://www.alfresco.org/alfresco/pr"           elementFormDefault="qualified">  <!– dynamically loads the company footer choices simple type –>  <xs:include schemaLocation="/media/releases/get_company_footer_choices_simple_type.jsp"/>  <xs:simpleType name="category">    <xs:restriction base="xs:normalizedString">      <xs:enumeration value="Product"/>      <xs:enumeration value="Partnership"/>      <xs:enumeration value="Company"/>      <xs:enumeration value="Event"/>      <xs:enumeration value="Training"/>    </xs:restriction>  </xs:simpleType>  <!– defines the form for creating a press release –>  <xs:element name="press_release">    <xs:complexType>      <xs:sequence>        <xs:element name="title" type="xs:normalizedString"/>        <xs:element name="abstract" type="xs:normalizedString"/>        <xs:element name="location" type="xs:normalizedString"/>        <xs:element name="body" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>   <xs:element name="include_company_footer" type="pr:company_footer_choices" minOccurs="0" maxOccurs="unbounded"/>   <xs:element name="include_media_contacts" type="xs:boolean" default="true"/>   <xs:element name="keywords" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded"/>   <xs:element name="category" type="pr:category" default="Company"/>   <xs:element name="launch_date" type="xs:date"/>   <xs:element name="expiration_date" type="xs:date"/>      </xs:sequence>    </xs:complexType>  </xs:element></xs:schema>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

darsat_8
Champ in-the-making
Champ in-the-making
i see these files which you send to me..
bt my file format are different from these files…
hopes u knw wht i actully want???
wht is need of company-footer.xsd ??
another plz also guide me hw to publish bulk of HTML pages from single xsl…

here i also giving you three files which i done before few days for publishing bulk of HTML pages bt i got copule of Laptop information in single HTML page bt tht kind of thing i dnt want…
i want separate HTML page for every Laptop…
its vry urgent for me…
if hav any solution for this prblm guide me how to generate no. of HTML pages from single XSL…..



BunchLaptop.xsd

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="BunchLaptop.xsl"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"      xmlns:pr="http://www.alfresco.org/alfresco/pr"           targetNamespace="http://www.alfresco.org/alfresco/pr"           elementFormDefault="qualified">  <xs:simpleType name="Processor">    <xs:restriction base="xs:normalizedString">      <xs:enumeration value="Pentium4"/>      <xs:enumeration value="celeron"/>      <xs:enumeration value="AMDAthlon"/>      <xs:enumeration value="DualCore"/>     </xs:restriction>  </xs:simpleType>  <xs:element name="press-release">    <xs:complexType>      <xs:sequence>        <xs:element name="CustomerName" type="xs:normalizedString"/>        <xs:element name="E-mail" type="xs:normalizedString"/>        <xs:element name="city" type="xs:normalizedString"/>   <xs:element name="laptopinfo" minOccurs="1" maxOccurs="unbounded">     <xs:complexType>       <xs:sequence>         <xs:element name="CompanyName" type="xs:normalizedString"/>         <xs:element name="Processor" type="pr:Processor"/>         <xs:element name="Ram" type="xs:normalizedString"/>         <xs:element name="ScreenSize" type="xs:normalizedString"/>         <xs:element name="HardDisk" type="xs:normalizedString"/>         <xs:element name="DVDWriter" type="xs:normalizedString"/>         <xs:element name="ExtraFeatures" type="xs:normalizedString"/>            </xs:sequence>     </xs:complexType>        </xs:element>      </xs:sequence>    </xs:complexType>  </xs:element></xs:schema>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

BunchLaptop.xsl
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:pr="http://www.alfresco.org/alfresco/pr"><xsl:output method="html"  encoding="UTF-8" indent="yes"/><xsl:variable name="CustName" select="/pr:press-release/pr:CustomerName"/><xsl:variable name="Email" select="/pr:press-release/pr:E-mail"/><xsl:variable name="city" select="/pr:press-release/pr:city"/><xsl:variable name="CompanyName" select="/pr:press-release/pr:laptopinfo/pr:CompanyName"/><xsl:variable name="Processor" select="/pr:press-release/pr:laptopinfo/pr:Processor"/><xsl:variable name="Ram" select="/pr:press-release/pr:laptopinfo/pr:Ram"/><xsl:variable name="ScreenSize" select="/pr:press-release/pr:laptopinfo/pr:ScreenSize"/><xsl:variable name="HardDisk" select="/pr:press-release/pr:laptopinfo/pr:HardDisk"/><xsl:variable name="DVDWriter" select="/pr:press-release/pr:laptopinfo/pr:DVDWriter"/><xsl:variable name="ExtraFeatures" select="/pr:press-release/pr:laptopinfo/pr:ExtraFeatures"/><xsl:template match="/pr:press-release">   <B><xsl:text>Customer Name  :</xsl:text></B>   <B><xsl:value-of select="$CustName"/></B><br/>   <B><xsl:text>E-mail  :</xsl:text></B>   <B><xsl:value-of select="$Email"/></B><br/>   <B><xsl:text>City  :</xsl:text></B>   <B><xsl:value-of select="$city"/></B><br/><br/><xsl:for-each select="/pr:press-release/pr:laptopinfo" ><xsl:if test="position()=1"><xsl:value-of select="normalize-space(/pr:press_release/pr:laptopinfo/pr:CompanyName)"/></xsl:if>      <B><xsl:text>Company Name  :</xsl:text></B>      <xsl:value-of select="normalize-space(pr:CompanyName)" disable-output-escaping="yes"/><br/>      <B><xsl:text>Processor  :</xsl:text></B>      <xsl:value-of select="normalize-space(pr:Processor)" disable-output-escaping="yes"/><br/>      <B><xsl:text>Ram  :</xsl:text></B>      <xsl:value-of select="normalize-space(pr:Ram)" disable-output-escaping="yes"/><br/>      <B><xsl:text>Screen Size  :</xsl:text></B>      <xsl:value-of select="normalize-space(pr:ScreenSize)" disable-output-escaping="yes"/><br/>      <B><xsl:text>HardDisk  :</xsl:text></B>      <xsl:value-of select="normalize-space(pr:HardDisk)" disable-output-escaping="yes"/><br/>      <B><xsl:text>DVD Writer(Yes/No)  :</xsl:text></B>      <xsl:value-of select="normalize-space(pr:DVDWriter)" disable-output-escaping="yes"/><br/>      <B><xsl:text>Extra Features  :</xsl:text></B>      <xsl:value-of select="normalize-space(pr:ExtraFeatures)" disable-output-escaping="yes"/><br/><br/></xsl:for-each></xsl:template> </xsl:stylesheet>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

BunchLaptop.xml

<alfresco:press-release xmlns:alfresco="http://www.alfresco.org/alfresco"><alfresco:CustomerName></alfresco:CustomerName><alfresco:E-mail></alfresco:E-mail><alfresco:city></alfresco:city><alfresco:laptopinfo><alfresco:CompanyName></alfresco:CompanyName><alfresco:Processor></alfresco:Processor><alfresco:Ram></alfresco:Ram><alfresco:ScreenSize></alfresco:ScreenSize><alfresco:HardDisk></alfresco:HardDisk><alfresco:DVDWriter></alfresco:DVDWriter><alfresco:ExtraFeatures></alfresco:ExtraFeatures></alfresco:laptopinfo><alfresco:laptopinfo><alfresco:CompanyName></alfresco:CompanyName><alfresco:Processor></alfresco:Processor><alfresco:Ram></alfresco:Ram><alfresco:ScreenSize></alfresco:ScreenSize><alfresco:HardDisk></alfresco:HardDisk><alfresco:DVDWriter></alfresco:DVDWriter><alfresco:ExtraFeatures></alfresco:ExtraFeatures></alfresco:laptopinfo><alfresco:laptopinfo><alfresco:CompanyName></alfresco:CompanyName><alfresco:Processor></alfresco:Processor><alfresco:Ram></alfresco:Ram><alfresco:ScreenSize></alfresco:ScreenSize><alfresco:HardDisk></alfresco:HardDisk><alfresco:DVDWriter></alfresco:DVDWriter><alfresco:ExtraFeatures></alfresco:ExtraFeatures></alfresco:laptopinfo></alfresco:press-release>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Thanks…………..

darsat_8
Champ in-the-making
Champ in-the-making
Hi dgenard,
Finally FreeMarker Template  Publish text File…
Thank you  for your valuable Guidance to me …
but my main objective is i want publish multiple HTML pages from single xsl??
i am very confused how to trace for loop for generating multiple HTML??
i use for loop for generating Multiple laptop details in single HTML page bt still i didn't got any solution for how to generate bulk of HTML pages??
plz its vry urgent for me…………
Thanks……….

dgenard
Champ on-the-rise
Champ on-the-rise
I don't know how to produce mutliple html files from a single xml source using Alfresco.
Xalan do provide an extension for this (http://xml.apache.org/xalan-j/extensionslib.html#redirect), but I'm not sure that it would work in Alfresco.
Maybe should you open a new thread in this forum so other people might help…
Denis

boscoferrao
Champ in-the-making
Champ in-the-making
The setup of tomcat may be wrong. Please add xalan.jar in endorsed folder for tomcat. This solved the problem for me.