Wednesday, April 21, 2010

XSL

<?xml:namespace prefix = xsl /><xsl:stylesheet version="1.0" xsl="http://www.w3.org/1999/XSL/Transform" asp="remove">
<xsl:output version="1.0" indent="yes" encoding="UTF-8" method="xml"></xsl:output>
<xsl:param name="session_name"></xsl:param>
<xsl:template match="ServiceName">
<table cellspacing="0" cellpadding="0" width="700" border="0">
<tbody><tr>
<td>
<div id="content_area">
<div class="ControlHeading">
<table cellspacing="0" cellpadding="0" width="700" border="0">
<tbody><tr>
<td>
<div id="request_heading" style="TEXT-ALIGN: left">
<!--<xsl:value-of select="@name">-->
</div>
</td>
</tr>
<tr>
<td>
<table class="service_contentTable" style="TEXT-ALIGN: left" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td>
<table cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td height="5">
</td>
</tr>
<xsl:for-each select="//Field">
<tr>
<td class="labelHeading">
<xsl:choose>
<xsl:when test="contains(@label, '\n')">
<xsl:value-of select="substring-before(@label, '\n')"></xsl:value-of>
<xsl:value-of select="substring-after(@label, '\n')"></xsl:value-of>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@label"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</td>
<td style="WIDTH: 5px">
</td>
<td>
<xsl:if test="@type = 'TextBox'">

<xsl:value-of select="@value"></xsl:value-of>
</xsl:if>
<xsl:if test="@type = 'CheckBoxList'">
<xsl:for-each select="Listitems/Listitem">
<xsl:if test="@selected = 'True'">
<xsl:value-of select="@value"></xsl:value-of>
<xsl:value-of select="','"></xsl:value-of>
</xsl:if>
</xsl:for-each>
</xsl:if>

<xsl:if test="@type = 'DropDownList'">
<xsl:for-each select="Listitems/Listitem">
<xsl:if test="@selected = 'True'">
<xsl:value-of select="@value"></xsl:value-of>
<xsl:value-of select="','"></xsl:value-of>
</xsl:if>
</xsl:for-each>
</xsl:if>

<xsl:if test="@type = 'ListBox'">
<xsl:for-each select="Listitems/Listitem">
<xsl:if test="@selected = 'True'">
<xsl:value-of select="@value"></xsl:value-of>
<xsl:value-of select="','"></xsl:value-of>
</xsl:if>
</xsl:for-each>
</xsl:if>

<xsl:if test="@type = 'RadioButtonList'">
<xsl:for-each select="Listitems/Listitem">
<xsl:if test="@selected = 'True'">
<xsl:value-of select="@value"></xsl:value-of>
<xsl:value-of select="','"></xsl:value-of>
</xsl:if>
</xsl:for-each>
</xsl:if>

</td>
</tr>
</xsl:for-each>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</div>
</div>
</td>
</tr>
</tbody></table>
</xsl:template>
</xsl:stylesheet>

-----------------------


<xsl:stylesheet version="1.0" xsl="http://www.w3.org/1999/XSL/Transform" asp="remove">
<xsl:output version="1.0" indent="yes" encoding="UTF-8" method="xml"></xsl:output>
<xsl:param name="requestoremail"></xsl:param>
<xsl:param name="requestorlocation"></xsl:param>
<xsl:param name="requestorpassword"></xsl:param>
<xsl:param name="array"></xsl:param>
<xsl:param name="strBreak"></xsl:param>

<xsl:param name="strCurrentDate"></xsl:param>

<xsl:template match="ITRAC/ServiceName">
<table cellspacing="0" cellpadding="0" width="710" border="0">
<tbody><tr>
<td>
<div id="content_area_Popup">
<div class="ControlHeading">
<table cellspacing="0" cellpadding="0" width="710" border="0">
<tbody><tr>
<td>
<div id="ModalPopuprequest_heading">
<xsl:value-of select="@name"></xsl:value-of>
</div>
</td>
</tr>
<tr>
<td>
<div id="ModalPopuprequest_Directive">
Please provide the detail request information below:
</div>
</td>
</tr>
<tr>
<td>
<div id="ServicePopupInner">
<table class="service_contentTable" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td>
<table cellspacing="0" cellpadding="2" border="0">
<tbody><tr>
<td height="5">
</td>
</tr>
<xsl:for-each select="//Field">
<tr>
<xsl:if test="@id!='footername'">
<xsl:if test="@type = 'LabelHeadcol1'">
<td colspan="3">
<?xml:namespace prefix = asp /><asp:label text="{@headtext1}" runat="server" cssclass="labelHeading"></asp:label>
</td>
</xsl:if>
<xsl:if test="@type = 'LabelHeadcol1'">
<td colspan="3">
<asp:label text="{@headtext2}" runat="server" cssclass="labelHeading"></asp:label>
</td>
</xsl:if>
<xsl:if test="@type = 'LabelHeadcol2'">
<td style="WIDTH: 10px"></td>
<td colspan="3">
<asp:label text="{@headtext1}" runat="server" cssclass="labelHeading"></asp:label>
</td>
</xsl:if>
</xsl:if>
</tr>
<tr>
<xsl:if test="@id!='footername'">
<td style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; WIDTH: 10px; PADDING-TOP: 3px">

<xsl:if test="@type = 'TextBox' and @IsActiveDirectory='false' and @checkboxType='Checkbox'">
<asp:checkbox id="{@checkboxid}" runat="server"></asp:checkbox>
</xsl:if>
</td>
<td>
<xsl:if test="@type = 'TextBox' and @IsActiveDirectory='false' and @checkboxType='Checkboxindent1'">
<asp:checkbox id="{@checkboxid}" runat="server"></asp:checkbox>
</xsl:if>
</td>
<td class="labelText" style="PADDING-LEFT: 5px" valign="center">
<xsl:variable name="strNew"></xsl:variable>
<xsl:choose>
<xsl:when test="contains(@label, '\n')">
<xsl:value-of select="substring-before(@label, '\n')"></xsl:value-of>


<p class="SubTextInPopUp"><xsl:value-of select="substring-after(@label, '\n')"></xsl:value-of></p>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@label"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
<asp:label text="{$strNew}" runat="server"></asp:label>
</td>
<td style="WIDTH: 5px">
</td>
<td style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px" valign="top">
<xsl:if test="@type = 'Label' and @SecondColumn='true'">
<asp:label id="{@id}" text="{@label}" runat="server" bold="true"></asp:label>
</xsl:if>
<xsl:if test="@type = 'TextArea'">
<asp:textbox id="{@id}" text="" runat="server" height="100px" cssclass="inputboxpopup" textmode="MultiLine"></asp:textbox>
</xsl:if>
<xsl:if test="@type = 'Date'">
<asp:textbox id="{@id}" text="{$strCurrentDate}" runat="server" cssclass="date-pick"></asp:textbox>
</xsl:if>
<xsl:if test="@type = 'TextBox' and @IsActiveDirectory='false'">
<asp:textbox id="{@id}" text="" runat="server" cssclass="inputboxpopup"></asp:textbox>
</xsl:if>
<xsl:if test="@type = 'TextBox' and @IsActiveDirectory='true' and @id='requestoremail'">
<asp:textbox id="{@id}" text="{$requestoremail}" runat="server" cssclass="inputboxpopup"></asp:textbox>
</xsl:if>
<xsl:if test="@type = 'TextBox' and @IsActiveDirectory='true' and @id='requestorlocation'">
<asp:textbox id="{@id}" text="{$requestorlocation}" runat="server" cssclass="inputboxpopup"></asp:textbox>
</xsl:if>
<xsl:if test="@type = 'TextBox' and @IsActiveDirectory='true' and @id='requestorregion'">
<asp:textbox id="{@id}" text=" " runat="server" cssclass="inputboxpopup"></asp:textbox>
</xsl:if>
<xsl:if test="@type = 'TextBox' and @IsActiveDirectory='true' and @id='requestoroffice'">
<asp:textbox id="{@id}" text=" " runat="server" cssclass="inputboxpopup"></asp:textbox>
</xsl:if>
<xsl:if test="@type = 'TextBox' and @IsActiveDirectory='true' and @id='requestordivision'">
<asp:textbox id="{@id}" text=" " runat="server" cssclass="inputboxpopup"></asp:textbox>
</xsl:if>
<xsl:if test="@type = 'TextBox' and @IsActiveDirectory='true' and @id='requestorpassword'">
<asp:textbox id="{@id}" text="{$requestorpassword}" runat="server" readonly="false" cssclass="inputboxpopup"></asp:textbox>
</xsl:if>
<xsl:if test="@type = 'TextBoxText' and @IsActiveDirectory='true'">
<asp:textbox id="{@id}" text="{@text}" runat="server" cssclass="inputboxpopup"></asp:textbox>
</xsl:if>
<xsl:if test="@type = 'CheckBoxList'">
<asp:checkboxlist id="{@id}" runat="server" repeatdirection="Vertical" repeatlayout="Table" repeatcolumns="{@RepeatColumns}">
<xsl:for-each select="Listitems/Listitem">
<asp:listitem style="PADDING-RIGHT: 35px; PADDING-LEFT: 1px; FLOAT: left; PADDING-BOTTOM: 8px; MARGIN: 0px; VERTICAL-ALIGN: top; PADDING-TOP: 0px" text="{@text}" value="{@value}" selected="{@selected}" cellspacing="10px"></asp:listitem>
</xsl:for-each>
</asp:checkboxlist>
</xsl:if>
<xsl:if test="@type = 'DropDownList' and @IsActiveDirectory='false'">
<asp:dropdownlist id="{@id}" style="WIDTH: 209px" runat="server">
<xsl:for-each select="Listitems/Listitem">
<asp:listitem text="{@text}" value="{@value}" selected="{@selected}"></asp:listitem>
</xsl:for-each>
</asp:dropdownlist>
</xsl:if>
<xsl:if test="@type = 'ListBox'">
<asp:listbox id="{@id}" style="WIDTH: 209px" runat="server" selectionmode="Multiple">
<xsl:for-each select="Listitems/Listitem">
<asp:listitem text="{@text}" value="{@value}" selected="{@selected}"></asp:listitem>
</xsl:for-each>
</asp:listbox>
</xsl:if>

<xsl:if test="@type = 'RadioButtonList'">
<asp:radiobuttonlist id="{@id}" runat="server" repeatdirection="Vertical" repeatlayout="Table" repeatcolumns="{@RepeatColumns}">
<xsl:for-each select="Listitems/Listitem">
<asp:listitem style="PADDING-RIGHT: 35px; PADDING-LEFT: 1px; FLOAT: left; PADDING-BOTTOM: 8px; MARGIN: 0px; VERTICAL-ALIGN: top; PADDING-TOP: 0px" text="{@text}" value="{@value}" selected="{@selected}"></asp:listitem>
</xsl:for-each>
</asp:radiobuttonlist>
</xsl:if>

<div style="PADDING-LEFT: 20px">
<xsl:if test="@type = 'RadioButtonListIndent2'">
<asp:radiobuttonlist id="{@id}" runat="server" repeatdirection="Vertical" repeatlayout="Table" repeatcolumns="{@RepeatColumns}">
<xsl:for-each select="Listitems/Listitem">
<asp:listitem style="PADDING-RIGHT: 35px; PADDING-LEFT: 1px; FLOAT: left; PADDING-BOTTOM: 8px; MARGIN: 0px; VERTICAL-ALIGN: top; PADDING-TOP: 0px" text="{@text}" value="{@value}" selected="{@selected}"></asp:listitem>
</xsl:for-each>
</asp:radiobuttonlist>
</xsl:if>
</div>
</td>
</xsl:if>
<xsl:if test="@type = 'label' and @id='footername'">
<td class="labelHeading" style="PADDING-LEFT: 60px" align="left" colspan="6">
<asp:label text="{@label}" runat="server"></asp:label>
</td>
</xsl:if>
</tr>
</xsl:for-each>
</tbody></table>
</td>
</tr>
</tbody></table>
</div>
</td>
</tr>
</tbody></table>
</div>
</div>
</td>
</tr>
</tbody></table>
</xsl:template>
<xsl:template name="break">
<xsl:param name="text" select="."></xsl:param>
<xsl:choose>
<xsl:when test="contains($text, ' ')">
<xsl:value-of select="substring-before($text, ' ')"></xsl:value-of>


<xsl:call-template name="break">
<xsl:with-param name="label" select="substring-after($text, ' ')"></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>

----------------

No comments: