|
The following sections describe how to work with non-HTML content:
While many web-based applications use client-side JavaScript to handle tasks such as validation of form input, most microbrowser devices are unable to run JavaScript. To enable applications to make JavaScript-dependent content available to microbrowser users, the CTE provides transparent JavaScript emulation, acting as a proxy server for the devices. The emulation is done without any intervention by the Design Studio or CTE user.
The CTE support for JavaScript provides access to JavaScript-dependent form, frame, and window manipulation, event processing, browser redirection, and cookie handling.
With this JavaScript support, a user can accomplish tasks such as the following:
The following sections describe the CTE JavaScript support:
The CTE handles a request for an HTML page that contains JavaScript as described in the following process.
1. Searches for JavaScript located in these places:
The JavaScript might perform actions such as modify form elements, cause the browser to retrieve another page, and submit a form to the application server.
By keeping the page in a cache, the CTE enables a user to return to the same form if a submit fails.
4. Modifies the page as follows:
<a href="javascript:method();">Click here</a>
to<input type="submit">
.<a href="javascript:method();"><img src="clickme.gif"/></a>
to <input type="image">
.5. Sends the page to the device.
When the user clicks a button, the CTE sets the form to the proper values, determines which events were triggered, and runs the event handler script. Depending on the result of that processing, the CTE then sends content to the device or sends a new request to the application server.
When emulating JavaScript, the CTE acts like a Netscape 4.7 client. Thus, the CTE does not support JavaScript that is specific to Internet Explorer, such as document.all or VBScript.
Table 6-1 lists the JavaScript features that the CTE supports. For unsupported features, see Table 6-2.
Table 6-1 Supported JavaScript Features
The CTE handles all of the transformations that are required to support JavaScript-based forms. The CTE transforms an HTML element that triggers a JavaScript event into a button labeled "Change" or "Submit." As a result, you will see more buttons in the Design Studio browser view of transformed pages. For example, Figure 6-1 shows an original application that uses JavaScript.
The CTE transforms the application as shown in Figure 6-2. In the browser view, notice the additional "Change" buttons; in the XHTML source view, notice the XHTML code that has replaced JavaScript.
Design Studio users do not need to apply any rules in order for JavaScript to operate correctly on devices. However, you can apply transformation rules to a page that contains JavaScript in order to perform the following:
Note Clipping, ignoring, or not including a check box, radio button, or Select object makes those objects appear unselected to an application server. If you need to make them appear selected to the application server, but do not want them to be visible on the transformed page, do not clip them. Instead, modify the object so that its type attribute is set to "hidden". |
Consider, for example, if a list of 50 items is practical to send to a microbrowser screen. If possible, eliminate some of the choices.
Note When working in Design Studio on a page that contains
JavaScript, note that the operation of JavaScript is state dependent and Design
Studio might not return the correct state when you navigate to the Browse tab. In
this case, Design Studio prompts you to click the (reload) button to retrieve the page from the CTE cache. |
If you need to apply transformation rules to JavaScript-based forms, follow these guidelines to ensure that the CTE can correctly transform and process the JavaScript:
Table 6-2 lists the JavaScript features that the CTE currently does not support.
Table 6-2 Unsupported JavaScript Features
|
Note This feature is intended only for users familiar with XSL. |
You can manually configure an element by editing its XPath expression. This feature provides more flexibility in node selection when applying a rule.You can modify an XPath expression to address one or several nodes based on position and/or attributes.
Table 6-3 contains the XPath expression to use to achieve various results.
Table 6-3 XPath Expression Examples
|
1 If the text you want to configure contains special characters, particularly single or double quotation marks, be sure to enter the text in the text field and click Reload to retrieve the XPath expression provided by Design Studio. You must include any text variables provided by Design Studio in your XPath expression. |
For more information about XPath pattern matching, see http://www.w3.org/TR/xpath.
To manually configure an XPath expression, perform these steps:
Step 2 Click Manually Configure Element to select it.
Step 3 Click Reload to view the current XPath expression for the node.
Step 4 Edit the XPath configuration in the text box.
Design Studio alerts you if you enter invalid syntax for the XPath.
Step 5 Click OK.
If you have a set of XML pages that you want to make available to users, you work with the XML pages in a Design Studio XML project. For XML projects, you import into Design Studio an XSL style sheet that you created in another application. Design Studio uses the imported XSL style sheet to transform the XML pages.
Note If you need to use more than one XSL style sheet to handle different device protocols, use the Import XSL rule as described in the "Using Several XSL Style Sheets for a Project" section. |
The following sections describe how to use Design Studio to work with XML projects:
An XML project contains an XSL style sheet and the XML pages that you want to transform. You create an XSL style sheet outside of Design Studio. Be sure to validate an XSL style sheet before importing it. Design Studio does not validate imported style sheets.
Note Before you import an XSL style sheet, verify that all xsl:template elements in the style sheet have a priority attribute set to greater than 1. This ensures that your style sheet will not conflict with the style sheet generated by Design Studio. |
To create an XML project, perform these steps:
The name of the current configuration file appears in the title bar of the Design Studio window.
Step 2 From the Projects menu, choose Create Project.
The Create Project dialog box appears.
Step 3 Enter a name to identify the project, for example, "command pages."
Step 4 Click the XML radio button.
Step 5 Click OK.
The Select Location of Style Sheet dialog box appears.
Step 6 Enter the fully-qualified URL of an XSL style sheet, or click Browse, navigate to a filename, and click Open.
Step 7 Click OK.
Design Studio creates the project, imports the style sheet, and adds the Style Sheet tab to the window.
Step 8 To view the style sheet, click the Style Sheet tab.
After you create a project, you add web pages to it as described in the "Adding a Page to an XML Project" section.
To add a page to an XML project, perform these steps:
Step 2 Enter the XML page URL in the Address field.
Design Studio opens the requested page in the Browse tab. The XML is formatted according to the XSL style sheet that you imported in this project.
If the requested page does not appear, the CTE server or the server for the web page may not be running.
If the page information pane (lower-left portion of window) includes the message "Passes Identifier Rules," see the "Using an Identifier Rule for Multiple Pages" section.
If a Redirection message displays, see the "Handling Page Redirects" section.
Step 3 In the lower-left pane, click Add Page to Project.
Design Studio adds the XML page to the project and displays it in the View Original tab, formatted according to the imported XSL style sheet.
Step 4 Create identifier rules for the pages as described in the "Identifying a Page" section.
Step 5 Save and publish XML projects just like HTML projects.
After you change and validate an XSL style sheet in another application, update it in Design Studio.
To update an XSL style sheet, perform these steps:
Step 2 Choose Update Style Sheet from the shortcut menu.
In addition to using the rich set of transformation rules provided with Design Studio, you can also apply a custom rule to an element or a custom XSL template to a page. This advanced feature enables you to supplement or replace the default XSL template in the XSLT style sheet created by Design Studio.
When you apply a rule such as Select or Move, Design Studio writes an xsl:template element for the rule. You can choose, instead, to create your own rule by modifying or replacing an xsl:template element. The default XSL template provided by Design Studio is associated with a particular node or set of nodes. If you override the default, the XPath pattern in the xsl:template match= statement determines on which nodes the rule is applied.
Importing a custom XSL template rule is useful in cases such as the following:
For example, you might need to reorder something in a URL or you might need to remove part of the beginning and the end of a URL.
The following sections describe how to import custom XSL:
To import a custom XSL template rule on a node, perform these steps:
Step 2 In the XHTML source view, right-click the node where you want to apply a custom XSL template rule.
Step 3 Choose Import XSL from the shortcut menu.
The Configure: XSL Import Rule dialog box appears.
Step 4 (Optional) Change the rule name, perhaps using a brief description of its content, such as "Custom rule: manipulate URL."
Step 5 Choose whether to apply the rule to all pages in this project or just this page:
Step 6 Choose each device type to which you want to apply the rule.
Step 7 Click the Import XSL tab.
Step 8 To change the XSL template for just this node, leave the Use Default <xsl:template> check box selected.
If you clear the check box, the XSL template that you enter replaces the entire default style sheet for the page.
Step 9 Type the XSL statements for the rule you are creating.
Step 10 Click OK.
Design Studio validates the XSL and displays an error message if the XSL is not well formed or includes unsupported elements such as xsl:keys and xsl:call-template.
By importing custom XSL, you can create your own rules in Design Studio. The following tables contain the custom XSL needed to perform a variety of transformations:
|
Table 6-5 Using and Changing URLs
|
Table 6-6 Handling Special Cases
|
To make a set of XML pages available to users, you import into Design Studio one or more XSL style sheets that you created in another application. Design Studio and the CTE use an imported XSL style sheet to transform the XML pages.
If your XML pages have only one XSL style sheet, you can create an XML project, as described in the "Working with JavaScript, XML, and XSL" section. If your XML pages have several XSL style sheets to support different device protocols, you create an HTML project and import a style sheet for each protocol by replacing the default <xsl:template> element.
To use several XSL style sheets with one project, perform these steps:
Step 2 Right-click in the XHTML source view or the browser view.
Step 3 Choose Import XSL from the shortcut menu.
The Configure: XSL Import Rule dialog box appears.
Step 4 (Optional) Change the rule name, perhaps using a brief description of its content, such as "Custom rule: manipulate URL."
Step 5 Choose whether to apply the rule to all pages in this project or just this page:
Step 6 Click the Import XSL tab.
Step 7 Clear the Use Default <xsl:template> check box.
Step 8 Open the XSL style sheet in a text editor such as Notepad.
Step 9 Copy all xsl:template elements in the style sheet.
Step 10 Paste the copied text into the XSL Import Rule dialog box.
Step 11 Click OK.
Design Studio validates the XSL and displays an error message if the XSL is not well formed or includes unsupported elements such as xsl:keys and xsl:call-template.
Step 12 Apply transformation rules as needed.
Step 13 Repeat Steps 1 through 12 for another device protocol.
Note In the XSL Import Rule dialog box, be sure to clear the check box for the previously configured device type. |
Posted: Mon Aug 18 15:25:16 PDT 2003
All contents are Copyright © 1992--2003 Cisco Systems, Inc. All rights reserved.
Important Notices and Privacy Statement.