IBM WebSphere DataPower Community Forum IBM Webspere DataPower XI50
October 12, 2008, 03:13:45 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: IBM WebSphere DataPower SOA Appliance Forum - Just Launched come share your knowledge!!! These forums will be a great place to build a community. This site is not associated with IBM.
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: using dp:variable() extention  (Read 458 times)
dublin
Newbie
*
Offline Offline

Posts: 2


View Profile
« on: December 31, 2007, 02:29:39 PM »

Wondering if anybody has successfully implemented applications using dp:variale() extension in XSLT, and hope to share experience and knowledge. I can't find a complete documents on how it is used, but have an article posted on IBM site (Link: http://www.ibm.com/developerworks/websphere/library/techarticles/0708_maze/0708_maze.html).

I am following the sample and can see from the Probe the context variables are set as global variables, but just can not get the value through dp:variable().

name                                                               type         value
var://context/tempvar1/_extension/variables          node-set   (show nodeset)
var://context/tempvar1/request/DestinationSystem string        'SYS1'
var://context/tempvar1/request/MessageID            string       'TEST0000000000000000000000000001'
var://context/tempvar1/request/OriginationSystem  string        'SOAPSCOPE'
var://context/tempvar2/_extension/messages         node-set   (show nodeset)


There values are retrieved in the following XSLT code, but they always come out as blank.

<responseheader:DestinationSystem>
 <xsl:value-of select="dp:variable('var://context/tempvar1/request/OriginationSystem')"/>
</responseheader:DestinationSystem>
<responseheader:OriginationSystem>
<xsl:value-of select="dp:variable('var://context/tempvar1/request/DestinationSystem')"/>
</responseheader:OriginationSystem>
<responseheader:CorrelationID>
<xsl:value-of select="dp:variable('var://context/tempvar1/request/MessageID')"/>
</responseheader:CorrelationID>
 
Any idea what's going wrong? Thanks for your attention.
Logged
craven
Newbie
*
Offline Offline

Posts: 8


View Profile
« Reply #1 on: January 04, 2008, 01:43:00 AM »

I have used dp:variable extensions in XSLT in the past.

Your syntax looks good to me.

Have you included xmlns:dp="http://www.datapower.com/extensions" in your XSL? 

Try this :

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.example.org/tns" xmlns:dp="http://www.datapower.com/extensions" extension-element-prefixes="dp" exclude-result-prefixes="dp">
   <xsl:output method="xml"/>
   <xsl:template match="/">
      <someRootElement>
         <responseheader:DestinationSystem>
            <xsl:value-of select="dp:variable('var://context/tempvar1/request/OriginationSystem')"/>
         </responseheader:DestinationSystem>
         <responseheader:OriginationSystem>
            <xsl:value-of select="dp:variable('var://context/tempvar1/request/DestinationSystem')"/>
         </responseheader:OriginationSystem>
         <responseheader:CorrelationID>
            <xsl:value-of select="dp:variable('var://context/tempvar1/request/MessageID')"/>
         </responseheader:CorrelationID>
      </someRootElement>
   </xsl:template>
</xsl:stylesheet>

(I haven't had a chance to test this yet)
« Last Edit: January 04, 2008, 01:47:27 AM by craven » Logged
dublin
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #2 on: January 07, 2008, 05:34:23 PM »

 Thanks for your reply. The reason may be similar to what you have mentioned, there were some other xslt extensions mixed with dp extention. I separated them in two different transform actions, each has only one extention, then it worked.

After getting this one to work, I have not had this kind of problem any more.  Cheesy
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  



Powered by SMF | SMF © 2006-2007, Simple Machines LLC
Seo4Smf © Webmaster's Talks
This Site is not associated with IBM