Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel Portal Framework Guide > Delivering Content to External Web Applications > Manipulating Siebel XML with XSL Stylesheets and XSLT >
Sample XSLT
The following example shows how XSLT code snippets transform an XML response from SWE into HTML. The XSLT snippets are based on the XML response generated from the Query String example described in Connecting to the XML Web Interface.
<xsl:template match="/">
<TABLE bgcolor="#CCCCFF" width="100%" cellpadding="2"
cellspacing="0" Border="0" >
<TBODY>
<xsl:apply-templates select="//APPLET/LIST"/>
</TBODY>
</TABLE>
</xsl:template><xsl:template match="LIST">
<xsl:apply-templates select="RS_HEADER"/>
<xsl:apply-templates select="RS_DATA"/>
</xsl:template><xsl:template match="RS_HEADER">
<TR>
<xsl:for-each select="COLUMN">
<xsl:if test="@NAME='Name'">
<TD colspan="3" bgcolor="#CCCCFF" class="sub2viewon" width="60%">
<B><xsl:value-of select="@DISPLAY_NAME"/></B
</TD>
</xsl:if>
<xsl:if test="@NAME='Location'">
<TD bgcolor="#CCCCFF" class="sub2viewon" width="40%">
<B><xsl:value-of select="@DISPLAY_NAME"/></B>
</TD>
</xsl:if>
</xsl:for-each>
</TR>
</xsl:template><xsl:template match="RS_DATA">
<xsl:for-each select="ROW">
<TR>
<xsl:for-each select="FIELD">
<xsl:if test="@NAME='Name'">
<TD bgcolor="#FFFFFF">
<xsl:element name="IMG">
<xsl:attribute name="SRC">
portal_files/w.gif
</xsl:attribute>
<xsl:attribute name="height">
1
</xsl:attribute>
<xsl:attribute name="width">
3
</xsl:attribute>
</xsl:element>
</TD>
<TD bgcolor="#FFFFFF" valign="top">
<xsl:element name="IMG>
<xsl:attribute name="SRC">
portal_files/dot.gif
</xsl:attribute>
<xsl:attribute name="height">
6
</xsl:attribute>
<xsl:attribute name="width">
6
</xsl:attribute>
</xsl:element>
</TD>
<TD bgcolor="#FFFFFF" align="left" valign="top"
width="60%">
<xsl:choose>
<xsl:when test="string-length(normalize
space(.))> 0"
<xsl:choose>
<xsl:when test="@NAME='Name'">
<xsl:call-template name="link"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</TD>
</xsl:if>
<xsl:if test="@NAME='Location'">
<TD bgcolor="#FFFFFF" align="left" valign="top"
width="40%">
<xsl:choose>
<xsl:when test="string-length(normalize-space(.))
> 0">
<xsl:choose>
<xsl:when test="@NAME='Name'">
<xsl:call-template name="link"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</TD>
</xsl:if>
</xsl:for-each>
</TR>
<tr>
<td colspan="4" width="40%"></td>
</tr>
</xsl:for-each>
</xsl:template>
Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel Portal Framework Guide Published: 09 September 2004 |