I am using XSLT to transform a large XML into CSV and the requirement is to have the last column of CSV the actual XML data in base64 encoded string. I have been successful with transforming to CSV but stuck on the base64 encoding part. I came across this stack overflow answer to encode as base64 string. I am unable to figure out how to select the entire node and pass it as argument to the template call. Below is sample XML, XSL and CSV format.
XML
<Products>
<Product Name="ABC" Description="Sample description" Price="10.0">
Additional child nodes here...
</Product>
<Product Name="XYZ" Description="Sample description" Price="15.0">
Additional child nodes here...
</Product>
<Product Name="DEF" Description="Sample description" Price="16.0">
Additional child nodes here...
</Product>
</Products>
CSV
Name,Description,Price,....,EncodedXML
ABC,SampleDescription,10.0,....,Base64string
XYZ,SampleDescription,15.0,....,Base64string
DEF,SampleDescription,16.0,....,Base64string
XSL:
<xsl:template match="/">
<xsl:for-each select="//Product">
<xsl:call-template name="b64:encode">
<xsl:with-param name="asciiString" select="."/>
</xsl:call-template>
<xsl:for-each>
</xsl:template>