Subject: Re: [xsl] Summarizing sibling nodes From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 14 Mar 2001 18:14:06 +0000 |
Let's look at that for-each select first: The XPath: Truck[not(VINModelYearName/preceding::Truck/VINModelYearName)] | Truck[not(VINModelName/preceding::Truck/VINModelName)]
I don't think you want this. Something like (let's just look at the first half) Truck[not(VINModelYearName = preceding::Truck/VINModelYearName)] is closer, it says
I know the count part is wrong. I think I would put whatever pattern I use in my for-each in my count to return the same set of results to count.
I'm not sure though, because basically what I'm trying to do is create nodes on the fly matching a particular pattern. The pattern can change, because I want it for all the years, and for any Model (Which I could make a list of, but it would be quite long).
Hope that helps! (and folks, please check my logic), Wendell
I'm rather new to XSL (Few months) and am running across a little problem, hoping someone here can help me. Thanks for your time.
I have the following XML. . .
<Truck-list> <Truck> <VINModelName> T600 </VINModelName> <VINModelYearName> 1999 </VINModelYearName> </Truck> <Truck> <VINModelName> T100 </VINModelName> <VINModelYearName> 1999 </VINModelYearName> </Truck> <Truck> <VINModelName> T600 </VINModelName> <VINModelYearName> 2000 </VINModelYearName> </Truck> <Truck> <VINModelName> T600 </VINModelName> <VINModelYearName> 1999 </VINModelYearName> </Truck> </Truck-list>
What I am trying to accomplish is a summary of the truck somewhat like this (Except in HTML and prettier):
Build Year: 1999 Model: T100 Count: 1
Build Year: 1999 Model: T600 Count: 2
Build Year: 2000 Model: T100 Count: 1
Build Year: 2000 Model: T600 Count: 1
The XSL chunk I have currently is as follows (I think this is the closest I've been, but I've tried lots of things here):
<xsl:template match="Truck-list"> [HTML table build] <xsl:for-each select="Truck[not(VINModelYearName/preceding::Truck/VINModelYearName)] |Truck[not(VINModelName/preceding::Truck/VINModelName)]"> <tr> <td class="lensBody" bgcolor="#FFFFFF" nowrap="true"> <xsl:value-of select="VINModelYearName"/>  </td> <td class="lensBody" bgcolor="#FFFFFF" nowrap="true"> <xsl:value-of select="VINModelName"/>  </td> <td class="lensBody" bgcolor="#FFFFFF" nowrap="true"> <xsl:value-of select="count(VINModelName)"/>  </td> </tr> </xsl:for-each> </table> </xsl:template>
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Summarizing sibling nodes, Wayne Rambo | Thread | [xsl] Sorting using an element in a, amarjit . s . bhulla |
[xsl] Is XML/XSL the right directio, Matt Gushee | Date | Re: [xsl] Sorting using an element , Wendell Piez |
Month |