ckelsoe
asked on
2 column XSL in "snake" format
I need help creating XSL to display one field in two columns that snake. For example, if there are 29 rows of data, I want items 1-15 to show up in column 1 and items 16 - 29 in column 2. Below is a page generated by WSS2007 in Sharepoint Designer that alternates the items between the two columns, which is not what I need. I do not know XSL enough to make the necessary modifications.
<%@ Page Language="C#" inherits="Microsoft.ShareP oint.WebPa rtPages.We bPartPage, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e 9429c" %>
<%@ Register tagprefix="SharePoint" namespace="Microsoft.Share Point.WebC ontrols" assembly="Microsoft.ShareP oint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e 9429c" %>
<%@ Register tagprefix="WebPartPages" namespace="Microsoft.Share Point.WebP artPages" assembly="Microsoft.ShareP oint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e 9429c" %>
<html dir="ltr">
<head runat="server">
<META name="WebPartPageExpansion " content="full">
<meta name="ProgId" content="SharePoint.WebPar tPage.Docu ment" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
<meta name="Microsoft Theme" content="Belltown 1011, default">
<style type="text/css">
@import url('ows.css');
</style>
</head>
<body>
<form id="form1" runat="server">
<WebPartPages:DataFormWebP art runat="server" IsIncluded="True" FrameType="None" NoDefaultStyle="TRUE" ViewFlag="0" Title="" ListName="{F7D98E26-DEE1-4 2DA-8384-3 1B59425E5C A}" Default="FALSE" DisplayName="" __markuptype="vsattributem arkup" __WebPartId="{F2E19FA8-050 7-4293-BED A-B173E111 6B44}" id="g_f2e19fa8_0507_4293_b eda_b173e1 116b44" __AllowXSLTEditing="true" WebPart="true" Height="" Width="">
<DataSources>
<SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="<View> ;<Query ><Or derBy>& lt;FieldRe f Name="Title" Ascending="TRUE" /></ OrderBy> ;</Quer y></ View>" id="spdatasource2"><Select Parameters ><WebPartP ages:DataF ormParamet er Name="ListID" ParameterKey="ListID" PropertyName="ParameterVal ues" DefaultValue="F7D98E26-DEE 1-42DA-838 4-31B59425 E5CA"/></S electParam eters><Del eteParamet ers><WebPa rtPages:Da taFormPara meter Name="ListID" ParameterKey="ListID" PropertyName="ParameterVal ues" DefaultValue="F7D98E26-DEE 1-42DA-838 4-31B59425 E5CA"/></D eleteParam eters><Upd ateParamet ers><WebPa rtPages:Da taFormPara meter Name="ListID" ParameterKey="ListID" PropertyName="ParameterVal ues" DefaultValue="F7D98E26-DEE 1-42DA-838 4-31B59425 E5CA"/></U pdateParam eters><Ins ertParamet ers><WebPa rtPages:Da taFormPara meter Name="ListID" ParameterKey="ListID" PropertyName="ParameterVal ues" DefaultValue="F7D98E26-DEE 1-42DA-838 4-31B59425 E5CA"/></I nsertParam eters></Sh arePoint:S PDataSourc e>
</DataSources>
<ParameterBindings>
<ParameterBinding Name="ListID" Location="None" DefaultValue="F7D98E26-DEE 1-42DA-838 4-31B59425 E5CA"/>
<ParameterBinding Name="dvt_apos" Location="Postback;Connect ion"/>
<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserN ame"/>
<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate" />
</ParameterBindings>
<datafields>@ID,ID;@Conten tType,Cont ent Type;@Modified,Modified;@C reated,Cre ated;@Auth or,Created By;@Editor,Modified By;@_UIVersionString,Versi on;@Attach ments,Atta chments;@T itle,Title ;@File_x00 20_Type,Fi le Type;@FileLeafRef,Name (for use in forms);@FileDirRef,Path;@F SObjType,I tem Type;@_HasCopyDestinations ,Has Copy Destinations;@_CopySource, Copy Source;@ContentTypeId,Cont ent Type ID;@_ModerationStatus,Appr oval Status;@_UIVersion,UI Version;@Created_x0020_Dat e,Created; @FileRef,U RL Path;@URL,URL;@Comments,No tes;</data fields>
<XSL>
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="x sl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-m icrosoft-c om:xslt" xmlns:SharePoint="Microsof t.SharePoi nt.WebCont rols" xmlns:ddwrt2="urn:frontpag e:internal ">
<xsl:output method="html" indent="no"/>
<xsl:decimal-format NaN=""/>
<xsl:param name="dvt_apos">'</xs l:param>
<xsl:variable name="dvt_1_automode">0</x sl:variabl e>
<xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsof t.SharePoi nt.WebCont rols">
<xsl:call-template name="dvt_1"/>
</xsl:template>
<xsl:template name="dvt_1">
<xsl:variable name="dvt_StyleName">2ColC ma</xsl:va riable>
<xsl:variable name="Rows" select="/dsQueryResponse/R ows/Row" />
<table border="0" width="100%">
<tr>
<xsl:call-template name="dvt_1.body">
<xsl:with-param name="Rows" select="$Rows" />
</xsl:call-template>
</tr>
</table>
</xsl:template>
<xsl:template name="dvt_1.body">
<xsl:param name="Rows" />
<xsl:for-each select="$Rows">
<xsl:call-template name="dvt_1.rowview" />
</xsl:for-each>
</xsl:template>
<xsl:template name="dvt_1.rowview">
<td valign="top" width="50%" class="ms-GRFont" >
<b>
<a href="{substring-before(@U RL, ', ')}">
<xsl:value-of select="substring-after(@U RL, ', ')" />
</a>
</b>
<br />
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
<br /><span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:Es capeDelims (string(@I D))" ddwrt:ammode="view" />
</xsl:if>
</td>
<xsl:if test="position() mod 2 = 0" ddwrt:cf_ignore="1">
<xsl:text disable-output-escaping="y es"></t r></xsl :text>
<xsl:if test="position() != last()" ddwrt:cf_ignore="1">
<xsl:text disable-output-escaping="y es"><tr ></xsl: text>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet> </XSL>
</WebPartPages:DataFormWeb Part>
</form>
</body>
</html>
<%@ Page Language="C#" inherits="Microsoft.ShareP
<%@ Register tagprefix="SharePoint" namespace="Microsoft.Share
<%@ Register tagprefix="WebPartPages" namespace="Microsoft.Share
<html dir="ltr">
<head runat="server">
<META name="WebPartPageExpansion
<meta name="ProgId" content="SharePoint.WebPar
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
<meta name="Microsoft Theme" content="Belltown 1011, default">
<style type="text/css">
@import url('ows.css');
</style>
</head>
<body>
<form id="form1" runat="server">
<WebPartPages:DataFormWebP
<DataSources>
<SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="<View>
</DataSources>
<ParameterBindings>
<ParameterBinding Name="ListID" Location="None" DefaultValue="F7D98E26-DEE
<ParameterBinding Name="dvt_apos" Location="Postback;Connect
<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserN
<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"
</ParameterBindings>
<datafields>@ID,ID;@Conten
<XSL>
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="x
<xsl:output method="html" indent="no"/>
<xsl:decimal-format NaN=""/>
<xsl:param name="dvt_apos">'</xs
<xsl:variable name="dvt_1_automode">0</x
<xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsof
<xsl:call-template name="dvt_1"/>
</xsl:template>
<xsl:template name="dvt_1">
<xsl:variable name="dvt_StyleName">2ColC
<xsl:variable name="Rows" select="/dsQueryResponse/R
<table border="0" width="100%">
<tr>
<xsl:call-template name="dvt_1.body">
<xsl:with-param name="Rows" select="$Rows" />
</xsl:call-template>
</tr>
</table>
</xsl:template>
<xsl:template name="dvt_1.body">
<xsl:param name="Rows" />
<xsl:for-each select="$Rows">
<xsl:call-template name="dvt_1.rowview" />
</xsl:for-each>
</xsl:template>
<xsl:template name="dvt_1.rowview">
<td valign="top" width="50%" class="ms-GRFont" >
<b>
<a href="{substring-before(@U
<xsl:value-of select="substring-after(@U
</a>
</b>
<br />
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
<br /><span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:Es
</xsl:if>
</td>
<xsl:if test="position() mod 2 = 0" ddwrt:cf_ignore="1">
<xsl:text disable-output-escaping="y
<xsl:if test="position() != last()" ddwrt:cf_ignore="1">
<xsl:text disable-output-escaping="y
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet> </XSL>
</WebPartPages:DataFormWeb
</form>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
no need to award double points
refer to the answer here and ask for a PAQ-points refund
cheers
Geert
refer to the answer here and ask for a PAQ-points refund
cheers
Geert
ASKER