WebForm Output Path Expressions - behaviour
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2008 06:04 AM
The ability to use a Freemarker expression in the output-path is very useful, but it's behaviour is interesting.
1)
For example: ${name} is the entered name of the form, so if you named the form 'mydata' then the following expression:
/${webapp}/mysubfolder/${name}.xml
…creates the file '/mywebapp/mysubfolder/mydata.xml'
and the template can use a similar path
/${webapp}/mysubfolder/${name}.html
…creates the file '/mywebapp/mysubfolder/mydata.html'
However, if the data path was more like:
/${webapp}/mysubfolder/myprefix_${name}.xml
…creating the file '/mywebapp/mysubfolder/myprefix_mydata.xml'
then the template output path that looks like:
/${webapp}/mysubfolder/${name}.html
…creates the file '/mywebapp/mysubfolder/myprefix_mydata.html'
Notice that I did not provide a prefix for the second expression, but it seemed to re-assign the value of ${name} to be the calculated named of the XML and not the form value.
This has turned-out to be quite useful, although surprising. What if I didn't want my rendition to have the prefix - how do i get the form name?
2)
Other interesting behaviour is that the XML output path could be complex and absolute such as:
/${webapp}/${xml['mydata/mycategory']}/myprefix_${name}.xml
…creating the file '/mywebapp/mycategoryvalue/myprefix_mydata.xml'
But the template/rendition output path could be as simple as :
${name}.jsp
but the created file goes into the same dynamically determined location as the XML. Like this:
…creates the file '/mywebapp/mycategoryvalue/myprefix_mydata.html'
3)
If you try to reproduce the above outputpath of the XML for the rendition, like this:
/${webapp}/${xml['mydata/mycategory']}/myprefix_${name}.html
…then you get a freemarker error. Is the 'xml' node available to renditions? There's only one related XML, so you'd think that this would be placed into the freemarker model. Is this just my defect, or is it common to the implementation?
Can anyone elaborate on this and the Freemarker rules for outputpath?
Many thanks,
Tom
1)
For example: ${name} is the entered name of the form, so if you named the form 'mydata' then the following expression:
/${webapp}/mysubfolder/${name}.xml
…creates the file '/mywebapp/mysubfolder/mydata.xml'
and the template can use a similar path
/${webapp}/mysubfolder/${name}.html
…creates the file '/mywebapp/mysubfolder/mydata.html'
However, if the data path was more like:
/${webapp}/mysubfolder/myprefix_${name}.xml
…creating the file '/mywebapp/mysubfolder/myprefix_mydata.xml'
then the template output path that looks like:
/${webapp}/mysubfolder/${name}.html
…creates the file '/mywebapp/mysubfolder/myprefix_mydata.html'
Notice that I did not provide a prefix for the second expression, but it seemed to re-assign the value of ${name} to be the calculated named of the XML and not the form value.
This has turned-out to be quite useful, although surprising. What if I didn't want my rendition to have the prefix - how do i get the form name?
2)
Other interesting behaviour is that the XML output path could be complex and absolute such as:
/${webapp}/${xml['mydata/mycategory']}/myprefix_${name}.xml
…creating the file '/mywebapp/mycategoryvalue/myprefix_mydata.xml'
But the template/rendition output path could be as simple as :
${name}.jsp
but the created file goes into the same dynamically determined location as the XML. Like this:
…creates the file '/mywebapp/mycategoryvalue/myprefix_mydata.html'
3)
If you try to reproduce the above outputpath of the XML for the rendition, like this:
/${webapp}/${xml['mydata/mycategory']}/myprefix_${name}.html
…then you get a freemarker error. Is the 'xml' node available to renditions? There's only one related XML, so you'd think that this would be placed into the freemarker model. Is this just my defect, or is it common to the implementation?
Can anyone elaborate on this and the Freemarker rules for outputpath?
Many thanks,
Tom
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2008 08:00 AM
Did that make sense?
Anyone?
Anyone?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2008 09:53 AM
Output path pattern:
${xml['/*[name()="languageoutput:myform"]/*[name()="languageoutput:language1"]/*[name()="languageoutput:value"]']}/${name}.xml
For this Sample xsd:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:languageoutput="http://www.alfresco.org/alfresco/languageoutput"
targetNamespace="http://www.alfresco.org/alfresco/languageoutput" elementFormDefault="qualified">
<xs:complexType name="language">
<xs:sequence>
<xs:element name="key" type="xs:normalizedString"/>
<xs:element name="value" type="xs:anyURI"/>
<xs:element name="languageName" type="xs:normalizedString"/>
<xs:element name="publish" type="xs:boolean" minOccurs="0" default="true"/>
</xs:sequence>
</xs:complexType>
<xs:element name="myform">
<xs:complexType>
<xs:sequence>
<xs:element name="language1" type="languageoutput:language" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
it works fine for me….thanks to the jira for the answer
${xml['/*[name()="languageoutput:myform"]/*[name()="languageoutput:language1"]/*[name()="languageoutput:value"]']}/${name}.xml
For this Sample xsd:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:languageoutput="http://www.alfresco.org/alfresco/languageoutput"
targetNamespace="http://www.alfresco.org/alfresco/languageoutput" elementFormDefault="qualified">
<xs:complexType name="language">
<xs:sequence>
<xs:element name="key" type="xs:normalizedString"/>
<xs:element name="value" type="xs:anyURI"/>
<xs:element name="languageName" type="xs:normalizedString"/>
<xs:element name="publish" type="xs:boolean" minOccurs="0" default="true"/>
</xs:sequence>
</xs:complexType>
<xs:element name="myform">
<xs:complexType>
<xs:sequence>
<xs:element name="language1" type="languageoutput:language" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
it works fine for me….thanks to the jira for the answer
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2008 10:08 AM
Hello gopesh,
Does that mean you experience the same behaviour as I do, for point 1) and 2)?
Does that mean you experience the same behaviour as I do, for point 1) and 2)?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2008 05:23 AM
Is there an alfresco engineer with an insight for this area?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2008 06:49 PM
alfresco?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2008 11:08 AM
Looks like we found the answer to point 3) above.
Although something like the following works for XML creation:
/${xml['press_release/title']}/myfile.xml
It needs the name-space prefix for rendition output paths, like this:
/${xml['pr
ress_release/pr:title']}/myfile.html
I think this is what Gopesh was trying to tell me earlier in this thread…
The general behaviour described in my other points are still interestingly subtle.
Although something like the following works for XML creation:
/${xml['press_release/title']}/myfile.xml
It needs the name-space prefix for rendition output paths, like this:
/${xml['pr

I think this is what Gopesh was trying to tell me earlier in this thread…
The general behaviour described in my other points are still interestingly subtle.
