·
Create Template with standard values
·
Create Layout and relate the layout with the
template from Template – Presentation – details – Default – Edit – Select
layout – OK
·
Create Layout Page in Visual Studio with same
name. Add “sc” placeholder tag as
o
<sc:Placeholder
ID="ModelPlaceholder"
Key="ModelPlaceholder"
runat="server"
/>
·
Create XSLT in Sitecore in Layout\Renderings\Component.
Specify Path as “/layouts/Renderings/Components/ModelRendering.xslt”
o
Note: - This Path must map with VS folder
structure path. Check spellings.
·
Add XSLT in VS in “/layouts/Renderings/Components/ModelRendering.xslt”
like
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sc="http://www.sitecore.net/sc" xmlns:dot="http://www.sitecore.net/dot"
exclude-result-prefixes="dot
sc" >
<xsl:output method="html" indent="yes" encoding="UTF-8"/>
<!-- parameters -->
<xsl:param name="lang" select="'en'"/>
<xsl:param name="id" select="''"/>
<xsl:param name="sc_item"/>
<xsl:param name="sc_currentitem"/>
<!-- entry point -->
<xsl:template match="*">
<!--<xsl:value-of select
="$sc_currentitem"></xsl:value-of>-->
<table>
<tr>
<td>Model Name</td>
<td><sc:text field="ModelName"></sc:text></td>
</tr>
<tr>
<td>Model Number</td>
<td><sc:text field="ModelNumber"></sc:text></td>
</tr>
<tr><td>Model Image</td>
<td>
<sc:image Alt="Car" Width="100px" Height="100px" MaxWidth="500" MaxHeight="500" field="ModelImage"> </sc:image>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
|
o
Note: - Keep all tag in small letters like <sc:text as
XSLT is case sensitive. While in VS you can write it as “<sc:Text”. Also
remove “id” and “runat” property from XSLT.
·
Build VS project.
·
Relate the XSLT with the template from Template
– Presentation – details – Default – Edit – Controls – Add – Select XSLT File –
Enter Placeholder name – Select - OK – OK
·
Create Content from template. See preview either
from Presentation – Preview or Publish – Preview.