You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ka...@apache.org on 2009/03/06 23:33:28 UTC

svn commit: r751116 - in /ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform: HelloXslWorld.wsdl HelloXslWorld.xsl test.properties

Author: karthick
Date: Fri Mar  6 22:33:27 2009
New Revision: 751116

URL: http://svn.apache.org/viewvc?rev=751116&view=rev
Log:
Illustrate the workaround for the non-functioning nilled() XPath function.

Modified:
    ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.wsdl
    ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.xsl
    ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/test.properties

Modified: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.wsdl?rev=751116&r1=751115&r2=751116&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.wsdl (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.wsdl Fri Mar  6 22:33:27 2009
@@ -34,6 +34,7 @@
             <xsd:complexType name="ContentCT">
                 <xsd:sequence>
                     <xsd:element name="content" type="xsd:string"/>
+                    <xsd:element name="nillable" type="xsd:string" nillable="true"/>
                 </xsd:sequence>
             </xsd:complexType>
         </xsd:schema>

Modified: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.xsl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.xsl?rev=751116&r1=751115&r2=751116&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.xsl (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.xsl Fri Mar  6 22:33:27 2009
@@ -17,17 +17,32 @@
   ~ under the License.
   -->
 
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
   <xsl:output method="xml"/>
   <xsl:param name="middle"/>
 
-  <xsl:template match="/">
+ <xsl:template match="node()|@*">
+   <xsl:copy>
+       <xsl:apply-templates select="@*"/>
+       <xsl:apply-templates/>
+   </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="TestPart">
     <!-- The root element is the one that will be used as a base for the assignment rvalue -->
     <xsl:element name="root">
       <xsl:element name="hello">
-        <xsl:value-of select="concat(*/content/text(), $middle, ' World')"/>
+           <xsl:apply-templates />
       </xsl:element>
     </xsl:element>
   </xsl:template>
+  
+  <xsl:template match="content">
+        <xsl:value-of select="concat(text(), $middle, ' World')"/>
+  </xsl:template>
 
+  <!-- The nilled() function does not work if your Saxon parser is not schema-aware -->
+  <!--<xsl:template match="*[nilled(current())]"/>-->
+  <!-- As a workaround, you may use boolean(@xsi:nil) instead of nilled(current()) -->
+  <xsl:template match="*[boolean(@xsi:nil)]"/> 
 </xsl:stylesheet>
\ No newline at end of file

Modified: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/test.properties
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/test.properties?rev=751116&r1=751115&r2=751116&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/test.properties (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/test.properties Fri Mar  6 22:33:27 2009
@@ -18,6 +18,6 @@
 namespace=http://ode/bpel/unit-test.wsdl
 service=HelloXslService
 operation=helloXsl
-request1=<message><TestPart><content>Hello</content></TestPart></message>
-response1=.*HelloXsl World.*
+request1=<message><TestPart><content>Hello</content><nillable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/></TestPart></message>
+response1=.*<message><TestPart><hello>HelloXsl World</hello></TestPart></message>.*