날짜별로 SharePoint 목록을 필터링하는 중 실제 문제가 있습니다. 나는 각 엔트리마다 목록의 카운트가있는 월/년리스트를 만들고 싶다. 여기서 카운트에는 해당 월의 15 일 또는 그 다음 달의 15보다 크거나 같은 날짜가 포함된다. 나는 12 월 15 일을 제외하고는 12 월 15 일부터 2010 년 12 월 14 일까지 (예를 들면) 12 월을 제외하고이 모든 것을 잘 할 수 있습니다. 나는 같은 방법을 사용함에 따라 차이가 있어야하는 이유를 실제로 알 수 없습니다. 누구든지 내 코드에서 실수를 보거나 더 나은 방법을 발견하면 매우 감사하게 생각합니다. 코드의 Sharepoint 날짜 조작 및 필터링
<xsl:template name="generateTable">
<xsl:param name="numMonths" />
<xsl:param name="Rows" />
<xsl:param name="dvt_Rows" />
<xsl:param name="tday" select="$startDay" />
<xsl:param name="tmonth" select="($startMonth + msxsl:node-set($numMonths)-1) mod 12 + 1" />
<xsl:param name="tyear" select="$startYear + floor(($numMonths+msxsl:node-set($startMonth)-1) div 12)" />
<xsl:variable name="date" select="concat($tday,'/',$tmonth,'/',$tyear)"/>
<tr>
<td>
<xsl:value-of select="ddwrt:FormatDateTime(string($date),3081,'MMMM yyyy')"/>
</td>
<td>
<xsl:choose>
<xsl:when test="$tmonth=12">
<xsl:value-of select="count(/dsQueryResponse/Rows[1]/Row[(
(ddwrt:FormatDateTime (string (@Date) , 3081, 'M yyyy'))=(ddwrt:FormatDateTime (string ($date) , 3081, 'M yyyy'))
and number(substring(ddwrt:FormatDateTime(string(@Date), 3081, 'dd'),1,2)) >=$startDay)])+
count(/dsQueryResponse/Rows[1]/Row[(
concat(string(number(substring(ddwrt:FormatDateTime (string (@Date) , 3081, 'M yyyy'),1,2))+11),' ',
string(number(substring(ddwrt:FormatDateTime (string (@Date) , 3081, 'MM yyyy'),4))-1))=string(ddwrt:FormatDateTime (string ($date) , 3081, 'M yyyy'))
and number(substring(ddwrt:FormatDateTime(string(@Date), 3081, 'dd'),1,2)) <$startDay)])"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="count(/dsQueryResponse/Rows[1]/Row[(
(ddwrt:FormatDateTime (string (@Date) , 3081, 'M yyyy'))=(ddwrt:FormatDateTime (string ($date) , 3081, 'M yyyy'))
and number(substring(ddwrt:FormatDateTime(string(@Date), 3081, 'dd'),1,2)) >=$startDay)])+
count(/dsQueryResponse/Rows[1]/Row[(
concat(string(number(substring(ddwrt:FormatDateTime (string (@Date) , 3081, 'MM yyyy'),1,2))-1),
substring(ddwrt:FormatDateTime (string (@Date) , 3081, 'MM yyyy'),3,6))=(ddwrt:FormatDateTime (string ($date) , 3081, 'M yyyy'))
and number(substring(ddwrt:FormatDateTime(string(@Date), 3081, 'dd'),1,2)) <$startDay)])"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<xsl:if test="msxsl:node-set($numMonths) > 0">
<xsl:call-template name="generateTable">
<xsl:with-param name="numMonths" select="msxsl:node-set($numMonths)-1" />
<xsl:with-param name="dvt_Rows"/>
<xsl:with-param name="Rows"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
, tday가 tmonth 및 tyear는 D/m/Y에서 오늘 날짜이다 NUMMONTHS 테이블에서 요구 달 수를 보유하는 변수이며, startDay를 15.
인 내가 볼 수있는 한, 날짜 필드에 11 개월을 추가해도 작동하지만 연도를 추출하여 숫자로 변경하고 1을 빼면 문제가있는 것으로 보입니다. 그러나 나는 그것이 작동하도록 할 수 없기 때문에, 나는 완전히 간단한 생각을 다 써 버렸다.
XML 문서는 Sharepoint 목록이며 순수 XML로 공유하는 방법을 알지 못합니다. XML에 대한 유일한 참조는 Sharepoint 목록의 행을 선택하고 Date 필드 (@Date)를 사용하여 필터를 수행하는/dsQueryResponse/Rows [1]/Row입니다. 이 모든 도움이됩니까?
저는 Sharepoint 2007을 사용하고 있으며, Sharepoint Designer를 사용하여 dataFormWebPart를 삽입하여 Sharepoint 목록을 가져 오기 시작했습니다. 그런 다음 목록의 모든 행을 참조하는 xpath,/dsQueryResponse/Rows/Row를 사용하여 XSLT의 Sharepoint 목록에 액세스 할 수 있습니다. (필자는 두 개의 목록 데이터 소스를 가지고 있으므로 특정 목록을 참조하기 위해 여기에 [1]을 추가했습니다.)
먼저 Sharepoint에서 목록을 필터링하는 것을 선호합니다. 우선, 내가 원한 것을 생산할 수 없으므로 먼저 잘못된 것으로 생각합니다. 항목이 없을 때 0을 포함합니다. 특정 월의 경우와 월 필터의 15보다 큰 경우 내 방법이 거의 효과가있어 매우 실망 스럽지만 특히 간단하고 빠른 경우 어떤 방법이든 환영합니다. 감사
예를 들어
가능한 한 최소한의 문제를 설명하는 XML 문서를 제공 할 수 있습니까? 훨씬 간단한 솔루션이있을 수 있지만 XML 문서가 필요하다고 생각합니다. –
몇 가지 질문 .. SharePoint의 버전은 무엇입니까? SharePoint 목록에서 데이터를 어떻게 얻고 있습니까? 또한 XSLT를 사용하여 SharePoint 목록을 필터링하는 이유는 무엇입니까? 행을 필터링하기 위해 목록을 쿼리 한 다음 XSLT를 사용하여 결과를 변환 하시겠습니까? –