SXI Forum

A place to collect usefull tips, tricks and implementation strategies.

You are not logged in.

#26 Utils and Useful little tools » MsgViewer is email-viewer utility for .msg e-mail messages » 06-05-2019 08:33:39

StephanB
Replies: 0

MsgViewer is email-viewer utility for .msg e-mail messages, implemented in pure Java. MsgViewer works on Windows/Linux/Mac Platforms. Also provides a java api to read mail messges (msg files) programmatically.
https://sourceforge.net/projects/msgviewer/

#28 HOWTOS » Padding Zeros to a Field with XSLT » 08-03-2019 07:08:40

StephanB
Replies: 2

Padding Zeros to a Field with XSLT

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:strip-space elements="*"/>
    <!-- identity transform -->
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="//*[local-name()='CustomerCode']">
        <!-- Define a variable to contain the length of the input value
            The dot you see in the expression is the current element we are working on. 
            In this case CustomerCode is  the Input Value. See the match above-->
        <xsl:variable name="inputLength" select="string-length(.)" />
        <xsl:copy>
            <!-- Now we create a variable to hold our padding. 
                It is a substring of our 10 zeros less the length of our input -->
            <xsl:variable name="padding" select="substring('0000000000',1,10 - $inputLength)"/>
            
            <!-- Finally we simply concatinate our padding which is the correct length with the input value.
                Don't forget the dot you see there is the current element we matched on in this case CustomerCode Input Value -->
            <xsl:value-of select="concat($padding,.)" />
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="//*[local-name()='SiteCode']">
        <!-- Define a variable to contain the length of the input value
            The dot you see in the expression is the current element we are working on. 
            In this case SiteCode is  the Input Value. See the match above-->
        <xsl:variable name="inputLength" select="string-length(.)" />
        <xsl:copy>
            <!-- Now we create a variable to hold our padding. 
                It is a substring of our 10 zeros less the length of our input -->
            <xsl:variable name="padding" select="substring('0000000000',1,10 - $inputLength)"/>
            
            <!-- Finally we simply concatinate our padding which is the correct length with the input value.
                Don't forget the dot you see there is the current element we matched on in this case SiteCode Input Value -->
            <xsl:value-of select="concat($padding,.)" />
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

Here is the input XML you can test with

<?xml version="1.0" encoding="UTF-8"?>
<XServiceBroker xmlns="http://www.sxi.co.za/XMLSchema">
    <CustomerCode>1222B3</CustomerCode>
    <SiteCode>ZB22B3</SiteCode>
</XServiceBroker>

Credit goes to Kevin.

#30 HOWTOS » Setup licence About To Expire Notification to a central XLayer Server » 12-01-2019 08:33:35

StephanB
Replies: 0

Setup the licence About To Expire Notification to a central XLayer server to process the notification.

Add the following style sheet to folder: X:\SXI\XPress\Dispatch\stylesheet

LicAboutToExpireChangeDest.xsl

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.sxi.co.za/XMLSchema"  xmlns:sxi="http://www.sxi.co.za/XMLSchema">
    <xsl:output indent="yes"/>
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="//sxi:Destination">
        <xsl:element name="{local-name()}">
            <!-- Replace the IP below to the central XLayer Notification Server IP -->
            <xsl:value-of select="'192.168.50.71'"/>
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>

Add the following to the Dispatch Initialisation.xml in the ContentTransformations

<!-- This will transform the Notification Doc using the LicAboutToExpireChangeDest.xsl style sheet to send the notification for licence About To Expire to the central XLayer Notification Server IP -->
        <Transformation sendOriginal="no" stylesheetPath="X:\SXI\XPress\Dispatch\stylesheet\LicAboutToExpireChangeDest.xsl">
            <Condition xpath="/sxi:XNotification/sxi:NotificationGroup/@name" value="LicAboutToExpire"/>
        </Transformation>

When done restart the XPressDispatch service.

#31 Re: Case Exchange » Converting a Date Time stamp » 29-12-2018 11:53:50

It's working correct with this Date Converter rule, I changed the Output Date Format to "yyyyy/MM/dd HH:mm:ss".
The seconds are not provided in the input, it will default to "00".

          <sxi:Rules>
            <sxi:DateConverter InputDateFormat="dd MMMM yyyy h:mm a" OutputDateFormat="yyyy/MM/dd HH:mm:ss"/>
          </sxi:Rules>

I have tested the AM / PM .
Tested with Input "24 December 2018 7:52 PM"
Output ----------- <DateTime>2018/12/24 19:52:00</DateTime>

Tested with input "24 December 2018 7:52 AM"
Output ----------- <DateTime>2018/12/24 07:52:00</DateTime>

#32 Re: Case Exchange » Converting a Date Time stamp » 29-12-2018 11:15:58

Hi Sean,
There is no input for the seconds, I will test it and let you know.
Thx.

#33 Case Exchange » Converting a Date Time stamp » 27-12-2018 14:48:26

StephanB
Replies: 3

I need some help on covering the fallowing Date Time stamp from 24 December 2018 7:52 AM to 2018/12/24 07:52:00.

#34 HOWTOS » DOS Script will Count files in the XmlOut and output it to XML file » 08-12-2018 06:36:43

StephanB
Replies: 0

This Script will monitor the XmlOut folder to Count files in the XmlOut folder and output it to XML file for X-ServiceBroker to read the file from the DOS Script below, by adding it to X-ServiceBroker Schedules in the Initialisation.xml you can trigger it there.

@echo off
setlocal enabledelayedexpansion

REM Here I call the  GetUnixTime to get Unix Time to use it in the file name
call :GetUnixTime UNIX_TIME

ECHO ### Checking the number of files in XmlOut ###
set numFiles=0
for %%x in (C:\SXI\XPress\XmlOut\*.*) do (
  set file[!numFiles!]=%%~nfx
  set /a numFiles+=1
 )
REM ### Set Dest and Action 
set Dest=127.0.0.1
set ActionName=Test
set Provider=CountFile
ECHO ### Number of files found: %numFiles% 
REM  ### Set the XML Output attributes
echo ^<?xml version="1.0" encoding="UTF-8"?^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^<XServiceBroker xmlns="http://www.sxi.co.za/XMLSchema"^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^<XHeader^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^<XPress^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^<Destination^>%Dest%^</Destination^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^</XPress^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^<XServiceBroker^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^<ActionName^>%ActionName%^</ActionName^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^<Provider^>%Provider%^</Provider^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^</XServiceBroker^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^</XHeader^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^<Count^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^<TotalFiles^>%numFiles%^</TotalFiles^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^</Count^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
echo ^</XServiceBroker^> >> C:\SXI\XPress\XmlOut\X-ServiceBroker~%Provider%~%UNIX_TIME%.xml
endlocal
REM The GetUnixTim will be: 1341791426 seconds have elapsed since 1970-01-01 00:00:00
:GetUnixTime
setlocal enableextensions
for /f %%x in ('wmic path win32_utctime get /format:list ^| findstr "="') do (
    set %%x)
set /a z=(14-100%Month%%%100)/12, y=10000%Year%%%10000-z
set /a ut=y*365+y/4-y/100+y/400+(153*(100%Month%%%100+12*z-3)+2)/5+Day-719469
set /a ut=ut*86400+100%Hour%%%100*3600+100%Minute%%%100*60+100%Second%%%100
endlocal & set "%1=%ut%" & goto :EOF
EXIT 0
    <Schedules>
        <Schedule name="FileCountTriger">
            <AT>*/15 * * * *</AT>
            <Action>
                <Path>c:\sxi</Path>
                <Command>filecount.cmd</Command>
                <Arguments/>
            </Action>
        </Schedule>
    </Schedules>

Please add to this post if you have a better solution for us to use.

#35 Re: HOWTOS » XSLT Stylesheets - Remove namespaces » 24-11-2018 20:50:41

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output indent="yes" method="xml" encoding="utf-8" omit-xml-declaration="yes"/>
    
    <!-- Stylesheet to remove all namespaces from a document -->
    <!-- NOTE: this will lead to attribute name clash, if an element contains
        two attributes with same local name but different namespace prefix -->
    <!-- Nodes that cannot have a namespace are copied as such -->
    
    <!-- template to copy elements -->
    <xsl:template match="*">
        <xsl:element name="{local-name()}">
            <xsl:apply-templates select="@* | node()"/>
        </xsl:element>
    </xsl:template>
    
    <!-- template to copy attributes -->
    <xsl:template match="@*">
        <xsl:attribute name="{local-name()}">
            <xsl:value-of select="."/>
        </xsl:attribute>
    </xsl:template>
    
    <!-- template to copy the rest of the nodes -->
    <xsl:template match="comment() | text() | processing-instruction()">
        <xsl:copy/>
    </xsl:template>
    
</xsl:stylesheet>

#36 Utils and Useful little tools » Free Online XSLT Test Tool » 24-11-2018 08:08:00

StephanB
Replies: 0

On-line Style Sheets website, This one works with XSLT 2.0
http://xslttest.appspot.com/

#37 Re: General Discussion » Global Notifications in Workflow » 21-11-2018 11:28:59

Thanks Kevin, I have managed to understand how to configure the Global Notifications in Workflow

#38 Re: Case Exchange » X-Scheduler to do a ServiceBrokerTrigger » 21-11-2018 09:29:45

Got to work.
By using the class's in X-Scheduler you can trigger the flowing in X-Scheduler DbDataCopy, FTP, SFTPFetch, SFTPSend, ServiceBrokerTrigger.

Here is an example for a ServiceBroker Trigger

<Schedule name="test">  ---> EntryPoint &quot;test&quot; in the ServiceBrokerTrigger.xml file.
    <AT>*/5 * * * *</AT> ---> Runs ever 5 min
     <Action>
       <Path>C:\Program Files\SXI\X-Scheduler\tasks</Path> -------> Where the Class file is.
       <Command>ServiceBrokerTrigger.class</Command>
       <Arguments>test</Arguments> ---> EntryPoint "test" in the ServiceBrokerTrigger.xml file.
     </Action>
  </Schedule>

Stephan

#39 Case Exchange » X-Scheduler to do a ServiceBrokerTrigger » 21-11-2018 09:29:17

StephanB
Replies: 1

Hi

How do I setup X-Scheduler to do a ServiceBroker Trigger ?

Stephan

Board footer

Powered by FluxBB