Subject: Re: [xsl] 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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Group by Element based on, Michael Ludwig | Thread | Re: [xsl] Group by Element based on, Michael Ludwig |
Re: [xsl] stylesheets without match, David Carlisle | Date | RE: [xsl] Matching using variable o, Michael Kay |
Month |