Changing the default template  Enabling different templates for the same element

Chapter 8: Building Templates

Customizing user XML element templates

Enterprise Portal allows you to customize XSL and XSLT templates on a per-user basis.

When you create XML portlets, 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 portlet; that is, shading, borders, and so on.

In earlier versions of Enterprise Portal, the XSL and UI templates were selected and defined in the Web Studio during portlet design and were fixed for all users of the portlet. With Enterprise Portal 6.0 and later, you can customize these templates on a per-user basis for XML portlets.

StepsCreating an XML sample portlet

  1. Log in to Web Studio.

  2. Select Build | Portlets from the Web Studio left pane and select New from the Portlet Manager Status menu.

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

  4. When the Portlet 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 that accesses an XML portlet that used 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 Portlet Builder reappears, click Save to save a portlet that uses the XML_sample element.

  10. On the Finish window, enter a portlet name and select the J2EE roles:

  11. Click Finish.

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

  13. In the Portlet Manager, select New from the Status menu. You see the XML_sample portlet.

  14. Approve and Activate the portlet. Right-click XML_sample portlet and select:

    The portlet now displays under the Approved status.

StepsAdding the XML_sample portlet to a page

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

  1. Select Build | Pages from the 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 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. Enter the appropriate user name and password and click Update.

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
    

    for the name, then click OK.

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





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

View this book as PDF