Author: gertv
Date: Wed Dec  8 22:12:44 2010
New Revision: 1043723

URL: http://svn.apache.org/viewvc?rev=1043723&view=rev
Log:
SMX4-638: Add example to servicemix-saxon documentation (thanks to iocanel)

Modified:
    
servicemix/documentation/trunk/src/main/webapp/jbi/components/servicemix-saxon.conf

Modified: 
servicemix/documentation/trunk/src/main/webapp/jbi/components/servicemix-saxon.conf
URL: 
http://svn.apache.org/viewvc/servicemix/documentation/trunk/src/main/webapp/jbi/components/servicemix-saxon.conf?rev=1043723&r1=1043722&r2=1043723&view=diff
==============================================================================
--- 
servicemix/documentation/trunk/src/main/webapp/jbi/components/servicemix-saxon.conf
 (original)
+++ 
servicemix/documentation/trunk/src/main/webapp/jbi/components/servicemix-saxon.conf
 Wed Dec  8 22:12:44 2010
@@ -49,11 +49,33 @@ h4. Optional properties
 
 h4. Using properties and parameters
 All properties defined on the JBI exchange and input JBI message will be 
available for use inside the XSLT stylesheet as parameters.
+
 In addition to those properties and the one specified in the {{parameters}} 
property on the endpoint, the following objects are also available:
 * {{exchange}} : the JBI exchange
 * {{in}} : the input JBI NormalizedMessage
 * {{component}} : the XsltEndpoint instance being called
 
+Below is an example that demonstrates how the properties of the exchange and 
normalized message can be accessed from inside the xslt.
+{pygmentize:lang=xml}
+<?xml version="1.0" encoding="windows-1253"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="2.0"
+                xmlns:class="http://saxon.sf.net/java-type";
+                xmlns:me="java:javax.jbi.messaging.MessageExchange"
+                xmlns:nm="java:javax.jbi.messaging.NormalizedMessage">
+    <xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>
+    <xsl:param name="exchange" as="class:javax.jbi.messaging.MessageExchange"/>
+    <xsl:param name="in" as="class:javax.jbi.messaging.NormalizedMessage"/>
+
+    <xsl:template match="/">
+    <message>
+        <!-- The value of messageId will be read from thr property MSG_ID of 
the "in" NormalizedMessage -->
+        <messageId>
+            <xsl:value-of select="nm:getProperty($in, 'MSG_ID')"/>
+        </messageId>
+    </message>
+</xsl:stylesheet>    
+{pygmentize}
+
 All those parameters can be accessed using XSLT standard ways using 
{{<xsl:param/>}}.
 
 h3. Endpoint {{saxon:proxy}}


Reply via email to