Changing the default template  Enabling different templates for the same element

Chapter 6: Building Templates

Customizing user XML element templates

Unwired Accelerator allows you to customize XSL and XSLT templates on a per-user basis.

When you create XML applications, you specify an Extensible Style Language Transformation (XSLT) template for content transformation and a user interface (UI) template for presentation.

The XSLT template contains the language used in XSL style sheets to transform XML documents into other XML documents. The UI template specifies how to present the application; that is, shading, borders, and so on. You can customize these templates on a per-user basis for XML applications

StepsCreating an XML sample application

  1. Log in to Mobile Web Studio.

  2. Select Build | Applications from the Mobile Web Studio left pane and select New from the Application Manager Status menu.

  3. Right-click in the detail pane and select New Aggregated Application.

  4. When the Application Builder displays, click the down arrow beside the Add button and select XML Element from the menu.

    You see the XML Element Definition window.

  5. Enter the following sample input:

    XML URL –

    http://p.moreover.com/
        cgi-local/page?c=Biotech%20news&o=xml
    

    Content XSLT – moreover_content_xsl

    UI XSLT – pink_ui_xslt

  6. Click Preview.

    The content has a pink background, as specified in the UI XSLT. Any user who accesses an XML application that uses the specified UI XSLT sees a pink background.

  7. Click Next until you reach the window where you enter the Element Name.

  8. Enter “XML_sample” and click Finish to save the new element.

  9. When the Application Builder reappears, click Save.

  10. On the Finish window, enter an application name and select the J2EE roles:

  11. Click Finish.

  12. When you see the prompt “Application successfully saved,” click OK, then click Close to exit the Application Builder.

  13. In the Application Manager, select New from the Status menu. You see the XML_sample application.

  14. Approve and Activate the application by right-clicking the XML_sample application and selecting:

    The application now displays under the Approved status.

StepsAdding the XML_sample application to a page

You have created an XML_sample application that uses the XML_sample element and incorporates the pink_ui_xslt user interface. Now add the application to a page.

  1. Select Build | Pages from the Mobile Web Studio main window and click New on the Page Builder menu bar.

  2. When the Page Builder appears, click Add.

  3. When the Search window appears, click Search.

  4. Click XML_sample in the Results pane and click Add.

  5. In the Page Builder, click Save As.

  6. In the Save Page window:

    1. Enter “XML_sample” for Name.

    2. Click Add All for J2EE Roles.

    3. Click OK.

  7. When the “Page saved” prompt appears, click OK, then click Close to exit the Page Builder.

  8. At the Mobile Web Studio main window, select New from the Manager Status menu.

  9. Right-click XML_sample in the detail view and select Status | Approved from the pop-up. When the “Page saved” prompt appears, click OK.

  10. Select Approved from the Page Manager Status menu.

  11. Click XML_sample in the detail view and click Update from the Page Manager menu bar.

  12. In the confirmation pop-up, click OK.

Portal Interface now has the page available for users.

StepsCreating a user-specific UI XSLT template

  1. Select Build | Templates and select Approved from the Template Manager Status menu.

  2. Right-click the pink_ui_xslt template in the detail view and select Edit from the pop-up.

  3. When the Template Editor appears, locate this line in the Code window:

    <TD BGCOLOR="#ffccff">
    
  4. Change the value from “#ffccff” to:

    #ccffcc
    
  5. Click Save As.

  6. When the Save Template As dialog box displays, enter:

    green_ui_xslt
    

    Click OK.

  7. When you see the prompt “Template saved,” click OK, then click Close to exit the Template Editor.





Copyright © 2005. Sybase Inc. All rights reserved. Enabling different templates for the same element

View this book as PDF