c# - forcing xslt to use version 2 with xslCompiledTransform -
i have following xslt , need use xslt version 2.0 functions 'format-date'. how declare xsl sheet use version 2.0 using xsltcompiledtransform class (c#, .net 4.5).
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns="http://www.w3.org/tr/xhtml1/strict" xmlns:msxsl='urn:schemas-microsoft-com:xslt' xmlns:var='urn:var' xmlns:js='urn:js' > <xsl:output method="html"/> <xsl:variable name="n" select="1"/> <xsl:template match="/newdataset"> <html> <head> <style> table{border-collapse:collapse;font-family:"verdana";} table,td{border:1px solid black;color:black; background-color:white;font-family:"verdana";} table,th{border:1px solid balck;background-color:black;color:white;font-family:"verdana"; } .rt{color:red;font-family:"verdana";} .nt{color:black;font-family:"verdana";} .redb{color:yellow; background-color:red;font-family:"verdana";} .greenb{color:white;background-color:green;font-family:"verdana";} .blackb{color:white;background-color:black;font-family:"verdana";} </style> <title>edi validation result </title> </head> <body> <p class="nt"> edi validation result of po <span class="rt"><xsl:value-of select="info/pono"/></span> received <xsl:value-of select="info/customername"/>. </p> <table> <th class="blackb" >position</th> <th class="blackb"> item code </th> <th class="blackb">uom</th> <th class="blackb"> ordered qty .</th> <th class="blackb">ship request</th> <th class="blackb"> net-quoted </th> <th class="blackb"> net-catalog </th> <th class="blackb">status</th> <xsl:for-each select="table"> <tr> <xsl:choose> <xsl:when test="status !=''"> <xsl:value-of disable-output-escaping="yes" select="js:incblines()"/> <td class="redb"><xsl:value-of select="position"/></td> <td class="redb"><xsl:value-of select="itemcode "/></td> <td class="redb"><xsl:value-of select="uom"/></td> <td class="redb"><xsl:value-of select="qtyordered"/></td> <td class="redb"><xsl:value-of select="format-date(requiredby,'d1o [mnn] [y0001]')"/></td> <td class="redb"><xsl:value-of select="pricequoted"/></td> <td class="redb"><xsl:value-of select="net"/></td> <td class="redb"><xsl:value-of select="status"/></td> </xsl:when> <xsl:otherwise> <xsl:value-of select="js:incglines()"/> <td class="greenb"><xsl:value-of select="position"/></td> <td class="greenb"><xsl:value-of select="itemcode"/></td> <td class="greenb"><xsl:value-of select="uom"/></td> <td class="greenb"><xsl:value-of select="qtyordered"/></td> <td class="greenb"><xsl:value-of select="format-date(requiredby,'d1o [mnn] [y0001]')"/></td> <td class="greenb"><xsl:value-of select="pricequoted"/></td> <td class="greenb"><xsl:value-of select="net"/></td> <td class="greenb"><xsl:value-of select="status"/>ok</td> </xsl:otherwise> </xsl:choose> </tr> </xsl:for-each> </table> <xsl:if test="js:getblines() > 0" > <p class="nt"> order validation has failed, order not processesed there <xsl:value-of select ="js:getblines()"/> lines in error. <p class="rt"> p.o rejected per agreed processing rules. </p> </p> </xsl:if> <xsl:if test="js:getblines() < 1"> <p class="nt"> order validated succesfully. e-mail order acknoledgement (non-edi) shortly. </p> </xsl:if> </body> </html> </xsl:template> <msxsl:script language='jscript' implements-prefix='js'> <![cdata[ var j :int=0; var blines:int =0; var glines:int=0; function inc(current) {j=j+current; return j+current; } function incblines() { blines++; } function incglines() { glines++; } function getblines() { return blines; } function getglines() { return glines; } ]]> </msxsl:script> </xsl:stylesheet>
microsoft's xslcompiledtransform xslt 1.0 processor. use xslt 2.0 .net, have 2 third party options, .net version of saxon 9 http://saxon.sourceforge.net/ or xmlprime. saxon has open source version , 2 commercial versions pe , ee, xmlprime commercial use requires license.
Comments
Post a Comment