[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSL help
Hi Guys, Fairly new to this forum, so please excuse me for repetition. Here is the scenario for my problem. I have three types of payment pages for a checkout process. There is a progress bar at the top of the page which indicates what stage the user is at in checkout. I have an HTML out put which I want as follows: <ul id="progressNav"> <li class="completed">Your Details</li> <li class="current">Billing Address</li> <li>Delivery Address</li> <li>Check Details</li> <li class="doubleLine">Payment by<br /> Direct Debit</li> <li class="doubleLine">Payment by<br /> Credit Card</li> <li class="doubleLine">Payment by<br /> Invoice</li> <li>Confirmation</li> </ul> The XML file comes through as : <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="InvoiceForm.xslt"?> <order> <!-- for navigation --> <paymentMethods> <!-- shopping cart had credit card and invoice payments; credit card payment is already completed --> <creditCard /> <invoice /> </paymentMethods> ... </order> The XSL extract for this area is: <?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:variable name="ddPayment">Direct Debit</xsl:variable> <xsl:variable name="ccPayment">Credit Card</xsl:variable> <xsl:variable name="iPayment">Invoice</xsl:variable> <xsl:choose> <xsl:when test="$noOfNodes = '3'"><!-- check for 3 elements --> <xsl:choose> <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> <xsl:element name="li"> <xsl:attribute name="class">doubleLine</xsl:attribute> Payment by <br/><xsl:value-of select="$ccPayment" /> </xsl:element> <xsl:element name="li"> <xsl:attribute name="class">doubleLine</xsl:attribute> Payment by <br/><xsl:value-of select="$iPayment" /> </xsl:element> </xsl:when> <xsl:when test="$label = 'creditCard'"> <xsl:element name="li"> <xsl:attribute name="class">doubleLine</xsl:attribute> Payment by <br/><xsl:value-of select="$ddPayment" /> </xsl:element> <xsl:element name="li"> <xsl:attribute name="class">doubleLine current</xsl:attribute> Payment by <br/><xsl:value-of select="$ccPayment" /> </xsl:element> <xsl:element name="li"> <xsl:attribute name="class">doubleLine</xsl:attribute> Payment by <br/><xsl:value-of select="$iPayment" /> </xsl:element> </xsl:when> <xsl:when test="$label = 'invoice'"> <xsl:element name="li"> <xsl:attribute name="class">doubleLine</xsl:attribute> Payment by <br/><xsl:value-of select="$ddPayment" /> </xsl:element> <xsl:element name="li"> <xsl:attribute name="class">doubleLine</xsl:attribute> Payment by <br/><xsl:value-of select="$ccPayment" /> </xsl:element> <xsl:element name="li"> <xsl:attribute name="class">doubleLine current</xsl:attribute> Payment by <br/><xsl:value-of select="$iPayment" /> </xsl:element> </xsl:when> </xsl:choose> </xsl:when> </xsl:choose> </xsl:template> ... </xsl:stylesheet> The parameter $label is set in the base xslt file which has all the html output, and is specific to the page type (there are 3 page types, credit card, direct debit and invoice payments). So, each page would have label set as creditCard - for CC payment directDebit - for DD payment invoice - for invoice payment. Within the XML, the paymentMethods area can have one, two or three nodes available (no more or less). The problem that I have (besides not knowing that much), is that if all three payment methods are applicable, then they need to be in the order: DD payment CC payment I payment DD payment should always be first, and I payment last. If the label is set to creditCard (for example), then that indicates the page is a Credit Card page. If this is the case, then the class applied to the relevant list item will be class="doubleLine current". If there are 3 payment methods for the xml, then DD payment should have a class set as class="doubleLine completed" and Invoice should be class="doubleLine". So not only do I need to determine the number of payment methods present, but I need to specify a type of order to them, and apply the relevant class, depending on the page type being viewed. Any help would be greatly appreciated. Apologies again if this is somewhat convoluted!
|
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
|