xsl-list
[Top] [All Lists]

Re: [xsl] determine the number of payment methods and specify order depending on page type being viewed

2008-11-03 19:07:01
Hi,

Sorry...first time in posting here...ok, so here's an amended version of the XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:html="http://www.w3.org/1999/xhtml";>
...
<xsl:template name="checkOutProgressStep">
  <xsl:param name="label"/>
  <xsl:variable name="noOfNodes" select="count(/order/paymentMethods/*)" />

  <xsl:choose>
      <xsl:when test="$noOfNodes = '3'"><!-- check for 3 elements -->
          <xsl:choose>
              <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>
              </xsl:when>

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

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

  </xsl:choose>
</xsl:template>
...
</xsl:stylesheet>

You'll notice that for the current payment method (specified in the xsl:when test="..."), the class "current" is added. If a payment method exists before the current one, then this will have a class "completed", whereas any subsequent to the current matching payment will have no extra class.

The method above is only for checking if all three payment types are present. I haven't even approached checking for 2 payment types or 1, as I don't even know where to begin.

Apologies if this confusing, as I've been staring at it all day, and appreciate any tips on bug fixing.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--