cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Edwards <tedwa...@civica.com.au>
Subject Problem with transform of aggregation
Date Thu, 26 Feb 2004 00:16:22 GMT
Hi Cocooners,
Sorry about the lengthy post but I'm flummoxed!
I have a somewhat perplexing issue in that I'm aggregating the output of 
3 XSPs that collectively return information about an asset's booking and 
date details.
If I save the XML generated from the aggregation and run it through the 
transform then the output is what I expect it to be, but if I try to run 
it in real time through the pipeline then no booking details are displayed.
The XSL line of interest is:

                <xsl:when test="$bookingList/event_desc = $evtDesc">
                    <td>
                        <xsl:apply-templates 
select="$bookingList[event_desc = $evtDesc]" mode="getBooking"/>
                    </td>
                </xsl:when>

What this is trying to do is grab booking data that matches the name of 
the event eg: if we've got a booking for a room for Period 2 then the 
resulting table will show the name of the event (Period 2 in the first 
column) with the booking description in the second column of the table.
At the moment I'm not getting the match on the booking details. When run 
as a stand alone transform I get every event listed in column 1 and an 
entry in column 2 for those events that have a booking.

Why is the real time pipeline not working??

Thanks for any suggestions.

Tony

<!-- This is the complete XSL transform -->
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0">
<xsl:output method="html" encoding="UTF-8"/>

    <xsl:param name="mode" />
    <xsl:param name="start" select="//calendar/start"/>
    <xsl:param name="count" select="//calendar/count"/>
    <xsl:param name="selectedDay" select="//calendar/selectedDay"/>
    <xsl:param name="monthName" select="//calendar/monthName"/>
    <xsl:param name="monthNumber" select="//calendar/monthNumber"/>
    <xsl:param name="year" select="//calendar/year"/>
    <xsl:param name="today" select="//calendar/today"/>
    <xsl:param name="currMonth" select="//calendar/currMonth"/>
    <xsl:param name="currYear" select="//calendar/currYear"/>
   
    <xsl:variable name="eventDescriptions" 
select="//event_desc[parent::events]"/>
    <xsl:variable name="bookingList" 
select="//bookings/booking/booking_details"/>
   
    <xsl:template match="/">

    <html>
    <head><title><xsl:value-of select="$today"/></title>

        <meta content="text/html;charset=UTF-8" http-equiv="content-type"/>
        <title>Booking Display by Day</title>
    </head>

    <body bgcolor="#ffffff" border="1">
        <h1>Booking Display for <xsl:value-of select="$today"/></h1>
        <center>
        <h4>Tool</h4>
            <table>
                <xsl:for-each select="$eventDescriptions">
                    <xsl:apply-templates select="."/>
                </xsl:for-each>
            </table>
        <h5>PostTool</h5>
        </center>
       
    </body>
    </html>

</xsl:template>

<xsl:template match="event_desc">
    <xsl:variable name="evtDesc" select="normalize-space(.)"/>
    <tbody>
    <tr>
        <td><xsl:value-of select="$evtDesc"/></td>
        <td>&#160;</td>
            <xsl:choose>
                <xsl:when test="$bookingList/event_desc = $evtDesc">
                    <td>
                        <xsl:apply-templates 
select="$bookingList[event_desc = $evtDesc]" mode="getBooking"/>
                    </td>
                </xsl:when>
                <xsl:otherwise>
                    <td>&#160;</td>
                </xsl:otherwise>
            </xsl:choose>     
    </tr>
    </tbody>   
</xsl:template>

<xsl:template match="booking_details"/>

<xsl:template match="booking_details" mode="getBooking">
   
    <xsl:variable name="booker" select="name"/>
    <xsl:variable name="asset" select="asset_name"/>
    <xsl:variable name="bookDetail">
        <xsl:value-of select="concat('Booker: ',$booker,' | Asset: ', 
$asset)"/>
    </xsl:variable>
    <xsl:value-of select="$bookDetail"/><xsl:value-of select="event_desc"/>
    <!-- *********************
    <td><xsl:value-of select="event_desc"/></td>
    ********************* -->

</xsl:template>

<xsl:template match="text()"/>
</xsl:stylesheet>



<!--The aggregated xml looks like this: -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<site>
    <bookings>
        <booking>
            <booking_date>2004-February-24</booking_date>
            <booking_details>
                <event_desc>After School</event_desc>
                <name>Tim Edwards</name>
                <asset_name>Primary Reading</asset_name>
            </booking_details>
            <booking_details>
                <event_desc>After School</event_desc>
                <name>Anthony Edwards</name>
                <asset_name>Senior Computing</asset_name>
            </booking_details>
            <booking_details>
                <event_desc>Period 3</event_desc>
                <name>Tim Edwards</name>
                <asset_name>Seminar</asset_name>
            </booking_details>
            <booking_details>
                <event_desc>Period 4</event_desc>
                <name>Tim Edwards</name>
                <asset_name>G7</asset_name>
            </booking_details>
        </booking>
    </bookings>
    <events>
        <event_desc>Period 1</event_desc>
        <event_desc>Period 2</event_desc>
        <event_desc>Period 3</event_desc>
        <event_desc>Period 4</event_desc>
        <event_desc>Period 5</event_desc>
        <event_desc>Period 6</event_desc>
        <event_desc>After School</event_desc>
    </events>
    <calendar_page>
        <calendar>
            <start>1</start>
            <count>29</count>
            <selectedDay>0</selectedDay>
            <monthName>February</monthName>
            <monthAbbrev>Feb</monthAbbrev>
            <monthNumber>1</monthNumber>
            <year>2004</year>
            <today>2004-February-26</today>
            <currMonth>1</currMonth>
            <currYear>2004</currYear>
            <monthStart>2004-02-01</monthStart>
            <monthEnd>2004-02-29</monthEnd>
        </calendar>
    </calendar_page>
</site>

>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message