JSP templates  Creating and editing templates

Chapter 6: Building Templates

XSL templates

Mobile Web Studio allows you to create an XSL template (XSLT) that you can use for XML applications and elements. Code the XSLs for data-capable elements to use the Unwired Accelerator internal document type definition (DTD).

WARNING! The only XSL stylesheet supported to create XSL templates is:

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

If you use a later stylesheet, a parsing error is generated because of the version of Xerces used.

The following XSL code is a sample of an XSL template for a data-capable user interface XSLT.

<?xml version="1.0"?>
<xsl:stylesheet
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="1.0">
  <xsl:template match="/">
   <TABLE WIDTH="100%" BORDER="1" BORDERCOLOR="#000000">
    <xsl:for-each select="//Record">
     <xsl:text> </xsl:text>
      <TR><xsl:for-each select="Field"><xsl:text></xsl:text>
        <TD>
         <xsl:for-each select="./text()">
         <xsl:value-of select="."/>
        </xsl:for-each>
       </TD>
      </xsl:for-each>
     <xsl:text> </xsl:text>
    </TR>
   </xsl:for-each>
  </TABLE>
 </xsl:template>
</xsl:stylesheet>

NoteWhen you apply a UI XSL template to a Web application, you must select the “Enable Grid Rules” box, otherwise, the specified template is not applied.





Copyright © 2005. Sybase Inc. All rights reserved. Creating and editing templates

View this book as PDF