Referencing An XML Element Within An Output Path

November 27, 2008

When creating an XML asset using a Web Form, it is sometimes required for an element of the output XML file, to be used within the output path. For example, if it was required that the save directory was input by the user. The examples below shows two output path strings that could be used to acheive this. In this example the “region” element is a user input within the web form, and the produced XML file is saved into this folder within the users sandbox.

Output Path Pattern

/${webapp}/partner-data/${xml['/*[name()="pe:partner_entrance"]/*[name()="pe:region"]']}/
${name}.xml

or

/${webapp}/partner-data/${xml['pe:partner_entrance']['pe:region']/${name}.xml

Sample XSD (Web Form)

<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	   xmlns:pe="http://www.alfresco.org/alfresco/pe"
           targetNamespace="http://www.alfresco.org/alfresco/pe"
           elementFormDefault="qualified">

  <xs:element name="partner_entrance">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="region" type="xs:normalizedString"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Sample XML (Produced XML File)

<?xml version="1.0" encoding="UTF-8"?>
<pe:partner_entrance xmlns:alf="http://www.alfresco.org"
xmlns:chiba="http://chiba.sourceforge.net/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:pe="http://www.alfresco.org/alfresco/pe"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<pe:region>APAC</pe:region>
</pe:partner_entrance>

{ 2 comments }

Tom 02.02.09 at 12:07 pm

Hi Ben,

Interesting post. Thank you for posting it. Have you seen the following forum posting from a while ago…?
http://forums.alfresco.com/en/viewtopic.php?t=11091

admin 02.03.09 at 11:09 am

Hi Tom,
Very interesting! I will ask around and see if I can get some defined rules of how the renditions are named/stored.

Ben.

Comments on this entry are closed.