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 October 14th, 2008, 09:01 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

See if you can reproduce the result on more than one XSLT processor. I think you may have a processor bug here.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old October 16th, 2008, 01:10 PM
Authorized User
 
Join Date: Oct 2008
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Default

RESOLVED. Rewrote the entire main template, but it works now. I had been looking at it too long and too closely to see the problem. Seems easy now.

Code:
<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes">
    <xsl:param name="project"/>
    <xsl:param name="today"/>

    <xsl:template match="/">
        <xsl:for-each select="//calendar/event/program[@id=$project]">
            <xsl:sort select="../evdate" order="ascending" data-type="number"/>
            <xsl:if test="../evdate &gt;= $today and position() = 1">
                <xsl:element name="h1">
                <xsl:attribute name="class">side</xsl:attribute>    
                    UPCOMING MEETING
                </xsl:element>
                <xsl:element name="ul">
                    <xsl:attribute name="class">sbox</xsl:attribute>
                    <xsl:element name="li">
                        <xsl:element name="b">
                            <xsl:attribute name="style">color: #a77909</xsl:attribute>
                            <xsl:call-template name="format-date"/> :: <xsl:value-of select="../evstart"/>-<xsl:value-of select="../evend"/> :: 
                        </xsl:element><xsl:value-of select="../evname"/> at <xsl:value-of select="../location"/>
                    </xsl:element>
                </xsl:element>            
                <xsl:element name="div">
                    <xsl:attribute name="class">hrbrk</xsl:attribute>
                </xsl:element>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>
    <xsl:template name="format-date">
        <xsl:variable name="d">
            <xsl:value-of select="../evdate"/>
        </xsl:variable>
        <xsl:call-template name="long_date">
            <xsl:with-param name="date" select="$d"/>
        </xsl:call-template>
    </xsl:template>    
    <xsl:template name="long_date">
        <xsl:param name="date"/>
        <xsl:value-of select="substring($date, 7, 2)"/>#160;
    <xsl:variable name="month" select="substring($date, 5, 2)"/>
        <xsl:choose>
            <xsl:when test="$month=01">January</xsl:when>
            <xsl:when test="$month=02">February</xsl:when>
            <xsl:when test="$month=03">March</xsl:when>
            <xsl:when test="$month=04">April</xsl:when>
            <xsl:when test="$month=05">May</xsl:when>
            <xsl:when test="$month=06">June</xsl:when>
            <xsl:when test="$month=07">July</xsl:when>
            <xsl:when test="$month=08">August</xsl:when>
            <xsl:when test="$month=09">September</xsl:when>
            <xsl:when test="$month=10">October</xsl:when>
            <xsl:when test="$month=11">November</xsl:when>
            <xsl:when test="$month=12">December</xsl:when>
            <xsl:otherwise>INVALID MONTH</xsl:otherwise>
        </xsl:choose>#160;
      <xsl:value-of select="substring($date, 1, 4)"/>
    </xsl:template>    
</xsl:stylesheet>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort by date...select....display first item prob athos XSLT 2 November 3rd, 2008 04:31 PM
Display data as per combobox item selected yogeshyl Excel VBA 0 July 28th, 2007 06:17 AM
display datagrid item shwetarani2002 ASP.NET 1.0 and 1.1 Basics 1 July 16th, 2007 07:47 AM
Tab item display prob / hide TABS query socoolbrewster CSS Cascading Style Sheets 4 June 13th, 2006 12:59 PM
Datagrid - selected item display advice janetb ASP.NET 1.0 and 1.1 Basics 2 May 9th, 2006 02:56 PM





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