|
Subject: XSLT's with Cocoon From: "Simon McClenahan" <Simon@xxxxxxxx> Date: Tue, 9 Nov 1999 15:18:26 -0600 |
I am re-sending this message since it looked like the mailing list added a
bunch of confusing =3D's and such because I have the body of my email
MIME-encoded Quoted-printable. Now I have no MIME formatting, so it should
look a little better (at least when reading the list Digest)
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>
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Wish List: generate-id(), Clark C. Evans | Thread | Multiple source documents, Bill Abbas |
| Re: xsl whitespace question, Franz Figl | Date | why an XSL processor might skip par, Mike Brown |
| Month |