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

Re: determine the number of payment methods and specif

Subject: Re: determine the number of payment methods and specify order depending on page type being viewed
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 03 Nov 2008 17:03:27 -0500
Re:  determine the number of payment methods and specif

Please forgive us if we can't address your problems instantly.

What you are trying to do isn't beyond the reach of an expert in the language, but you are looking at several problems at once, which need to be disentangled.

I'm afraid I can't do that at this moment, but I can make a suggestion that would help myself (if I should have more free time another day) or another reader to interpret what you are trying to do and help you work it out. Would it be possible for you to rewrite your code using literal result element syntax instead of explicit xsl:element and xsl:attribute instructions for everything?

An example of what I mean -- would you be able to rewrite

<xsl:when test="$label = 'directDebit'">
  <xsl:element name="li">
    <xsl:attribute name="class">doubleLine current</xsl:attribute>
    Payment by <br/><xsl:value-of select="$ddPayment" />
  <xsl:element name="li">
    <xsl:attribute name="class">doubleLine</xsl:attribute>
    Payment by <br/><xsl:value-of select="$ccPayment" />
  <xsl:element name="li">
    <xsl:attribute name="class">doubleLine</xsl:attribute>
    Payment by <br/><xsl:value-of select="$iPayment" />

as this:

<xsl:when test="$label = 'directDebit'">
  <li class="doubleLine current">Payment by <br/>Direct Debit</li>
  <li class="doubleLine">Payment by <br/>Credit Card</li>
  <li class="doubleLine">Payment by <br/>Invoice</li>

... and similarly throughout the rest of your code sample?

(You will notice I have also dropped your variables $ddPayment, $ccPayment, and $iPayment, which make the code more obscure without adding anything at present. These can always be restored later, if wanted.)

As you can see, the LRE syntax is more more concise and legible. This would make it possible to recognize the patterns in your logic.

This is doubly important for you since recognizing, abstracting and simplifying the patterns in your logic is the essence of the problem here. What you will find is that like any programming language, XSLT makes it possible to factor out repetition and distill that logic to its simplest most comprehensible form.

But only if you can see those patterns first -- and we can't.


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread


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.
First Name
Last Name
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.