In this post we talk about context of error in subject.
XSLT 1.0 spec has a data type called 'result tree fragment' and this data type is introduced by XSLT variables.A result tree fragment is treated equivalently to a node-set that contains just a single root node. However, the operations permitted on a result tree fragment are a subset of those permitted on a node-set.In particular, it is not permitted to use the /, //, and [] operators on result tree fragments
For example, if we have xslt like below then that is scope for mentioned error
<xsl:stylesheet version="1.0"....
<xsl:param name="InputVariable.payload" />
<xsl:template match="/">
<top:ResultTreeCollection>
<top:Application>
<xsl:value-of select="$InputVariable.payload/ns1:Applications/ns1:ApplicationName" />
</top:Application>
...
</xsl:stylesheet>
In above XSLT, we are trying to access a BPEL variable called "InputVariable"(having result tree fragment data type) and applying an operation '/' which is not allowed as per XSLT 1.0 spec
There are two solutions possible
Same error comes when xsl:variable is defined to have sequence of nodes. For example <xsl:variable name="Applications" select="./ApplicationsList" />
XSLT 1.0 spec has a data type called 'result tree fragment' and this data type is introduced by XSLT variables.A result tree fragment is treated equivalently to a node-set that contains just a single root node. However, the operations permitted on a result tree fragment are a subset of those permitted on a node-set.In particular, it is not permitted to use the /, //, and [] operators on result tree fragments
For example, if we have xslt like below then that is scope for mentioned error
<xsl:stylesheet version="1.0"....
<xsl:param name="InputVariable.payload" />
<xsl:template match="/">
<top:ResultTreeCollection>
<top:Application>
<xsl:value-of select="$InputVariable.payload/ns1:Applications/ns1:ApplicationName" />
</top:Application>
...
</xsl:stylesheet>
In above XSLT, we are trying to access a BPEL variable called "InputVariable"(having result tree fragment data type) and applying an operation '/' which is not allowed as per XSLT 1.0 spec
There are two solutions possible
- Using Oracle xslt extension function node-set() which converts result tree fragment to node set
- Use XSLT 2.0 version
Same error comes when xsl:variable is defined to have sequence of nodes. For example <xsl:variable name="Applications" select="./ApplicationsList" />
dude you saved my day.. terrific blog
ReplyDelete