XSL Transform UCCX

Unanswered Question
Oct 13th, 2009

Hi

Is there any way to do an XSL Transform on a XML document with some param's rather than creating an internal XML document which the XSL doc then transforms?

What i am trying to achive is to have a single XML document which is used to control the call center and depending on the call it will extract specific info for that call (open closed states as well as routing numbers)

<?xml version="1.0" encoding="ISO-8859-1" ?>

<CC>

<SITE SITEID="NY">

<ANNOUCEMENT>true</ANNOUCEMENT>

<SALESOPEN>true</SALESOPEN>

<SUPPORTOPEN>true</SUPPORTOPEN>

<VARSALESVM>12345</VARSALESVM>

<VARSALESOP>12345</VARSALESOP>

<VARSUPPORTVM>12345</VARSUPPORTVM>

<VARSUPPORTOP>12345</VARSUPPORTOP>

</SITE>

<SITE SITEID="BA">

<ANNOUCEMENT>true</ANNOUCEMENT>

<SALESOPEN>fase</SALESOPEN>

<SUPPORTOPEN>fase</SUPPORTOPEN>

<VARSALESVM>12345</VARSALESVM>

<VARSALESOP>12345</VARSALESOP>

<VARSUPPORTVM>12345</VARSUPPORTVM>

<VARSUPPORTOP>12345</VARSUPPORTOP>

</SITE>

</CC>

What i want to be able to do is update the open closed states from an admin menu for a specific site - i have created an xsl style sheet that peforms the updates using parameters

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" indent="yes"/>

<xsl:strip-space elements="*"/>

<xsl:param name="PARAM_SITE"/>

<xsl:param name="PARAM_ANNOUCEMENT"/>

<xsl:param name="PARAM_SALES"/>

<xsl:param name="PARAM_SUPPORT"/>

<xsl:template match="/CC">

<CC>

<xsl:apply-templates select="SITE"/>

</CC>

</xsl:template>

<xsl:template match="SITE">

<xsl:choose>

<xsl:when test="@SITEID=$PARAM_SITE">

<SITE>

<xsl:attribute name="SITEID">

<xsl:value-of select="$PARAM_SITE"/>

</xsl:attribute>

<ANNVAR>

<xsl:value-of select="$PARAM_ANA"/>

</ANNVAR>

<SALESVAR>

<xsl:value-of select="$PARAM_SALES"/>

</SALESVAR>

<SUPPORTVAR>

<xsl:value-of select="$PARAM_SUPPORT"/>

</SUPPORTVAR>

<xsl:copy-of select="VARSALESVM"/>

<xsl:copy-of select="VARSALESOP"/>

<xsl:copy-of select="VARSUPPORTVM"/>

<xsl:copy-of select="VARSUPPORTOP"/>

</SITE>

</xsl:when>

<xsl:otherwise>

<xsl:copy>

<xsl:copy-of select="@*|node()"/>

</xsl:copy>

</xsl:otherwise>

</xsl:choose>

</xsl:template>

</xsl:stylesheet>

But I have not been able to work out how to call it - I have the UCCX premium so I can use java if needed but would prefer not to if possible

Or is there a way to use the Apache Xerces XSL Processor from CRS?

Cheers

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
zane.england Tue, 12/29/2009 - 20:36

i havent had time to look into it any further - i just came up with a work around to use multiple XML files and rewrite the whole file including the static fields... I think it is possible with some java code or class i just havent got around to it

zane.england Mon, 01/04/2010 - 04:26

Have made some progress From looking at the jar files i worked out that i could do this

openclosed.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>

    
          true
          true
          true
          12345
          12345
          12345
          12345
    
    
          true
          fase
          fase
          12345
          12345
          12345
          12345
    

openclosed.xsl

<?xml version="1.0" encoding="ISO-8859-1"?>
http://www.w3.org/1999/XSL/Transform">
    
    
    
    
    
    
    
         
              
         
    
    
         
              
                   
                        
                             
                        
                        
                             
                        
                        
                             
                        
                        
                             
                        
                        
                        
                        
                        
                   
              
              
                   
                        
                   
              
         
    

Go to Program Files\wfavvid\lib and run

java -jar xalan.jar -IN openclosed.xml -XSL openclosed.xsl -PARAM PARAM_SITE NY -PARAM PARAM_ANNOUCEMENT false -PARAM PARAM_SALES false -PARAM PARAM_SUPPORT false -OUT out.xml

out.xml

<?xml version="1.0" encoding="UTF-8"?>


false
false
false
12345
12345
12345
12345


true
fase
fase
12345
12345
12345
12345

zane.england Mon, 04/16/2012 - 17:19

Dennis, I got it sort of working but there was a limitation that i hit where you could not use parameters with the XSL transform step so i had to use a dedicated transform step for each combination which was far from ideal. I did start to write an exernal class for it and it did work but i didnt end up using it





I ended up using the 3rd party xalan.jar (apache) jar. I uploaded it as a 3rd party jar file. I wrote a uccx script that sets up and performs the transformation with java objects. That script it setup as a subflow, so it is taking the XMLFile, XSLTFile, uploadString, and Parameter-Values as a 2x2 array.

The array is passed in and cycled through, and it is passed as an entire array.

Actions

This Discussion