Node Sets in XSLT Variables MSXML 4.0

In MSXML 4.0 if you create a variable and assign it some xml...

<xsl:variable name="var">
   <
xsl:copy-of select="/a/b"/>
</
xsl:variable>

... you are not able to directly perform xpath on this variable as its value is stored as a tree fragment rather than a node set. Instead you will need to use the node-set xslt function.

This function is an extension so the following namespace must be added:

xmlns:msxsl="urn:schemas-microsoft-com:xslt"

Then for all xpaths on the variable you can use the function to get the node set:

<xsl:value-of select="msxsl:node-set($var)/c"/>

 

Add Comment Filed Under [ XSLT ]
Cryptic error "Queue 'Message Properties...' is not enabled." when firing an event for a State Machine Workflow

I was getting this rather cryptic exception thrown from the WorkflowQueuingService when firing an event for a State Machine Workflow:

Queue 'Message Properties...' is not enabled.

After some investigation it turns out that what this actually means is that the workflow is not in a valid state to handle the event. In other words; the workflow is not waiting on a StateActivity with an EventDrivenActivity that has a HandleExternalActivity bound to the event being fired.

You can also see this error being raised if your workflow has transitioned to the correct state but the workflow itself is not ready to receive the event (for example if it is still initialising). To resolve this you can set the ExternalDataEventArgs.WaitForIdle property of your event args to true which will cause the runtime to queue the event until the workflow has idled and is therefore ready to receive it.