Understanding the XSLT Designer

Creating XML Schemas

You will create two XML Schemas: HelloXSLTIncoming.xsd and HelloXSLTOutgoing.xsd. You use the former as the basis for the incoming message and the latter as the basis for the outgoing message.

ProcedureTo create the XML Schema for the incoming message:

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

  2. In the File Name field, type HelloXSLTIncoming.

  3. Click Finish. A new node—HelloXSLTIncoming.xsd —appears under the Transformation Files node in your HelloXSLTransformation project and the new Schema opens in the XML Schema Editor.

    XML Schema Added to the Project
  4. In the first column of the Schema view, right-click Elements and choose Add Element from the pop-up menu. The Add Element dialog box opens.

  5. In the Name field, type name.

  6. Under Type, select the Use Existing Type radio button.

  7. Expand the Built-in Types node and select string.

  8. Click OK.

    New Schema Element Dialog
  9. To view the source of the Schema you created, click the Source button on the XML Schema Editor toolbar. You should see the following code:


    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                targetNamespace="http://xml.netbeans.org/schema/HelloXSLTIncoming"
                xmlns:tns="http://xml.netbeans.org/schema/HelloXSLTIncoming"
                elementFormDefault="qualified">
        <xsd:element name="name" type="xsd:string"></xsd:element>
    </xsd:schema>

ProcedureTo create the XML Schema for the outgoing message:

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

  2. In the File Name field, type HelloXSLTOutgoing.

  3. Click Finish. A new node—HelloXSLTOutgoing.xsd —appears under the Transformation Files node in your HelloXSLTransformation project and the new Schema opens in the XML Schema Editor.

  4. In the first column of the Schema view, right-click Elements and choose Add Element from the pop-up menu. The Element dialog box opens.

  5. In the Name field, type greeting.

  6. Under Type, select the Use Existing Type radio button.

  7. Expand the Built-in Types node and select string.

  8. Click OK.

  9. To view the source of the Schema you created, click the Source button on the XML Schema Editor toolbar. You should see the following code:


    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                targetNamespace="http://xml.netbeans.org/schema/HelloXSLTOutgoing"
                xmlns:tns="http://xml.netbeans.org/schema/HelloXSLTOutgoing"
                elementFormDefault="qualified">
        <xsd:element name="greeting" type="xsd:string"></xsd:element>
    </xsd:schema>
  10. Click the Save All button on the toolbar.

    You should see two Schema files listed under the Transformation Files node in your HelloXSLTransformation project.

    Two Schema Files in the Project