[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:choose and xsl:when
>> It's always useful to see some sample input.... so >> guessing that your >> XML looks like this: >> > My bad.... Here is my XML data: If you can still change the source, I have some suggestions for you: 1. remove the DOCTYPE, it does nothing this way 2. add an encoding attribute (otherwise it is assumed UTF-8, is that what it really is? 3. use small caps for readability (but that's of course a personal opinion, but to me, PhoneBook, or phone-book is more readable than PHONEBOOK). 4. remove LISTING, it does not seem to add any semantics 5. remove the surrounding whitespace 6. last but not least, most importantly, change your blocks so that each listed person has its own block. Together this would yield: <?xml version="1.0" encoding="utf-8" ?> <phone-book> <person> <first>Derek</first> <last>Smith</last> </person> <person> <first>Joseph</first> .... etc </phone-book> If changing the source is not an option, you would probably benefit a lot if you process it in two passes, either using a micro pipe (XSLT 2.0, XSLT 1.0 with nodeset) or using two processes (XSLT 1.0), where your first pass would optimize the badly formatted XML data. Your second phase will then be much easier to maintain and you can focus on the layout of your HTML instead of on the structure of your XML. Cheers, -- Abel Braaksma > > <?xml version="1.0"?> > <!DOCTYPE PHONEBOOK> > <PHONEBOOK> > <LISTING> > <FIRST> Derek </FIRST> > <LAST> Smith </LAST> > <PHONE TYPE="CELL"> 614-757-2123 </PHONE> > > <FIRST> Joseph </FIRST> ....
|
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
|