I am having a problem with saving a context to a variable as XML and then processing the value of the variable in a stylesheet. If the data from the context doesn't include a <?xml ?> prolog, the processing in my stylesheet fails. If I add an identity transform action before the setvar just going from context to the same context, it works.
Here's more details.
The context I'm processing is coming from a backend service after a results action. In this case, the context is INPUT. I am storing it in a variable called var://context/MYCONTEXT/myresults. I have the Output Type specified as XML.
In a transform rule, I am processing all the variables in MYCONTEXT and creating a new XML document from them. The snippet of code looks like this:
<xsl:template match="/"> <xsl:variable name="inputContextName" select="dp:variable('var://service/multistep/input-context-name')"/> <xsl:variable name="contextVariables" select-"dp:variable(concat('var://context/', $inputContextName, '/_extension/variables'))"/> <xsl:variable name="allVars"> <vars> <xsl:for-each select="$contextVariables/variables/variable/text()"> <xsl:variable name="fullVarName" select="."/> <xsl:element name="record"> <xsl:copy-of select="dp:variable($fullVarName)"/> </xsl:element> </xsl:for-each> </vars> </xsl:variable>
If the data written to the variable in the setvar did not include a <?xml ?> prolog, I get <record>store:///notfound</record> in the result.
If I process the INPUT context with a stylesheet, I can get the value as XML fine, or if insert an identity transform from INPUT to INPUT like I mentioned, it works fine. I am trying to avoid having to add extra actions like this when it seems like it should work to write it to a variable with Output Type XML.