I have a ticketing system which receives emails formatted in xml sent by users. The system uses an xslt script to convert the xml formatted email into the supported xml format that the system uses to create a ticket.
Below is an example of the email format which is sent to the system:
The content found between the tag Description is copied into the description of the ticket is below:
First Name: Paul
Last Name: Bonthuys
Email Address: [email protected]
Contact Number: 0123456789
How can we help you: Testing
The issue I am having is that all the text after the email address is cut and not displayed in the ticket description field. So the description field only shows as below:
First Name: Paul
Last Name: Bonthuys
Email Address: [email protected]
Of course I have the option of moving the email address to the end of the Description tag, but I will like to keep the sequence of how the information is displayed i.e. First Name, Last Name, Email Address, Contact Number. I am suspecting that the email address hyperlink is causing the text after it to be cut and not being displayed.
Below is a sample of my xslt script which copies the content of my email into the ticket description field:
Anyone has an idea of how I could strip the hyperlink in the email address so that some texts are not cut?
XSLT CODE
<xsl:variable name="Subject" select = "BusinessObjectList/BusinessObject/EmailMessage/Subject"/>
<xsl:choose>
<xsl:when test="contains($Subject,'Incident#')">
<xsl:call-template name="INCIDENT-UPDATE"/>
</xsl:when>
<xsl:when test="contains(translate($Subject,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), 'printer')">
<xsl:call-template name="INCIDENT-KEYWORD-PRINTER"/>
</xsl:when>
<xsl:when test="contains(translate($Subject,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), 'outlook')">
<xsl:call-template name="INCIDENT-KEYWORD-OUTLOOK"/>
</xsl:when>
<xsl:when test="contains($Subject,'Service Request#')">
<xsl:call-template name="SERVICE-REQUEST-UPDATE"/>
</xsl:when>
<xsl:when test="contains($Subject,'Task#')">
<xsl:call-template name="TASK-UPDATE"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="INCIDENT-NEW" />
</xsl:otherwise>
</xsl:choose>
</BusinessObjectList>
</xsl:template>
<xsl:template name="INCIDENT-NEW">
<!--
Erzeugt aus der e-Mail den XML Code zum Aktualisieren Anlage eines neuen Incidents
- Die Attachments werden dem Incident hinzugefĆ¼gt
Beispielaufruf:
<xsl:call-template name="INCIDENT-NEW" />
-->
<!-- find the profile link recid of the email sender -->
<xsl:variable name="profilelink_recid">
<!-- for each RelatedBusinessObject -->
<xsl:for-each select="BusinessObjectList/BusinessObject/RelatedBusinessObjectList/RelatedBusinessObject/BusinessObject">
<xsl:choose>
<xsl:when test="@Name = 'Employee'">
<xsl:for-each select="./FieldList/Field">
<xsl:choose>
<xsl:when test="@Name = 'RecId'">
<!-- <xsl:value-of select="."/>-->
<xsl:value-of select="'620F9E6687914E61A386572763768870'"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:variable>
<!-- find the profile link category of the email sender -->
<xsl:variable name="profilelink_cat">
<!-- for each RelatedBusinessObject -->
<xsl:for-each select="BusinessObjectList/BusinessObject/RelatedBusinessObjectList/RelatedBusinessObject/BusinessObject">
<xsl:choose>
<xsl:when test="@Name = 'Employee'">
<xsl:value-of select="'Employee'"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:variable>
<!-- for each BusinessObject -->
<xsl:for-each select="BusinessObjectList/BusinessObject">
<!-- Set the BO name -->
<xsl:element name="BusinessObject">
<!-- Set BO Name as 'Incident' -->
<xsl:attribute name="Name">
<xsl:value-of select="'Incident'"/>
</xsl:attribute>
<!-- Set Transaction as 'Insert' -->
<xsl:element name="Transaction">UpdateAdd</xsl:element>
<!--Unique Key List-->
<xsl:element name="UniqueKeyList">
<xsl:element name="UniqueKey">
<xsl:element name="Field">
<xsl:attribute name="Name">
<xsl:value-of select="'IncidentNumber'"/>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
<!-- Field List -->
<FieldList>
<!-- Fields -->
<xsl:for-each select="EmailMessage/node()">
<xsl:choose>
<!-- Incident.Subject = Email.Subject-->
<xsl:when test="name() = 'Subject'">
<xsl:element name="Field">
<xsl:attribute name="Name">
<xsl:value-of select="'Subject'"/>
</xsl:attribute>
<xsl:attribute name="Type">System.String</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
<xsl:element name="Field">
<xsl:attribute name="Name">
<xsl:value-of select="'Category'"/>
</xsl:attribute>
<xsl:attribute name="Type">System.String</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
</xsl:when>
<xsl:when test="name() = 'Body'">
<xsl:variable name="emailbody" method="html" indent="yes" >
Text string link problem
Hi guys,
When I put a full link in the text string using "http://www". the link works but if you only use "www", it just links to the node path.
Any way around this? I want it so either way, the link will work with or without http://?
Hi Devin,
Have a look at this way of doing it - it's a totally different (yet more "XSLT-like") approach, I know, but you may like it :-)
At least you should be able to see how you can actually rewrite an attribute depending on some condition, which is what you're looking for...
/Chriztian
You always kill it when it comes to XSLT haha. Thank you greatly, this is perfect. :)
Definitely an interesting way of doing it.
Haha - kind words, thanks :-)
HI Chris .Please can you help with XSLT
Hi all,
I have a ticketing system which receives emails formatted in xml sent by users. The system uses an xslt script to convert the xml formatted email into the supported xml format that the system uses to create a ticket.
Below is an example of the email format which is sent to the system:
The content found between the tag Description is copied into the description of the ticket is below:
First Name: Paul Last Name: Bonthuys Email Address: [email protected] Contact Number: 0123456789 How can we help you: Testing
The issue I am having is that all the text after the email address is cut and not displayed in the ticket description field. So the description field only shows as below:
First Name: Paul Last Name: Bonthuys Email Address: [email protected]
Of course I have the option of moving the email address to the end of the Description tag, but I will like to keep the sequence of how the information is displayed i.e. First Name, Last Name, Email Address, Contact Number. I am suspecting that the email address hyperlink is causing the text after it to be cut and not being displayed.
Below is a sample of my xslt script which copies the content of my email into the ticket description field:
Anyone has an idea of how I could strip the hyperlink in the email address so that some texts are not cut? XSLT CODE
TIA.
is working on a reply...