Understanding the XSLT Designer

Creating an XSLT Service

In this step, you will create a simple request-reply XSLT service, which is a web service that receives input messages, transforms them in accordance with an XSL stylesheet, and sends them back.

ProcedureTo create and XSLT Service:

  1. In the Projects window, right-click the HelloXSLTransformation > Transformation Files node and choose New > XSLT Service.

  2. In the Service Type window, ensure that the Request-Reply Service radio button is selected and click Next.

  3. In the next step, enter HelloXSLTServiceas the service name and click Choose to select Operation for the service.

  4. In the TransformMap Service Parameters window, expand the upper node with the target namespace until you see the operation, select HelloXSLTWSDLOperation and click Next.

    Select Operation for the service
  5. Click Finish. The HelloXSLTService.xslfile opens in the XSLT Editor, where you can only view and edit the source code.

    Now you need to populate the XSL stylesheet with the transformation rules. The XSL stylesheet defines how to transform the input XML document. In this version of the XSLT Designer, you can only edit the source code in the Source view.

ProcedureTo populate the XSL stylesheet:

  1. Open the HelloXSLTService.xslfile and type in the following code:

    <?xml version="1.0" encoding="UTF-8"?>

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.

    xmlns:ns1="http://xml.netbeans.org/schema/HelloXSLTIncoming

    xmlns:ns="http://xml.netbeans.org/schema/HelloXSLTOutgoing"

    <xsl:template match="/">

    <xsl:element name="ns:greeting">

    <xsl:value-of select="concat(&apos;Hello &apos;, /ns1:name)"/>

    </xsl:element>

    </xsl:template>

    </xsl:stylesheet>

  2. Press the Validate File (Validate the File) button on the toolbar to ensure that the code has no errors.

  3. Right-click the HelloXSLTransformationnode and choose Clean and Build from the drop-down menu to build the project. You should see the BUILD SUCCESSFULmessage after building the project completes.