[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: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Fri, 07 Nov 2008 16:43:27 +0100
Re:  Group by Element based on Attribute inside contain
Friend, Darris E schrieb:
Now for the syntax, please describe why you did this and what it does.
If you can break down the statement 'substring' and what 6,4 1,2 4,2
does that would be very helpful.

Well, you want to sort by date, but your dates don't sort naturally when compared as strings, because they don't read like year-month-day from left to right, which they have to do in order to be sortable as strings.

The substring() function is just the usual substring function which
takes a part out of a string. The only thing this in XSLT in which this
is unusual is that this function is 1-based, as opposed to 0-based, as
in all languages I'd learnt before. So in "substring('abcde', 2, 3)",
the second argument says where to start extracting the substring and the
third one says how many characters to extract, and this returns "bcd".

And for this comment, '<!-- Extend this to display more information.
-->', do you mean I can add the following statement in order to show
more Inspection details on the output?

 Add?
  <xsl:value-of select="ObjectClassField[ @name = 'Inspected By']"/>
  <xsl:value-of select="ObjectClassField[ @name = 'Repairs Made']"/>

Looks like that should work. Give it a try.


<xsl:template match="ObjectClassRow">
  <!-- Extend this to display more information. -->
  <xsl:value-of select="ObjectClassField[ @name = 'Date Inspected']"/>
  <xsl:text>&#10;</xsl:text>
 </xsl:template>

By the way, the &#10; is a newline. If you want more lines, add more of that. But i guess you want HTML, given that your clients are IE6. In that case, you should change the output method to "html" and add HTML elements instead of the plain text newlines.

And my final question, how can I turn a value in the XML into another
value shown in the XSL output. For "Repairs Made" we store it is an
integer, but I want to show it as Yes or No based on 0 or 1.

<xsl:choose> <xsl:when test="$repairs-mode = 0">No</xsl:when> <xsl:otherwise>Yes</xsl:otherwise> <xsl:choose>

Michael Ludwig

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.