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

Re: Group by Element based on Attribute inside contain

Subject: Re: Group by Element based on Attribute inside container using 1.0
From: "Friend, Darris E" <FRIENDDE@xxxxxxx>
Date: Wed, 12 Nov 2008 10:02:32 -0500
Re:  Group by Element based on Attribute inside contain
Outstanding! I did a little research on the Sort. Your method did sort
by year, but not exactly the way I wanted. Partly because I did not
mention the most recent year first.

Your statement returned:
Valve Number: 992
01/10/1984 Wingenbach No UNK UNK
03/22/1989 Wingenbach No UNK UNK
02/06/1991 Wingenbach No UNK UNK
02/07/1992 Wingenbach No UNK UNK
02/16/1995 Fanelli No UNK UNK
02/18/1998 Wingenbach and Fanelli No UNK UNK
02/26/1993 Wingenbach No UNK UNK
02/28/1990 Wingenbach No UNK UNK
03/03/1997 Wingenbach No UNK UNK
03/18/1996 Wingenbach No UNK UNK
03/28/1994 Gordon No UNK UNK

Looks like the month/day confused the Sort output. Notice the placement
of 02/26/1993, 02/28/1990...

I altered your statement removing the concat and two substrings (also
note the third argument for substring is dropped) and produced the
following:

<xsl:sort select="substring( ObjectClassField[ @name = 'Date
Inspected'], 6)" order="descending"/>

Valve Number: 992
03/01/2007 Ukweli No Open Open Exercised, Painted
03/07/2006 Ukweli No Open Open Exercised
03/13/2002 Ukweli No UNK UNK
02/23/2001 Williams No UNK UNK
01/31/2000 Wingenbach No UNK UNK
04/13/1999 Wingenbach No UNK UNK
02/18/1998 Wingenbach and Fanelli No UNK UNK
03/03/1997 Wingenbach No UNK UNK
03/18/1996 Wingenbach No UNK UNK
02/16/1995 Fanelli No UNK UNK

And finally to output a value based on another value, I noticed if I
have a text value in the XML I need to add single quotes but if it is a
numeric value your statement works fine:

<xsl:variable name="rm" select="ObjectClassField[ @name = 'Repairs
Made']"/>
	<xsl:choose>
		<xsl:when test="$rm = 'Y'">Yes</xsl:when>
		<xsl:when test ="$rm = 'N'">No</xsl:when>
		<xsl:otherwise>UNK</xsl:otherwise>
	</xsl:choose>
   <xsl:text> </xsl:text>
   <xsl:variable name="vpf" select="ObjectClassField[ @name = 'Valve
Position Found']"/>
	<xsl:choose>
		<xsl:when test="$vpf = 0">Closed</xsl:when>
		<xsl:when test ="$vpf = 1">Open</xsl:when>
		<xsl:otherwise>UNK</xsl:otherwise>
	</xsl:choose>

For anyone else who has been following this thread feel free to email me
for the entire XSL and XML files if you need the final result.

Now I am working on this as being HTML tables with colors...
ValveNumber: 992
DateInspected	InspectedBy	RepairsMade	PositionFound
DATE1			Inspector1	Yes/No	Open/Closed


Thank you for your help and patience.
darris

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.