Hi,
I’m pretty new at this so…
However, I searched the forums for “xslt” and didn’t find anything specific as to what I’m looking for.
Let’s say I wanted to call the addInts service from the WmPublic package from my xslt stylesheet, how would I go about it? I know there’s other ways to make simple additions, but bear with me for the sake of knowing how to do it.
I tried the example from page 29 of the XSLTServiceDevGuide, using this namespace:
[FONT=Courier][SIZE=1]xmlns:IntDate=“java://com.wm.pkg.xslt.samples.date.IntDate”
It worked. Great. After finding where math.class was in the WmPublic package, I used this namespace:
xmlns:addInts=“java://pub.math”
and this snippet:
<xsl:value-of select=“math:addInts(‘5’, ‘5’)”
This didn’t work. I got the “JAXP: Error instantiating transformer” message.
First obvious question: Is it possible to do what I want to do? On Developper 6.5 by the way.
Any tips appreciated. Here’s the test xslt stylesheet I’m using:
[/SIZE][/FONT]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="[URL]http://www.w3.org/1999/XSL/Transform[/URL]"
xmlns:IntDate="java://com.wm.pkg.xslt.samples.date.IntDate"
xmlns:addInts="java://pub.math">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="MyParam1"></xsl:param>
<xsl:template match="/">
<xsl:element name="EDITRANSACTIONSET">
<xsl:element name="EDIDOCUMENTTYPE"><xsl:value-of select="//EDIDOCUMENTTYPE"/></xsl:element>
<xsl:element name="EDIDOCUMENTNUMBER"><xsl:value-of select="//EDIDOCUMENTNUMBER"/></xsl:element>
<xsl:element name="NOCOMMANDE"><xsl:value-of select="//NOCOMMANDE"/></xsl:element>
<xsl:element name="DATECOMMANDE"><xsl:value-of select="math:addInts('5', '5')"/></xsl:element>
<xsl:element name="DATELIVRAISON"><xsl:value-of select="IntDate:getDate('2010','07','20','12','12','12')"/></xsl:element>
<xsl:element name="MESSAGE"><xsl:value-of select="$MyParam1"/></xsl:element>
<xsl:element name="ADDRESSNUMBERSHIPTO"><xsl:value-of select="//ADDRESSNUMBERSHIPTO"/></xsl:element>
<xsl:element name="LISTECOMMANDESDA">
<xsl:for-each select="//COMMANDESDA">
<xsl:sort select="QTECOMMANDE"/>
<xsl:element name="COMMANDESDA">
<xsl:element name="QTECOMMMANDE"><xsl:value-of select="QTECOMMANDE"/></xsl:element>
<xsl:choose>
<xsl:when test="UNITE = 'BT' ">
<xsl:element name="UNITE"><xsl:text>BOUTEILLE</xsl:text></xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="UNITE"><xsl:text>CAISSE</xsl:text></xsl:element>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="CODEUPC"><xsl:value-of select="CODEUPC"/></xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
#Integration-Server-and-ESB#Flow-and-Java-services#webMethods