DIGIFORMS
Digiforms Designer Documentation
 
 
 
 
 
 
Help by samples
 
 
 
Capture or output data in a defined layout
 
Extensible Markup Language
Adressing information across datasources and document data
$digiforms:documentData namespace
Merging information from datasource based on values in the document data
The normal case
When iterating document data, and merging values from a datasource by relation, it demands using variables in the Xpath expressions to match values. The reason is that when retrieveing data from a datasource, we switch document context. A lookup would be a construction similar to this:
// Current context is document data <xsl:for-each select="item"> // Defining the binding variable <xsl:variable name="match" select="{the_element_or_attribute_value_to_match_from_current_context}"></xsl:variable> // Selecting from datasource (switching document), matching must be made using the $bind variable <xsl:value-of select="$datasource//element[@id=$match]"></xsl:value> </xsl:for-each>
xslt
Adressing document data based on values found in datasource.
Using the document context prefix.
When iterating data from a datasource, with the intent to update or display or manipulate releated information in the document data (form data), the problem is similar. Consider the following example:
<!--========================================--> <!-- XML Document ( form data ) --> <!-- Representing one ore more timesheet(s) --> <!--========================================--> <doc> <timesheets> <timesheet customer_id="1236"> .. </timesheet> </timesheets> </doc>
xml
<!--==============================--> <!-- XML datasource ( customers ) --> <!--==============================--> <doc> <customers> <customer id="1236"> .. </customer> </customers> </doc>
xml
If we iterate a datasource "customers", and the want to output information from corresponding timesheet data in document, we must explicitly tell the Digiforms Xpath processor that we are breaking out of the datasource document context.
<xsl:for-each select="$customers/doc/customers/customer"> <xsl:variable name="$bind" select="@id"></xsl:variable> <!--==================================================================================--> <!-- Using the $digiforms:documentData prefix to change context back to document data --> <!--==================================================================================--> <xsl:value-of select="$digiforms:documentData//timesheet[@customer_id = $bind]/..."></xsl:value> </xsl:for-each>
xslt