Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 26th, 2006, 06:05 PM
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display only names starting with particular letter

I'm using PHP, so I don't think I can use XSLT 2.0 (please, someone correct me if I'm wrong!). What I'm trying to do is this: display each <person> ( along with their associated <year> or any other related information) with a <surname> that starts with the letter A, B, or C. I know how to sort all <person> elements by surname, but is there a way, using XSLT 1.0, to display only those beginning with a certain letter? And if there is more than one person with the same surname, I'd like to be able to sort by forename as well.

Here's a (simplified) sample of my XML:

<faculty>
  <person id="1">
    <surname>Jones</surname>
    <forename>Bill</forename>
    <year>1985</year>
  </person>
  <person id="2">
    <surname>Adams</surname>
    <forename>Lucy</forename>
    <year>2004</year>
  </person>
  <person id="3">
    <surname>Adams</surname>
    <forename>Joe</forename>
    <year>1997</year>
  </person>
  <person id="4">
    <surname>Smith</surname>
    <forename>Edward</forename>
    <year>1970</year>
  </person>
  <person id="5">
    <surname>Collins</surname>
    <forename>Steve</forename>
    <year>2001</year>
  </person>
</faculty>


 
Old June 27th, 2006, 11:23 AM
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I figured it out. I wasn't aware of the "starts-with()" function.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Invert letter case martoufmarty Javascript How-To 4 June 8th, 2008 08:45 PM
search first letter keyvanjan Classic ASP Basics 2 May 17th, 2006 01:47 AM
display names of the files as links europhreak Classic ASP Basics 1 February 20th, 2006 07:09 PM
msg display before starting job msrnivas .NET Web Services 7 March 14th, 2004 09:26 PM
Display names of open workbooks in a MsgBox rmcc Excel VBA 1 November 11th, 2003 05:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.