the following code using transform xml document html document:
xsltransform vxsltransform = new xsltransform(); xmlreader vreader = new xmltextreader(new stringreader(this.xslt)); vxsltransform.load(vreader,null xmlresolver, null system.security.policy.evidence); stringwriter vstringwriter = new stringwriter(); vxsltransform.transform(this.xmldocument, null, vstringwriter, null);
this code has been working years. come along, , want add url mix. can see new url in xml below (corereturnlabel element):
<corereturnemail> <corereturnlabel>https://www.example.com/somepage.pdf?token=eaf5383bddb9382f5&createdby=f01ddedb0aedd87fe44b9b9b741</corereturnlabel> <corereturn> <corereturnid>12345</corereturnid> <hashedcorereturnid>sdjhgfuidhcbjhsdgifljsdjgfuio</hashedcorereturnid> <vendorshipitem> <quantity>1</quantity> <vendorshipment> <actualshipdate>5/31/2016</actualshipdate> </vendorshipment> <vendororderitem> <orderitem> <corecharge>40.00</corecharge> <partsearchsku> <item> <name>some name</name> <description>that thing</description> <displaynumber>734-3647-4748</displaynumber> <brand> <preferredname>brand</preferredname> </brand> <additionalshippingtype> <description>no additional shipping charges</description> </additionalshippingtype> </item> </partsearchsku> <orderitemstate> <name>sourced</name> </orderitemstate> <quantity>5</quantity> <unitsellingprice>179.00</unitsellingprice> <linediscounttotal>0.00</linediscounttotal> <linetotal>895.00</linetotal> <unitaddshippingfee>0.00</unitaddshippingfee> <unitaddshippingfeelinetotal>0.00</unitaddshippingfeelinetotal> <isoversizedshipping>false</isoversizedshipping> </orderitem> <vendororder> <ordernumber>12345678</ordernumber> <order> <returnsportalurl></returnsportalurl> <shiptofirstname>chicago</shiptofirstname> <shiptolastname>chicago</shiptolastname> <shiptoaddressline1>1600 parkway pkwy</shiptoaddressline1> <shiptoaddressline2></shiptoaddressline2> <shiptocompany>chicago</shiptocompany> <shiptocity>the one</shiptocity> <shiptopostalcode>12345</shiptopostalcode> <shiptoprovince> <code>al</code> </shiptoprovince> <shiptocountry> <name>united states</name> </shiptocountry> <billtofirstname>yep</billtofirstname> <billtolastname>me</billtolastname> <billtoaddressline1>that place</billtoaddressline1> <billtoaddressline2></billtoaddressline2> <billtocompany>chicago</billtocompany> <billtocity></billtocity> <billtopostalcode>12345</billtopostalcode> <billtoprovince> <code>al</code> </billtoprovince> <billtocountry> <name>united states</name> </billtocountry> <orderchannel> <name>oc1</name> <displayname>oc1</displayname> <code></code> <authorizationtype> <name></name> <code></code> <description></description> </authorizationtype> <primaryurl></primaryurl> <websiteorderchannelcode></websiteorderchannelcode> <customerservicephone></customerservicephone> <phonedescription></phonedescription> <emaildomain></emaildomain> <clientcode></clientcode> <pci></pci> <clientprogram> <brandedname></brandedname> <daysallowedforcorereturn></daysallowedforcorereturn> </clientprogram> </orderchannel> </order> <vendor> <name></name> </vendor> </vendororder> </vendororderitem> </vendorshipitem> </corereturn>
the xslt follows:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output indent="no" method="html" /> <xsl:template match="/"> <xsl:variable name="isfred"> <xsl:choose> <xsl:when test="contains(corereturnemail/corereturn/vendorshipitem/vendororderitem/vendororder/order/orderchannel/websiteorderchannelcode,'gssc')"> yes </xsl:when> </xsl:choose> </xsl:variable> <html> <head> <title>your core has been received</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body style="font-family : arial, sans-serif;"> <table width="700" cellspacing="0" cellpadding="0"> <tr> <td> <xsl:choose> <xsl:when test="string($isfred)"> <img src="http://content.gif" border="0" /> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="string-length(corereturnemail/corereturn/vendorshipitem/vendororderitem/vendororder/order/orderchannel/primaryurl) > 0"> <a href="http://{corereturnemail/corereturn/vendorshipitem/vendororderitem/vendororder/order/orderchannel/primaryurl}"> <img src="http://content.gif" border="0" /> </a> </xsl:when> <xsl:otherwise> <img src="http://content.gif" border="0" /> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> <br /> <br /> <span style="font-family : tahoma, arial, sans-serif; font-size:21pt; font-weight : bold; color : #1f415c;">core return:</span> <span style="font-family : tahoma, arial, sans-serif; font-size:17pt; font-weight : bold; color : #1f415c;"> order #</span> <span style="font-family : tahoma, arial, sans-serif; font-size:17pt; font-weight : bold; color : #f43400;"> <xsl:text></xsl:text> <xsl:value-of select="corereturnemail/corereturn/vendorshipitem/vendororderitem/vendororder/ordernumber" /> </span> <br /> <br /> <span style="font-family : arial, sans-serif;font-size:14pt;">hello <xsl:if test="corereturnemail/corereturn/vendorshipitem/vendororderitem/vendororder/order"><xsl:text></xsl:text><xsl:value-of select="corereturnemail/corereturn/vendorshipitem/vendororderitem/vendororder/order/shiptofirstname" /></xsl:if>,</span> <br /> <br /> <span style="font-family : arial, sans-serif;font-size:14pt;"> email communication provide information necessary make core return fast , easy. <br /><br /> complete core return, please email <a href="mailto:othershared@company.com">othershared@company.com</a>. </span> <br /> <br /> <br /> <table style="background-color:#dfedf3;" cellpadding="5"> <tr> <td style="font-size:9pt;font-weight:bold;">core for:</td> <td style="font-family : arial, sans-serif;font-size:9pt;"> <xsl:value-of select="corereturnemail/corereturn/vendorshipitem/vendororderitem/vendororder/order/orderchannel/clientprogram/brandedname" /> </td> </tr> <tr> <td style="font-size:9pt;font-weight:bold;">part ship date:</td> <td style="font-family : arial, sans-serif;font-size:9pt;"> <xsl:value-of select="corereturnemail/corereturn/vendorshipitem/vendorshipment/actualshipdate" /> </td> </tr> <xsl:for-each select="corereturnemail/corereturn/vendorshipitem/vendororderitem/vendororder/order/additionalinformation"> <xsl:if test="(string-length(name) > 0) , (string-length(value) > 0)"> <tr> <td style="font-size:9pt;font-weight:bold;"> <xsl:value-of select="name" />:</td> <td style="font-family : arial, sans-serif;font-size:9pt;"> <xsl:value-of select="value" /> </td> </tr> </xsl:if> </xsl:for-each> <tr> <td style="font-size:9pt;font-weight:bold;">other order number:</td> <td style="font-family : arial, sans-serif;font-size:9pt;"> <xsl:value-of select="corereturnemail/corereturn/vendorshipitem/vendororderitem/vendororder/ordernumber" /> </td> </tr> </table> <br /> <br /> <br /> <xsl:apply-templates select="corereturnemail/corereturn/vendorshipitem" /> <br /> <table style="width:100%;background-color:#dfedf3;" cellspacing="5"> <tr> <td style="font-family : tahoma, arial, sans-serif; font-size:17pt; font-weight : bold; color : #1f415c;">customer service</td> <td style="width:65%"> <hr style="width:100%;border:1px solid #5165a3;" /> </td> </tr> <tr> <td colspan="2" style="font-family : arial, sans-serif;font-size:12pt;"> please return cores within <xsl:value-of select="corereturnemail/corereturn/vendorshipitem/vendororderitem/vendororder/order/orderchannel/clientprogram/daysallowedforcorereturn" /> days of part ship date ensure claim payments not affected.<br /><br /> if have questions on core return please email @ <a href="mailto:othershared@company.com">othershared@company.com</a>.<br /><br /> please don't reply email. mail sent address can't answered.<br /><br /></td> </tr> <tr> <td colspan="2" style="font-family : arial, sans-serif;font-size:12pt;">please click <a href="{/corereturnemail/corereturnlabel}" target="_blank">here</a> view core return label.</td> </tr> </table> <br /> <br /> <br /> </td> </tr> </table> </body> </html> </xsl:template> <xsl:template match="corereturnemail/corereturn/vendorshipitem"> <table style="width:100%;" cellspacing="0"> <tr style="font-family: tahoma, arial, sans-serif; background-color : #34498c; color : white; font-size : 10pt; font-weight : bold;"> <td style="padding:5px;">brand</td> <td style="padding:5px;white-space:nowrap;">part no.</td> <td style="padding:5px;">description</td> <td style="padding:5px;">status</td> <td style="padding:5px;">qty.</td> <td style="padding:5px;white-space:nowrap;">core charge</td> </tr> <tr> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-left : 2px solid #dfedf3; border-bottom : 2px solid #dfedf3; padding : 5px;" valign="top"> <xsl:value-of select="vendororderitem/orderitem/othersku/item/brand/preferredname" /> </td> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-bottom : 2px solid #dfedf3;padding:5px;" valign="top"> <xsl:value-of select="vendororderitem/orderitem/othersku/item/displaynumber" /> </td> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-bottom : 2px solid #dfedf3;padding:5px;" valign="top"> <xsl:if test="string(vendororderitem/orderitem/othersku/item/description)"> <xsl:value-of select="vendororderitem/orderitem/othersku/item/description" /> </xsl:if> </td> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-bottom : 2px solid #dfedf3;padding:5px;" valign="top"> <xsl:value-of select="vendororderitem/orderitem/orderitemstate/name" /> </td> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-bottom : 2px solid #dfedf3;text-align:right;padding:5px;" valign="top"> <xsl:value-of select="quantity" /> </td> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-right : 2px solid #dfedf3; border-bottom : 2px solid #dfedf3; padding : 5px;font-weight:bold;padding:5px;text-align:right;" valign="top"> <xsl:value-of select="format-number(vendororderitem/orderitem/corecharge, '$###,##0.00')" /> </td> </tr> </table> </xsl:template> </xsl:stylesheet>
which transforms to:
<html> <head> <title>your core has been received</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body style="font-family : arial, sans-serif;"> <table width="700" cellspacing="0" cellpadding="0"> <tr> <td> <img src="http://content.gif" border="0"> <br> <br> <span style="font-family : tahoma, arial, sans-serif; font-size:21pt; font-weight : bold; color : #1f415c;">core return:</span> <span style="font-family : tahoma, arial, sans-serif; font-size:17pt; font-weight : bold; color : #1f415c;"> order #</span> <span style="font-family : tahoma, arial, sans-serif; font-size:17pt; font-weight : bold; color : #f43400;">12345678</span> <br> <br> <span style="font-family : arial, sans-serif;font-size:14pt;">hello chicago,</span> <br> <br> <span style="font-family : arial, sans-serif;font-size:14pt;"> email communication provide information necessary make core return fast , easy. <br> <br> complete core return, please email <a href="mailto:othershared@company.com">othershared@company.com</a>. </span> <br> <br> <br> <table style="background-color:#dfedf3;" cellpadding="5"> <tr> <td style="font-size:9pt;font-weight:bold;">core for:</td> <td style="font-family : arial, sans-serif;font-size:9pt;"/> </tr> <tr> <td style="font-size:9pt;font-weight:bold;">part ship date:</td> <td style="font-family : arial, sans-serif;font-size:9pt;">5/31/2016</td> </tr> <tr> <td style="font-size:9pt;font-weight:bold;">other order number:</td> <td style="font-family : arial, sans-serif;font-size:9pt;">12345678</td> </tr> </table> <br> <br> <br> <table style="width:100%;" cellspacing="0"> <tr style="font-family: tahoma, arial, sans-serif; background-color : #34498c; color : white; font-size : 10pt; font-weight : bold;"> <td style="padding:5px;">brand</td> <td style="padding:5px;white-space:nowrap;">part no.</td> <td style="padding:5px;">description</td> <td style="padding:5px;">status</td> <td style="padding:5px;">qty.</td> <td style="padding:5px;white-space:nowrap;">core charge</td> </tr> <tr> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-left : 2px solid #dfedf3; border-bottom : 2px solid #dfedf3; padding : 5px;" valign="top"/> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-bottom : 2px solid #dfedf3;padding:5px;" valign="top"/> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-bottom : 2px solid #dfedf3;padding:5px;" valign="top"/> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-bottom : 2px solid #dfedf3;padding:5px;" valign="top">sourced</td> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-bottom : 2px solid #dfedf3;text-align:right;padding:5px;" valign="top">1</td> <td style="font-family : tahoma, arial, sans-serif; font-size:9pt; border-right : 2px solid #dfedf3; border-bottom : 2px solid #dfedf3; padding : 5px;font-weight:bold;padding:5px;text-align:right;" valign="top">$40.00</td> </tr> </table> <br> <table style="width:100%;background-color:#dfedf3;" cellspacing="5"> <tr> <td style="font-family : tahoma, arial, sans-serif; font-size:17pt; font-weight : bold; color : #1f415c;">customer service</td> <td style="width:65%"> <hr style="width:100%;border:1px solid #5165a3;"> </td> </tr> <tr> <td colspan="2" style="font-family : arial, sans-serif;font-size:12pt;"> please return cores within days of part ship date ensure claim payments not affected.<br> <br> if have questions on core return please email @ <a href="mailto:othershared@company.com">othershared@company.com</a>.<br> <br> please don't reply email. mail sent address can't answered.<br> <br> </td> </tr> <tr> <td colspan="2" style="font-family : arial, sans-serif;font-size:12pt;">please click <a href="https://www.example.com/somepage.pdf?token=eaf5383bddb9382f5&createdby=f01ddedb0aedd87fe44b9b9b741" target="_blank">here</a> view core return label.</td> </tr> </table> <br> <br> <br> </td> </tr> </table> </body> </html>
as can see, works perfectly. corereturnlabel url shows in online xsl transformations notepad++'s xsl transformation. but, moment passes through initial code:
xsltransform vxsltransform = new xsltransform(); xmlreader vreader = new xmltextreader(new stringreader(this.xslt)); vxsltransform.load(vreader,null xmlresolver, null system.security.policy.evidence); stringwriter vstringwriter = new stringwriter(); vxsltransform.transform(this.xmldocument, null, vstringwriter, null);
...the url empty.
why?
i sorry. hadn't deployed newest application ran transform server. when did, worked fine.
thus, original question correct answer.