Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 10th, 2008, 08:34 PM
Registered User
 
Join Date: Aug 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Next previous month navigation

i have a problem understanding the proper way on how to navigate months using xslt. here's my dilema. i created a calendar web part on sharepoint 2007 using a content query web part, i'm currently customizing my calendar by editing the xsl file for the style. i can already get the events from the list and filter them for each month. my problem is that i need to createa previous and next month anchor in order to navigate the different months of the year? can somebody please help me? a sample code will be much appreciated. i'm Desperate =) thanks

 
Old August 11th, 2008, 02:01 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Not really an XSLT question. How do you access a particular month's details? Once you have a URL that can do this you just need to create two links via XSLT that point to the month either side of the one currently displayed.

--

Joe (Microsoft MVP - XML)
 
Old August 12th, 2008, 08:06 PM
Registered User
 
Join Date: Aug 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there no other way? like using the preceeding sibling method?

the month navigation should include filtering for the sharepoint list data. for example is when i choosr july which will be displayed like < July >, all events on the said month will be available below the month? am i making sense? i'm sorry coz im kinda new at this.:D
 
Old August 13th, 2008, 02:32 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You seem to be slightly confused about the order of processing. Once you have accessed the XML data and transformed it to HTML how would you then access the previous sibling? This would only be possible if you still had access to all the underlying XML and were able to re-transform based on some parameter.
The usual model in SharePoint is to access the relevant XML and transform via XSLT to the final HTML. Once that stage is reached the XML is a distant memory and the HTML has no concept of how it was created.

--

Joe (Microsoft MVP - XML)
 
Old August 13th, 2008, 08:58 PM
Registered User
 
Join Date: Aug 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i still have a hard time understanding maybe if i show my code you could me further:

Here is my created itemstyle.xsl from sharepoint,all the data displayed are taken from my calendar list by edditing the commonviewfields of the content web part:


 <xsl:template name="CalendarStyle" match="Row[@Style='CalendarStyle']" mode="itemstyle">

    <xsl:variable name="SafeImageUrl">
      <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
        <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/>
      </xsl:call-template>
    </xsl:variable>

    <xsl:variable name="SafeLinkUrl">
      <xsl:call-template name="OuterTemplate.GetSafeLink">
        <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
      </xsl:call-template>
    </xsl:variable>

    <xsl:variable name="DisplayTitle">
      <xsl:call-template name="OuterTemplate.GetTitle">
        <xsl:with-param name="Title" select="@Title"/>
        <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
      </xsl:call-template>
    </xsl:variable>

    <xsl:variable name="LinkTarget">
      <xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if>
    </xsl:variable>

    <xsl:variable name="Date">
      <xsl:value-of select="ddwrt:FormatDateTime(string(@Date) ,1033 ,'dd')" />
    </xsl:variable>

    <xsl:variable name="StringDate">
      <xsl:value-of select="ddwrt:FormatDateTime(string(@Date) ,1033,'MMMM')" />
    </xsl:variable>

    <xsl:variable name="CurrentDate">
      <xsl:value-of select="ddwrt:FormatDateTime(string(ddwrt:Today()) , 1033, 'MMMM')"/>
    </xsl:variable>


    <xsl:if test="string-length($SafeImageUrl) != 0">
      <div class="image-area-left">
        <a href="{$SafeLinkUrl}" target="{$LinkTarget}">
          <img class="image-fixed-width" src="{$SafeImageUrl}" alt="{@ImageUrlAltText}"/>
        </a>
      </div>
    </xsl:if>

    <xsl:variable name="Author">
      <xsl:call-template name="OuterTemplate.GetGroupName">
        <xsl:with-param name="GroupName" select="@Author"/>
        <xsl:with-param name="GroupType" select="'User'"/>
      </xsl:call-template>
    </xsl:variable>
  <div id="linkitem" class="item">
      <div class="link-item">

        <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate "/>

        <html>
          <table>
            <body>

            <a href="{$SafeLinkUrl}" target="{$LinkTarget}" title="{@LinkToolTip}">


                <xsl:if test=" ddwrt:FormatDateTime(string(ddwrt:Today()), 1033, 'MMMM') = ddwrt:FormatDateTime(string(@Date) ,1033 ,'MMMM') ">

                  <tr>
                    <tr>
                      <td>
                        <a href="#)" title="Go to the previous month">&lt;</a>
                      </td>
                      <td>
                        <xsl:value-of select="$CurrentDate"/>
                      </td>
                      <td>
                        <a href="#" title="Go to the next month">&gt;</a>
                      </td>
                    </tr>

                    <td>
                      <xsl:value-of select="$Date"/>
                    </td>
                    <td>
                      <xsl:value-of select="'|'"/>
                    </td>
                    <td>
                      <xsl:value-of select="$DisplayTitle"/>
                    </td>
                    <td>
                      <xsl:value-of select="substring(@DisplayTitle, 1 , 30)" disable-output-escaping="yes"/>
                      <a href="{$SafeLinkUrl}" target="$LinkTarget" title=">">></a>
                    </td>
                  </tr>
                </xsl:if>

              </a>

            </body>
          </table>
        </html>
      </div>
    </div>

  </xsl:template>


with this code, my output is such for the month of august with 3 events:

< August >
07 | Success of development! >


< August >
10 | The testing peroid >


< August >
17 | Continue Development >


i'm really having a hard time since this is my first try at this. my desired output should be like this:

< August >
07 | Success of development! >
10 | The testing peroid >
17 | Continue Development >


can you please help me with my code? it's really frustrating that i can't figure this out? thank you so much... i also need to navigate between months... you're help and guidance is very much appreciated... i'd really like to learn this stuff...







Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting month name to month number kalyanykk SQL Server 2005 7 August 19th, 2008 10:37 PM
getting the second saturday of every month haleem .NET Framework 2.0 1 May 3rd, 2007 12:38 AM
query Current Month, Month+1, Month+2, Month+3 anterior Access 2 September 24th, 2006 08:25 PM
Days in a Month jmss66 Classic ASP Basics 3 April 11th, 2005 05:57 PM
Getting the current month Regornil JSP Basics 1 July 19th, 2004 09:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.