Example: XSL File for a Web Form
Use
This is an example of an XSL file that the Web Page Composer uses to display the new Web form which is based on this XML file. You should store the XSL file in the /etc/wpceditor/styles repository.
<?xml version="1.0"?>
<!DOCTYPE stylesheet [
<!ENTITY apos "'" ><!-- replace ' with html escape character for ' -->
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wpc="com.sap.nw.wpc.km.service.linkmanager.XsltHelper">
<xsl:output method="html"/>
<xsl:template match="/">
<div id="cas" class="clearfix">
<a name="top"></a> <!-- anchor tag for any Back-to-Top links -->
<div id="casmain">
<div id="cascontent" >
<h1><xsl:value-of disable-output-escaping="yes" select="document/properties/property[@type='title']"/>
<xsl:if test="document/properties/property[@type='displayNewIcon']/@value='true'">
<span class="new"><xsl:value-of disable-output-escaping="yes" select="wpc:getString('xsl.xmsg.new', string(document/@locale))"/></span>
</xsl:if>
</h1>
<div id="documentintro">
<h2><xsl:value-of disable-output-escaping="yes" select="wpc:getString('xsl.xtit.abstract', string(document/@locale))"/></h2>
<p>
<xsl:value-of disable-output-escaping="yes" select="document/elements/element[@type='abstract']"/>
</p>
</div>
<xsl:if test="document/properties/property[@type='showTOC']/@value='true'">
<h3><xsl:value-of disable-output-escaping="yes" select="wpc:getString('xsl.xtit.table_of_contents', string(document/@locale))"/></h3>
<ul class="toc">
<xsl:for-each select="document/elements/element">
<xsl:if test="@type='heading1'">
<li><a><xsl:value-of disable-output-escaping="yes" select="current()" />
<xsl:attribute name="href">#section1<xsl:value-of disable-output-escaping="yes" select="position()"/></xsl:attribute></a>
</li>
</xsl:if>
<xsl:if test="@type='heading2'">
<ul><a><xsl:value-of disable-output-escaping="yes" select="current()" />
<xsl:attribute name="href">#section2<xsl:value-of disable-output-escaping="yes" select="position()"/></xsl:attribute></a>
</ul>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:if>
<xsl:for-each select="document/elements/element">
<xsl:if test="@type='authorimage'">
<xsl:if test="string-length(@height)!=0 and string-length(@width)!=0">
<img alt="Author Photo">
<xsl:attribute name="src"><xsl:value-of disable-output-escaping="yes" select="wpc:getWebDavAccess(string(current()))"/></xsl:attribute>
<xsl:if test="string-length(@height)!=0">
<xsl:attribute name="height"><xsl:value-of disable-output-escaping="yes" select="@height"/></xsl:attribute>
</xsl:if>
<xsl:if test="string-length(@width)!=0">
<xsl:attribute name="width"><xsl:value-of disable-output-escaping="yes" select="@width"/></xsl:attribute>
</xsl:if>
</img>
</xsl:if>
</xsl:if>
<xsl:if test="@type='author'">
<p><xsl:value-of disable-output-escaping="yes" select="wpc:getDisplayName(string(current()))"/></p>
</xsl:if>
<xsl:if test="@type='heading1'">
<h2>
<xsl:attribute name="id">section1<xsl:value-of disable-output-escaping="yes" select="position()"/></xsl:attribute>
<xsl:value-of disable-output-escaping="yes" select="current()" />
</h2>
</xsl:if>
<xsl:if test="@type='heading2'">
<h5>
<xsl:attribute name="id">section2<xsl:value-of disable-output-escaping="yes" select="position()"/></xsl:attribute>
<xsl:value-of disable-output-escaping="yes" select="current()" />
</h5>
</xsl:if>
<xsl:if test="@type='paragraph'">
<p><xsl:value-of disable-output-escaping="yes" select="current()" /></p>
<div class="backtotop">
<a href="#" onclick="javascript:window.location.reload(false)"><xsl:value-of disable-output-escaping="yes" select="wpc:getString('xsl.xmsg.back_to_top', string(/document/@locale))"/></a>
</div>
</xsl:if>
<xsl:if test="@type='image'">
<img>
<xsl:attribute name="src"><xsl:value-of disable-output-escaping="yes" select="wpc:getWebDavAccess(string(current()))"/></xsl:attribute>
<xsl:if test="string-length(@height)!=0">
<xsl:attribute name="height"><xsl:value-of disable-output-escaping="yes" select="@height"/></xsl:attribute>
</xsl:if>
<xsl:if test="string-length(@width)!=0">
<xsl:attribute name="width"><xsl:value-of disable-output-escaping="yes" select="@width"/></xsl:attribute>
</xsl:if>
</img>
</xsl:if>
<xsl:if test="@type='dateinput'">
<p><xsl:value-of disable-output-escaping="yes" select="current()" /></p>
<div class="backtotop">
<a href="#" onclick="javascript:window.location.reload(false)"><xsl:value-of disable-output-escaping="yes" select="wpc:getString('xsl.xmsg.back_to_top', string(/document/@locale))"/></a>
</div>
</xsl:if>
</xsl:for-each>
<xsl:variable name="rlCount" select="count(document/elements/element[@type='furtherreading']/@rid)"/>
<xsl:if test="$rlCount">
<div id="cassidebar">
<div class="box">
<div class="boxhead">
<xsl:value-of disable-output-escaping="yes" select="wpc:getString('xsl.xmsg.related_links', string(/document/@locale))"/>
</div>
<ul>
<xsl:for-each select="document/elements/element">
<xsl:if test="@type='furtherreading'">
<li><a><xsl:attribute name="href"><xsl:value-of disable-output-escaping="yes" select="wpc:getAccessLink(string(@rid), string(/document/@locale))"/></xsl:attribute><xsl:value-of disable-output-escaping="yes" select="@title"/></a></li>
</xsl:if>
</xsl:for-each>
</ul>
</div>
</div>
</xsl:if>
</div>
</div>
</div>
</xsl:template>
</xsl:stylesheet>