If you try to add a list form operation link of the workflow type through the form field in the data view Web Part (DVWP) (or if you manually verify the link based on the steps in the previous article ), this error message may be displayed when you return to the design view:
Failed to set the processor style
Please note that the reference to the variable or parameter 'pos' cannot be parsed as described in the error message. Variables or parameters may be undefined or out of scope. By default, this parameter is out of the current range because it is not passed to a specific template used to display the SAVE and cancel buttons.
1. Search in the Code view: Template name = "dvt_1.automode":
<xsl:template name="dvt_1.automode"> <xsl:param name="KeyField" /> <xsl:param name="KeyValue" /> <xsl:param name="Mode" /> . . .
2. Since the Pos parameter is not defined in this range, Let's enter this range. Add the Pos parameter to the xsl: param set required by the template:
<xsl:template name="dvt_1.automode"> <xsl:param name="KeyField" /> <xsl:param name="KeyValue" /> <xsl:param name="Mode" /> <xsl:param name="Pos" /> . . .
Easy. But...
3. If this template is called without the xsl: with-param of the Pos, we will still have trouble. That is to say, if you add a workflow to access the form field, the Pos must be passed to each place that calls the template.
When searching for the webpart, we found three <xsl: call-template name = "dvt_1.automode"> calls, corresponding to the default template, edit template, and insert template respectively. It's easy to do, just pass down through <xsl: with-param name = "Pos" select = "$ Pos"/>. Because Pos has been defined in this template as a variable or parameter (for editing and inserting a template), you only need to obtain the current Pos value within the current range for transmission.
<Xsl: call-template name = "dvt_1.automode"> <xsl: with-param name = "KeyField"> ID </xsl: with-param> <xsl: with-param name = "KeyValue" select = "ddwrt: EscapeDelims (string (@ ID)"/> <xsl: with-param name = "Mode"> edit </xsl: with-param> <xsl: with-param name = "Pos" select = "$ Pos"/> // very simple. Add this line to pass the $ Pos value </xsl: call-template>
4. However, in the default viewDvt_1.rowviewThe template is also called.Dvt_1.automodeBut there is no $ Pos in its range. Therefore, we need to first pass the template, and then upload it from here.
I. Search:Template name = "dvt_1.body"
<xsl:template name="dvt_1.body"> <xsl:param name="Rows"/> <xsl:for-each select="$Rows"> <xsl:choose> <xsl:when test="$dvt_1_form_editkey = ddwrt:EscapeDelims(string(@ID))"> <xsl:call-template name="dvt_1.rowedit"> <xsl:with-param name="Pos" select="concat('_', position())" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="dvt_1.rowview" /> </xsl:otherwise> </xsl:choose> </xsl:for-each></xsl:template>
This code is all templates for the body part of the form. It is used to render and edit a view and select a standard row view. Take a look at the code in the middle.
Ii. This is a so-called empty tag, that is, the start and end tags of the tag are written together. To expand this tag, We need to delete/from the end and add an end tag </xsl: call-template>. In this way, we can add the with-param flag. For example, call dvt_1.rowedit in the template:
<xsl:otherwise> <xsl:call-template name="dvt_1.rowview"> <xsl:with-param name="Pos" select="concat('_', position())" /> </xsl:call-template></xsl:otherwise>
Iii. After this code, you can easily find the template definition of dvt_1.rowview (if not, searchTemplate name ="Dvt_1.rowview "). Now, we need to add the $ Pos parameter to this template to accept the with-param value we just added in the call-template.
<xsl:template name="dvt_1.rowview"> <xsl:param name="Pos"/> . . .
Now, you can call a workflow from DVWP and access the content you just entered or edited.
Indeed, this article involves some advanced XSLT editing work.
Next time: Isn't it amazing if we can pass a variable to your workflow? No problem at all. In the next expansion of the DVWP series, we will introduce this part.
References
SharePoint: Extending the DVWP-Part 9: Oops! Failed Setting Processor Stylesheet