Bookshelf Home | Contents | Index | PDF |
Siebel Portal Framework Guide > Delivering Content to External Web Applications > Manipulating Siebel XML with XSL Style Sheets and XSLT > Sample XSL Style SheetThe following XSL style sheet code sample is used to transform the WML-based Siebel Wireless application into HTML through the XML Web Interface. This code shows how a list view in the Wireless application is converted to HTML. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" media-type="text/html"/> <!-- This style sheet process the XML output for both the Splash screens and standard views--> <!-- ====================== Root Document Processing ========================--> <xsl:apply-templates select="//APPLICATION/SCREEN/VIEW/APPLET"></xsl:apply-templates> <!-- ============================ View Processing ===========================--> <!-- List Base mode Template--> <xsl:value-of select="CONTROL[@ID='1']"/> <xsl:value-of select="CALENDAR/@TITLE"/> <!-- XML No Record found and other alerts --> <xsl:if test="string-length(ALERT)>0 and @CLASS='CSSFrameCalRerouteBase'"> <xsl:value-of select="ALERT"/> <!-- Search and Title with data or other links --> <xsl:apply-templates select="CONTROL[@ID=2 or @ID=3 or @ID=4 or @ID=5 or @ID=6 or @ID=7 or @ID=8 or @ID=9]"/> <xsl:apply-templates select="CONTROL[@ID=1000]"/> <!-- Display fields for list of records here--> <xsl:apply-templates select="LIST"></xsl:apply-templates> <xsl:if test="string-length(@ROW_COUNTER)>0"> <xsl:value-of select="@ROW_COUNTER"></xsl:value-of> <!-- control link for New, Main Menu, etc.. --> <xsl:apply-templates select="CONTROL[@ID>=40 and @HTML_TYPE='Link']"/> <!-- ================= Control and Link Processing ===================--> <xsl:template match="CONTROL"> <xsl:when test="@HTML_TYPE='Link'"> <xsl:call-template name="build_simple_link"></xsl:call-template> <xsl:value-of select="."></xsl:value-of><br></br> <xsl:template name="build_simple_link"> <xsl:apply-templates select="ANCHOR"></xsl:apply-templates> <xsl:attribute name="HREF"><xsl:value-of select="$link"/></xsl:attribute> <xsl:value-of select="@CAPTION"/> <!-- ============================ List processing ==========================--> <!-- LIST Template builds a list of records --> <!-- first get the URL from the RS_HEADER element--> <xsl:apply-templates select="RS_HEADER/METHOD[@NAME='Drilldown']"/> <!-- capture the URL before the SWERowId parameter--> <xsl:variable name="link-prefix"> <xsl:value-of select="substring-before($link,'R=')"/> <!-- capture the URL after the SWERowId parameter--> <xsl:variable name="link-suffix"> <xsl:value-of select="substring-after($link,'R=')"/> <!-- capture the field with the drilldown enabled - use later to build drilldown --> <xsl:variable name="drilldowncontrol"> <xsl:value-of select="RS_HEADER/METHOD[@NAME='Drilldown']/@FIELD"></xsl:value-of> <!-- loop through the rows in the RS_DATA element --> <xsl:for-each select="RS_DATA/ROW"> <!-- pickup the Row Id for the Row so we can rebuild the SWERowId URL parameter--> <xsl:value-of select="@ROWID"/> <!-- loop through each field and control in the Row --> <xsl:for-each select="FIELD|CONTROL"> <!-- if the field is the drilldown field then create a link on the display data--> <xsl:when test="@NAME = $drilldowncontrol"> <xsl:value-of select="concat(normalize-space($link prefix),'R=',$rowid,$link-suffix)"/>&F=<xsl:value-of select="@VARIABLE"/> <xsl:value-of select="."></xsl:value-of> <!-- otherwise just display the data as is--> <xsl:value-of select="."></xsl:value-of> <!-- need a break if field is not empty --> <xsl:variable name="empty_field"> <xsl:if test="string-length($empty_field)!=0"><br></br></xsl:if> <!-- Show separator line only if has one or more record --> <xsl:variable name="row_data"> <xsl:value-of select="normalize-space(RS_DATA/ROW)"/> <xsl:if test="string-length($row_data)>0"> <xsl:text>- - - -</xsl:text><br></br> <!-- show More link only if there is next record set --> <xsl:variable name="more_link"> <xsl:value-of select="normalize-space(RS_HEADER/METHOD[@NAME='GotoNextSet']/@CAPTION)"/> <xsl:if test="string-length($more_link)>0"> <xsl:apply-templates select="RS_HEADER/METHOD[@NAME='GotoNextSet']"> <xsl:value-of select="$more_link"></xsl:value-of> <!-- =================== Anchor URL Processing =======================--> <!-- ANCHOR Template builds the URL for drilldowns and links --> <xsl:text>start.swe?</xsl:text> <xsl:apply-templates select="CMD|INFO"/> <xsl:value-of select="@NAME"/>=<xsl:value-of select="@VALUE"/> <xsl:apply-templates select="ARG"/> <xsl:if test="string-length(normalize-space(.)) >0"> <xsl:variable name="argstring"> <xsl:when test="@NAME='Pu' or @NE='R' or @NAME='Rs'"> <xsl:value-of select="translate(normalize-space(),'%2B','+')'"/> <xsl:value-of select="normalize-space()"/> <xsl:value-of select="$argstring"/> <xsl:value-of select="@NAME"></xsl:value-of>=<xsl:value-of select="$arg"></xsl:value-of> <!--<xsl:text>&</xsl:text>--> <!--<xsl:value-of select="@NAME"/>=<xsl:value-of select="translate($arg,'%2B','+')'"/>--> <xsl:if test="string-length(normalize-space(.)) >0"> <!--<xsl:value-of select="."/>--> <xsl:value-of select="normalize-space(.)"/> <xsl:value-of select="@NAME"/>=<xsl:value-of select="$info"/> |
Siebel Portal Framework Guide | Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |