[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSLT's with Cocoon

Subject: XSLT's with Cocoon
From: "Simon McClenahan" <Simon@xxxxxxxx>
Date: Mon, 8 Nov 1999 14:35:12 -0600
cocoon row id
I am using Cocoon 1.5 with XSL:P which implements the XSLT WD 1.0 19990421. The next release of Cocoon will support XT, but I would like to get my current problem solved using an "official" release of Cocoon, and I seem to be stuck with XSL:P.

I want to detect a change in the value of <STAT_CATEGORY> for each <ROW>. I thought I could create <xsl:variable>s to save the last <STAT_CATEGORY>, but I soon found out that this is not possible! So I read up on XPath and XSLT working drafts, and only recently discovered that XSL:P implements a relatively old version. Because Cocoon does not give me any clue to any XSL processing errors or warnings, I have done a lot of trial and error trying to figure this out.

I am using the following edited XML data (re-formatted by hand because the SQLProcessor doesn't have a "pretty" option):

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="dashboard.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<page>
<ROWSET>
<ROW ID="0">
<ORDER_NBR>0</ORDER_NBR>
<STAT_CATEGORY>Sales</STAT_CATEGORY>
<STAT_TITLE>SS Sales</STAT_TITLE>
<SAMPLE_VALUE>-999</SAMPLE_VALUE>
</ROW>

<ROW ID="1">
<ORDER_NBR>0</ORDER_NBR>
<STAT_CATEGORY>Sales</STAT_CATEGORY>
<STAT_TITLE>SS Sales</STAT_TITLE>
<SAMPLE_VALUE>118487391.17</SAMPLE_VALUE>
</ROW>

<ROW ID="9">
<ORDER_NBR>4</ORDER_NBR>
<STAT_CATEGORY>Sales</STAT_CATEGORY>
<STAT_TITLE>Total Sales</STAT_TITLE>
<SAMPLE_VALUE>289400790.91</SAMPLE_VALUE>
</ROW>
<ROW ID="10">
<ORDER_NBR>5</ORDER_NBR>
<STAT_CATEGORY>GP</STAT_CATEGORY>
<STAT_TITLE>SS GP</STAT_TITLE>
<SAMPLE_VALUE>-999</SAMPLE_VALUE>
</ROW>
<ROW ID="11">






My dashboard.xsl file looks like this (edited):

    <xsl:template match="ROWSET">
        <TABLE border="2" width="80%" cellspacing="1" cellpadding="1">
            <xsl:for-each select="ROW">
                <xsl:choose>
                    <xsl:when test="SAMPLE_VALUE=(-999)">
                        <xsl:value-of select="../ROW[@ID=(current()/@ID-1)]/@ID"/>;
                        <xsl:value-of select="from-preceding-siblings(.[position()=1]/@ID)"/>;
                        <xsl:choose>
                            <xsl:when test="not(//ROW[@ID=(../@ID-1))]/STAT_CATEGORY = STAT_CATEGORY)">
                                <TR>
                                    <xsl:apply-templates/>
                                </TR>
                            </xsl:when>
                        </xsl:choose>
                    </xsl:when>
                    <xsl:otherwise>
                        <TR>
                            <xsl:apply-templates/>
                        </TR>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>
        </TABLE>
    </xsl:template>


I'm obviously using the <xsl:value-of> to print out some values to see if they will work in a test attribute. The first one is what I think it should be. The second one is my attempt at using the 19990421 WD. The <xsl:when> is an example of what does not work, as explained in the most recent WD (but I have it in there so I can get some sort of output).

So, my question is, how do I do this with XSL:P and XT?


cheers,
    Simon



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.