org.ikasan.framework.component.transformation.xslt.util
Class XsltUtils

java.lang.Object
  extended by org.ikasan.framework.component.transformation.xslt.util.XsltUtils

public class XsltUtils
extends Object

This class provides a range of static XSLT utility methods. Currently, this class has the following methods:-

  1. serialize - This method returns string of the specified node set.

Author:
Ikasan Development Team

Constructor Summary
XsltUtils()
           
 
Method Summary
static String serialize(NodeList nodeset)
          Returns string by serializing the specified node set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XsltUtils

public XsltUtils()
Method Detail

serialize

public static String serialize(NodeList nodeset)
                        throws TransformerFactoryConfigurationError,
                               TransformerException
Returns string by serializing the specified node set.
 # =============================================
 #    Stylesheet for serialize()
 # =============================================
 <xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xalan="http://xml.apache.org/xslt"
   xmlns:utils="xalan://com.mizuho.cmi.london.core.shared.xalan.utils.XsltUtils"
   version="1.0"
   exclude-result-prefixes="xalan utils">

 <xsl:output method="xml" encoding="UTF-8"
      cdata-section-elements="item" indent="yes" xalan:indent-amount="2"/>

 <xsl:template match="/">
   <xsl:element name="root">
     <xsl:for-each select="/root/data">
       <xsl:element name="item">
         <xsl:value-of select="utils:serialize(.)"/>
       </xsl:element>
     </xsl:for-each>
   </xsl:element>
 </xsl:template>

Parameters:
nodeset - is the node set to be serialized.
Returns:
the string.
Throws:
TransformerFactoryConfigurationError - if an error creating Transformer occurs.
TransformerException - if an error while serializing nodeset occurs.


Copyright © 2007-2012 Ikasan. All Rights Reserved.