Question might seem silly so please pardon but can some one kindly explain the usage of dp:serialize.
I read somewhere that it converts node set into byte stream.
what does the byte stream means is it referring to 1 and 0 ??
Also please let me know few of the scenarios where we need to use this dp extension function.
Thanks
When you're in the midst of your XSLT processing, all the bits of XML you're dealing with (the input document, the context nodes, the node-sets in xsl:variables) are not text, they are optimized trees in DataPower's memory. There may be some point in your processing where you would like some chunk of XML converted to text. As an example, maybe you want to encrypt it. (Just raw AES encryption, none of those fancy OASIS XML crypto standards.) This is where dp:serialize comes in. It will convert the in-memory node-set into a string containing XML-syntax text.
Code. We need code.
<xsl:variable name="my-node-set">
<xyzzy>
<plugh>Nothing happens.</plugh>
</xyzzy>
</xsl:variable>
<xsl:variable name="my-xml-string">
<dp:serialize select="$my-node-set"/>
</xsl:variable>
<xsl:variable name="my-ciphered"
select="dp:encode($alg-aes, $secret-key, $my-xml-string)"/>
If you need to go the other way -- you've got a string that you are fairly sure is in XML format and would like to turn it into an xsl:variable containing a node-set (so that you can use XPath to navigate through it) -- then you would use dp:parse:
<xsl:variable name="my-node-set"
select="dp:parse($my-string)"/>
I've never quite been able to figure out why they decided to implement <dp:serialize> as an extension element and dp:parse() as an extension function. Seems asymmetrical to me.