Re: Answers to review questions in "Beginning XSLT": C
Hi Lars, > 2. What format can the values of ID attributes take? > > Answer: > They have to be XML Names, which means they must start with a > letter, underscore, or colon, and contain only "alphanumeric" > characters (which include '.' | '-' | '_' | ':' plus other similar > punctuation in Unicode). In particular, no spaces are allowed. There are a couple of things here. You say "plus other similar punctuation in Unicode". Actually, XML names can only include the punctuation characters you list: '.', '-', '_' and ':'. The ':' character should not be used in IDs nowadays because the Namespaces in XML Rec. stated that you should use NCNames instead of full XML Names. NCNames (non-colonised names) can't contain a colon. > 4. What three types of arguments can the id() function take and what > does it return from each? > > Answer: > id() can take a string containing a single ID, in which case it returns > the element that has that ID. > id() can take a string containing multiple IDs separated by space, in > which case it returns a node set consisting of the elements that have > those IDs. > id() can take a node set, in which case id() returns a node set > consisting of the elements whose IDs are the values of nodes in the > argument node set. Yes, and if the nodes have values that are space-separated IDs, then those get used. > 7. Construct a stylesheet that groups <Film> elements by their <Year> > children and by their rating attributes. > > Answer: That looks good (I assume it worked!). Another challenge is a stylesheet that will group first by Year and then (within that) by rating. [I think that's what I meant by the question, but I admit that it's not worded clearly.] Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format