[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl:choose and xsl:when

Subject: Re: xsl:choose and xsl:when
From: "Abel Braaksma (online)" <abel.online@xxxxxxxxx>
Date: Wed, 29 Aug 2007 17:45:41 +0200 (CEST)
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>
....

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.