Hello,
I am using the xslt service in Software AG Designer 10.11
The stylesheet version is 2.0
What I am trying to do is generate an html page from an xml string. Then I write it to a file location and send an e-Mail with the content as a file attachment.
In debug mode, everything goes fine. I can write the html page away to a file location and send an e-mail with the html content.
The problem is as follows:
When the package is not in debug mode, the xml data is missing, so it basically writes only the html tags and the variable xml data is missing.
Does anyone have any idea what is going wrong here?
Kind regards,
GvB
Hi Giel,
please check where the xml should come from when not running in debug mode.
Please provide some samples together with xslt being used.
Regards,
Holger
Hello Holger,
xslt that I use:
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version='2.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match='/'>
<!-- TODO: Auto-generated template -->
<html>
<head>
<meta http-equiv='content-type' content='text/html; charset=UTF-8' />
<style>
table, tr, td {border: none;}
</style>
</head>
<body>
<table width='100%' style='border: 1px solid;'>
<tr><td>Customer Reference</td><td>Shipper Reference</td><td></td><td></td></tr>
<xsl:for-each select='ShippingInstructions'>
<tr><td style='width:25%;'><xsl:value-of select='ConsignmentReferences/UCR'></xsl:value-of></td><td style='width:25%;'><xsl:value-of select='ConsignmentReferences/ShipperReference'></xsl:value-of></td></tr>
</xsl:for-each>
</table>
<table>
<tr height='10px'><td></td></tr>
</table>
<table width='100%' style='border: 1px solid;border-collapse: collapse;font-size:16px;'>
<tr style='background-color:#eee;'><td colspan='5' style='font-weight:bold;'>Verlader</td></tr>
<tr style='background-color:#eee;'>
<td style='width:20%;'>AddressId</td>
<td style='width:20%;'>Name</td>
<td style='width:20%;'>Street</td>
<td style='width:20%;'>PostalCode</td>
<td style='width:20%;'>City</td>
</tr>
<xsl:for-each select='ShippingInstructions/ConsignmentInformation/ShippingParty'>
<tr style='background-color:#eee;'>
<td><xsl:value-of select='AddressID'></xsl:value-of></td>
<td><strong><xsl:value-of select='Name'></xsl:value-of></strong></td>
<td><xsl:value-of select='Street'></xsl:value-of></td>
<td><xsl:value-of select='PostalCode'></xsl:value-of></td>
<td><xsl:value-of select='City'></xsl:value-of></td>
</tr>
</xsl:for-each>
</table>
<table>
<tr height='10px'><td></td></tr>
</table>
<table width='100%' style='border: 1px solid;'>
<tr style='background-color:#eee;'><td colspan='2' style='font-weight:bold;width:50%;'>Laadplaats</td><td colspan='2' style='font-weight:bold;width:50%;'>Losplaats</td></tr>
<xsl:for-each select='ShippingInstructions/ConsignmentInformation'>
<tr><td width='10%'>AddressId</td><td width='40%'><xsl:value-of select='ConsignorParty/AddressID'></xsl:value-of></td><td width='10%'>AddressId</td><td width='40%'><xsl:value-of select='ConsigneeParty/AddressID'></xsl:value-of></td></tr>
<tr><td width='10%'>Name</td><td width='40%'><xsl:value-of select='ConsignorParty/Name'></xsl:value-of></td><td width='10%'>Name</td><td width='40%'><xsl:value-of select='ConsigneeParty/Name'></xsl:value-of></td></tr>
<tr><td width='10%'>Street</td><td width='40%'><xsl:value-of select='ConsignorParty/Street'></xsl:value-of></td><td width='10%'>Street</td><td width='40%'><xsl:value-of select='ConsigneeParty/Street'></xsl:value-of></td></tr>
<tr><td width='10%'>PostalCode</td><td width='40%'><xsl:value-of select='ConsignorParty/PostalCode'></xsl:value-of></td><td width='10%'>PostalCode</td><td width='40%'><xsl:value-of select='ConsigneeParty/PostalCode'></xsl:value-of></td></tr>
<tr><td width='10%'>City</td><td width='40%'><xsl:value-of select='ConsignorParty/City'></xsl:value-of></td><td width='10%'>City</td><td width='40%'><xsl:value-of select='ConsigneeParty/City'></xsl:value-of></td></tr>
<tr><td width='10%'></td><td width='40%'><strong><xsl:value-of select='ShipmentReadyDate/Date'></xsl:value-of></strong></td><td width='10%'></td><td width='40%'><strong><xsl:value-of select='FixedDeliveryDate/Date'></xsl:value-of></strong></td></tr>
</xsl:for-each>
</table>
<table>
<tr height='10px'><td></td></tr>
</table>
<table width='100%' style='border: 1px solid;'>
<tr style='font-weight:bold;background-color:#eee;'><td colspan='7'>GoodsItems</td></tr>
<tr>
<td style='border-bottom:1px solid;'>Hoeveelheid</td>
<td style='border-bottom:1px solid;'>PackagingCode</td>
<td style='border-bottom:1px solid;'>PartDescription</td>
<td style='border-bottom:1px solid;'>WeightUnitCode</td>
<td style='border-bottom:1px solid;'>GrossWeight</td>
<td style='border-bottom:1px solid;'>CubeUbitCode</td>
<td style='border-bottom:1px solid;'>Volume</td>
</tr>
<xsl:for-each select='ShippingInstructions/GoodsItems/Items'>
<tr>
<td><xsl:value-of select='Quantity'></xsl:value-of></td>
<td><xsl:value-of select='PackagingCode'></xsl:value-of></td>
<td><xsl:value-of select='PartDescription'></xsl:value-of></td>
<td><xsl:value-of select='Weight/WeightUnitCode'></xsl:value-of></td>
<td><xsl:value-of select='Weight/GrossWeight'></xsl:value-of></td>
<td><xsl:value-of select='Cube/CubeUnitCode'></xsl:value-of></td>
<td><xsl:value-of select='Cube/CubicVolume'></xsl:value-of></td>
</tr>
</xsl:for-each>
</table>
<table>
<tr height='10px'><td></td></tr>
</table>
<table width='100%' style='border: 1px solid;'>
<tr style='font-weight:bold;background-color:#eee;'><td colspan='2'>Gewicht (totaal)</td></tr>
<xsl:for-each select='ShippingInstructions/GoodsItems/GoodsAdditionalSpecs'>
<tr><td width='10%'><xsl:value-of select='Value'></xsl:value-of></td><td><xsl:value-of select='UnitCode'></xsl:value-of></td></tr>
</xsl:for-each>
</table>
<table>
<tr height='10px'><td></td></tr>
</table>
<table width="100%" style="border: 1px solid;">
<tr style="background-color:#eee;"><td style="font-weight:bold;">Transport opmerkingen</td></tr>
<xsl:for-each select="ShippingInstructions/SpecialInstructions">
<tr style="background-color:#eee;">
<td><xsl:value-of select="."></xsl:value-of></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Example of the xml from the pipeline
<?xml version="1.0" encoding="UTF-8"?>
<ShippingInstructions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ConsignmentReferences>
<UCR>001234567879</UCR>
<ShipperReference>0018264513 5016882668</ShipperReference>
</ConsignmentReferences>
<ConsignmentInformation>
<ConsignmentStatusCoded>N</ConsignmentStatusCoded>
<DeliveryTermsCoded>DDA</DeliveryTermsCoded>
<FixedDeliveryDate>
<Date>2024-01-23</Date>
<Time>00:00:00</Time>
<TimeTill>00:00:00</TimeTill>
</FixedDeliveryDate>
<ShipmentReadyDate>
<Date>2024-01-17</Date>
<Time>00:00:00</Time>
<TimeTill>00:00:00</TimeTill>
</ShipmentReadyDate>
<ShippingParty>
<AddressID>012345</AddressID>
<Name>ShippingParty</Name>
<Street>ShippingStreet</Street>
<PostalCode>ShippingPostalCode</PostalCode>
<City>ShippingCity</City>
<CountryCode>CC</CountryCode>
</ShippingParty>
<ConsignorParty>
<Name>ConsignorParty NV</Name>
<Street>ConsignorStreet 1</Street>
<PostalCode>ConsignorPostalCode</PostalCode>
<City>ConsignorCity</City>
<CountryCode>CC</CountryCode>
</ConsignorParty>
<ConsigneeParty>
<Name>Consignee GmbH</Name>
<Street>ConsigneeStreet</Street>
<PostalCode>ConsigneePostalCode</PostalCode>
<City>ConsigneeCity</City>
<CountryCode>CC</CountryCode>
</ConsigneeParty>
</ConsignmentInformation>
<GoodsItems>
<GoodsAdditionalSpecs>
<SpecCode>Volume</SpecCode>
<Value>5076</Value>
<UnitCode>kg</UnitCode>
</GoodsAdditionalSpecs>
<GoodsAdditionalSpecs>
<SpecCode>Volume</SpecCode>
<Value>6.96</Value>
<UnitCode>cbm</UnitCode>
</GoodsAdditionalSpecs>
<Items>
<Quantity>80.000</Quantity>
<PackagingCode>PCE</PackagingCode>
<PartDescription>PartDescription</PartDescription>
<Weight>
<WeightUnitCode>KGM</WeightUnitCode>
<GrossWeight>2376.000</GrossWeight>
</Weight>
<Cube>
<CubeUnitCode>M3</CubeUnitCode>
<CubicVolume>2.160</CubicVolume>
</Cube>
</Items>
<Items>
<Quantity>40.000</Quantity>
<PackagingCode>PCE</PackagingCode>
<PartDescription>PartDescription</PartDescription>
<Weight>
<WeightUnitCode>KGM</WeightUnitCode>
<GrossWeight>2700.000</GrossWeight>
</Weight>
<Cube>
<CubeUnitCode>M3</CubeUnitCode>
<CubicVolume>4.800</CubicVolume>
</Cube>
</Items>
</GoodsItems>
<SpecialInstructions>Loading period: 2024-01-17 - 2024-01-17</SpecialInstructions>
<SpecialInstructions> Delivery period: 2024-01-17 - 2024-01-23</SpecialInstructions>
<SpecialInstructions></SpecialInstructions>
<SpecialInstructions>PT: CamiĂŁo SR - Sem processo descarga</SpecialInstructions>
<SpecialInstructions>NL: Vrachtwagen algemeen - Normaal</SpecialInstructions>
<SpecialInstructions>ES: Cam. 28t-Semi Grande - No special processing</SpecialInstructions>
<SpecialInstructions>EN: Truck general - No special processing</SpecialInstructions>
<SpecialInstructions>PL: Ciężarówka ogólnie - Brak specj. przetw.</SpecialInstructions>
<SpecialInstructions>DE: LKW Normalfahrzeug - Normalfahrzeug ohne Entladung</SpecialInstructions>
<SpecialInstructions>FR: Camion general - Standard</SpecialInstructions>
<SpecialInstructions>HU: Fuvar általában - Nincs spec. Eljárás</SpecialInstructions>
<SpecialInstructions>IT: Camion generale - Normale</SpecialInstructions>
<SpecialInstructions></SpecialInstructions>
<AdditionalInformation>
<Code>tpw_link</Code>
</AdditionalInformation>
</ShippingInstructions>
!NOTE:
If you run the xsltService directly and put the sample xml into xmldata, you might get something like “Invalid byte 2 or 4-byte UTF-8 sequence; Line#: 88; Column#: 34”.
This is not the case if you create a flow calling the xsltService, where you can set the encoding to UTF-8
Hi,
The problem has been solved by changing the special characters that where in the string e.g.
à to Ă , saving the file as proper UTF-8 and re-submit it.
Br,
1 Like