Search
Free Signup | Login
Relevant Links
Storefront Documentation

Revindex Storefront v1.1

Introduction

Revindex Storefront is one of the most flexible shopping cart software for the DotNetNuke platform. It's powerful enough for large enterprises supporting over 60,000 products and unlimited orders, yet simple to manage for small businesses - start selling in just a few steps. Revindex Storefront complies fully with industry credit card PCI rules using military grade encryption and validation to protect your customer information. We support all major payment gateways. If you don't find a suitable payment gateway, please contact us and we'll add it.

Requirements

  • DotNetNuke 5.x
  • .NET 3.5 with Full trust level
  • DBO owner and no object qualifier
  • SQL Server 2005 and above
  • SSL Certificate
  • SQL or session state service if running in a Web farm.

Installation

Make sure to perform a complete backup of your system before performing the following steps.

1. On your web site, login as "Host" and go to Host > Extensioms. Click on Install Extension Wizard.

2. Upload the Revindex.Dnn.RevindexStorefront.zip  package and follow the install wizard instruction. By default, ASP.NET restricts the file upload to a maximum size of 8MB. Increase the maxRequestLength and requestLengthDiskThreshold values of the httpRuntime node in your application web.config if the upload times out.

3. Create the following pages to host the Revindex Storefront modules. You may give a different page name. For illustration purposes, we'll refer to the same names given below throughout this guide.

Page Name Description Required Include in Menu Permission SSL Secure
Storefront Main console page to administer store, orders, users, etc. Yes Yes Administrators Yes
Checkout Payment processing page. Yes No Registered Users Yes
Cart Shopping cart page. Yes No All Users Yes
Confirmation Confirmation page after a successful checkout. Yes No Registered Users Yes
Product Detail Product detail view page. Yes No All Users No
Product List Product list view page. Yes No All Users No
Manage Address Allow users to manage address book. Optional Yes Registered Users Yes
Manage Order Allow users to view orders. Yes Yes Registered Users Yes
Manage Payment Allow users to manage payments. Yes Yes Registered Users Yes

4. Add the new module RevindexStorefront to the Storefront page. The RevindexStorefront module creates several modules at the same time on the page.

5. Move the individual modules on the Storefront page to the pages previously created. As you become familiar with the application, you can rearrange the modules to different parts of your site. To move a module, go to Settings from the Action dropdown menu on each module that you want to move. Expand the Page Settings > Advanced Settings and choose the appropriate page under the Move to Page list.

Module Name Description Move to Page Required
RevindexStorefront Main console to administer store, orders, users, etc. Storefront Yes
RevindexStorefrontCart Shopping cart. Cart Yes
RevindexStorefrontCategory Display product categories. Home page, Product List, Product Detail Yes
RevindexStorefrontCheckout Payment processing. Checkout Yes
RevindexStorefrontConfirmation Confirmation page after a successful checkout. Confirmation Yes
RevindexStorefrontManageAddress Allow users to manage address book. Manage Address Optional
RevindexStorefrontManageOrder Allow users to view orders. Manage Order Yes
RevindexStorefrontManagePayment Allow users to manage payments. Manage Payment Yes
RevindexStorefrontManageRecurringOrder Allow users to manage any recurring orders. Manage Order Optional
RevindexStorefrontProductDetail Product detail view. Product Detail Yes
RevindexStorefrontProductList Product list view. Product List Yes

6. Go to Host > Host Settings and expand Performance Settings. Click on Clear cache to complete the installation.

Configuring the Storefront

The Storefront page you created hosts the main RevindexStorefront administration module where you can perform configuration changes, manage products and orders.

License Key

If you purchased or received a license for use, you'll need to enter it into the software. Login as Host and go to the Storefront page you created. Under Configuration > License menu, enter the license key you received.

Quick Start Settings

Your shopping cart is pre-configured with default values suitable for most businesses. In most cases, you only need to configure these few settings from the Configuration > Settings menu to start selling: General.StoreName, General.Email.Sender, General.Email.Recipient and Security.EncryptionKey

You also need to configure your payment methods. Enable or disable the appropriate PaymentMethods.* settings. For credit card and Paypal payment methods, you need to provide the appropriate values under PaymentGateways.* for your respective payment gateway provider.

Complete List of Settings

These settings are available from the Configuration > Settings menu.

Configuration Description Required Valid Values Default Value
Cart.DisplayTemplate Default display template for Cart module. Yes Template name. Standard1
Category.DisplayTemplate Default display template for Category module. Yes Template name. Standard1
Checkout.DynamicFormCode Add additional form fields to the checkout page. No HTML/ASP.NET code *See Configuration > Settings
Checkout.DisplayTemplate Default display template for Checkout module. Yes Template name. Standard1
Confirmation.DisplayTemplate Default display template for Confirmation module. Yes Template name. Standard1
Gallery.Products.DetailedWidth Enlarged product image width. Yes Integer value in pixels. 320
Gallery.Products.DisplayWidth Normal product image width. Yes Integer value in pixels. 160
Gallery.Products.ThumbnailWidth Miniature product image width. Yes Integer value in pixels. 80
General.StoreName Store name used in emails, pages, etc. No    
General.Email.Recipient Default recipient name and email to receive notifications, etc. Yes "Name" <email_at_address>

"Revindex Storefront" <noreply_at_example.com>

General.Email.Sender Default sender name and email for outgoing mails. Yes "Name" <email_at_address>

"Revindex Storefront" <noreply_at_example.com>

General.SalesOrderIDPrefix Apply optional character prefix to sales order number. No Any letter or number.  
Notification.SalesOrderAlert.Email.Active Enable new sales order notifications. Yes "true" or "false" true
Notification.SalesOrderReceipt.Email.Active Send email receipt to buyer. Yes "true" or "false" true
Notification.SalesOrderReceipt.Email.Template Email receipt template. Yes XSL *See Configuration > Settings
PaymentGateways.AuthorizeNet.Login Authorize.NET login. Yes if using AuthorizeNet gateway.    
PaymentGateways.AuthorizeNet.TestMode Authorize.NET test mode. Yes if using AuthorizeNet gateway. "true" or "false" false
PaymentGateways.AuthorizeNet.TranKey Authorize.NET transaction key. Yes if using AuthorizeNet gateway.    
PaymentGateways.FirstDataGGWS.Certificate First Data PEM certificate file content. Yes if using FirstDataGGWS gateway.    
PaymentGateways.FirstDataGGWS.Password First Data password. Yes if using FirstDataGGWS gateway.    
PaymentGateways.FirstDataGGWS.TestMode First Data test mode. Yes if using FirstDataGGWS gateway. "true" or "false" false
PaymentGateways.FirstDataGGWS.User First Data username. Yes if using FirstDataGGWS gateway.    
PaymentGateways.InternetSecureMD.GatewayID InternetSecure gateway ID. Yes if using InternetSecureMD gateway.    
PaymentGateways.InternetSecureMD.TestMode InternetSecure test mode. Yes if using InternetSecureMD gateway. "true" or "false" false
PaymentGateways.MonerisESPCA.StoreID Moneris eSelectPlus Canada Store ID.  Yes if using MonerisESPCA gateway.    
PaymentGateways.MonerisESPCA.APIToken Moneris eSelectPlus Canada API token. Yes if using MonerisESPCA gateway.    
PaymentGateways.MonerisESPCA.TestMode Moneris eSelectPlus Canada test mode. Yes if using MonerisESPCA gateway. "true" or "false" false
PaymentGateways.PaypalEC.Password Paypal Express Checkout password. Yes if using PaypalEC gateway.    
PaymentGateways.PaypalEC.Signature Paypal Express Checkout signature. Yes if using PaypalEC gateway.    
PaymentGateways.PaypalEC.Username Paypal Express Checkout username. Yes if using PaypalEC gateway.    
PaymentGateways.PaypalEC.TestMode Paypal Express Checkout test mode. Yes if using PaypalEC gateway. "true" or "false" false
PaymentGateways.PaypalWPP.Username Paypal Website Payments Pro username. Yes if using PaypalWPP gateway.    
PaymentGateways.PaypalWPP.Password Paypal Website Payments Pro password. Yes if using PaypalWPP gateway.    
PaymentGateways.PaypalWPP.Signature Paypal Website Payments Pro signature. Yes if using PaypalWPP gateway.    
PaymentGateways.PaypalWPP.TestMode Paypal Website Payments Pro test mode. Yes if using PaypalWPP gateway. "true" or "false" false
PaymentGateways.PSiGateXmlMessenger.StoreID PSiGate Store ID. Yes if using PSiGateXmlMessenger gateway.    
PaymentGateways.PSiGateXmlMessenger.Passphrase PSiGate passphrase. Yes if using PSiGateXmlMessenger gateway.    
PaymentGateways.PSiGateXmlMessenger.TestMode PSiGate test mode. Yes if using PSiGateXmlMessenger gateway. "true" or "false" false
PaymentMethods.Cash.Active Allow cash payment method. Yes "true" or "false" true
PaymentMethods.Check.Active Allow check payment method. Yes "true" or "false" true
PaymentMethods.CreditCard.Active Allow credit card payment method. Yes "true" or "false" true
PaymentMethods.CreditCard.PaymentGateway Payment gateway used to perform transactions for this payment method. Optional. If empty, system will perform a manual transaction. In this case you are responsible for manually charging client via your terminal from the card information collected. AuthorizeNet
FirstDataGGWS
InternetSecureMD
MonerisESPCA
PaypalWPP
PSiGateXmlMessenger
 
PaymentMethods.MoneyOrder.Active Allow money order payment method. Yes "true" or "false" true
PaymentMethods.Paypal.Active Allow Paypal payment method. Yes "true" or "false" true
PaymentMethods.Paypal.PaymentGateway Payment gateway used to perform transactions for this payment method. Yes if Paypal is activated. PaypalEC PaypalEC
PaymentMethods.WireTransfer.Active Allow wire transfer payment method. Yes "true" or "false" true
ProductDetail.DisplayTemplate Default display template for ProductDetail module.  Yes Template name. Standard1
ProductList.DisplayTemplate Default display template for ProductList module. Yes  Template name. Standard1
Security.EncryptionKey Private key to encrypt credit card numbers, etc. Yes Any string.  
Security.AllowedProductRoleGroup Allowed security roles for product role assignment. No Pipe delimited list of portal Security Role Groups.

e.g.
Products|Suppliers
 
Security.StoreCreditCard Save credit card number. Yes "true" or "false" false

Tax Classes

Revindex Storefront supports almost every tax rule possible (e.g. charge different tax rate based on country, state, city, amount, quantity, product, etc.). You can define individual tax classes from the Configuration > Taxes menu. Click Add New... then provide a name (e.g. "Goods") and a tax formula. Once the tax class has been added, you'll be able to assign products to this tax class (e.g. Clothing products can be assigned to the "Goods" tax class, while Shipping can be assigned to the "Services" tax class and taxed at a different rate).

The tax formula uses powerful XSL transform. In the simplest case, you can copy the examples below and modify the numeric values without knowing XSL syntax. If you want to use custom logic (e.g. charge tax rate based on location and purchased price), you can employ full XSL syntax to output the tax calculation. To learn more about writing XSL formula, please read the XSL Transform section.

The system expects the following output after applying your tax formula against the sample input. Tax formula is calculated individually against each sales order detail with a product assigned to this tax class. The current sales order detail information is available in the "in/salesOrder/effectiveSalesOrderDetail" node. Up to 4 tax amounts can be returned for each formula allowing you to break down and charge different tax rates by country, state, city and municipal level if needed. The sum of the individual tax amounts is what the customer will pay in taxes.
 

Sample Input Sample Expected Output
<in>
  <salesOrder>
    <orderDate>0001-01-01 12:00:00</orderDate>
    <billingCountryCode>US</billingCountryCode>
    <billingSubdivisionCode>US-CA</billingSubdivisionCode>
    <billingPostalCode>90210</billingPostalCode>
    <shippingCountryCode>US</shippingCountryCode>
    <shippingSubdivisionCode>US-CA</shippingSubdivisionCode>
    <shippingPostalCode>90210</shippingPostalCode>
    <salesOrderDetails>
      <salesOrderDetail>
        <price>10.0000</price>
        <quantity>1</quantity>
        <discountAmount>0</discountAmount>
        <weight>10</weight>
        <depth>20</depth>
        <width>30</width>
        <height>40</height>
        <requireShipping>true</requireShipping>
        <productVariantExtension>
          <data>
            <shippingRate>1.00</shippingRate>
          </data>
        </productVariantExtension>
      </salesOrderDetail>
    </salesOrderDetails>
    <effectiveSalesOrderDetail>
      <price>10.0000</price>
      <quantity>1</quantity>
      <discountAmount>0</discountAmount>
      <weight>10</weight>
      <depth>10</depth>
      <width>20</width>
      <height>30</height>
      <requireShipping>true</requireShipping>
      <productVariantExtension>
        <data>
          <shippingRate>1.00</shippingRate>
        </data>
      </productVariantExtension>
    </effectiveSalesOrderDetail>
  </salesOrder>
</in>
<out>
  <taxAmount1>1.00</taxAmount1>
  <taxAmount2>3.00</taxAmount2>
  <taxAmount3></taxAmount3>
  <taxAmount4></taxAmount4>
</out>

Below are some examples of common tax formula. You'll find many more ready-to-use templates in the Revinex Storefront administration panel.

Example: Tax formula collecting flat rate $1.00.

<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
  <out>
    <taxAmount1>1.00</taxAmount1>
    <taxAmount2></taxAmount2>
    <taxAmount3></taxAmount3>
    <taxAmount4></taxAmount4>
  </out>
</xsl:template>
</xsl:transform>

Example: Tax formula collecting 10% on all product amount.

<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
  <out>
    <taxAmount1>
       <xsl:value-of select="((in/salesOrder/effectiveSalesOrderDetail/price * in/salesOrder/effectiveSalesOrderDetail/quantity) - in/salesOrder/effectiveSalesOrderDetail/discountAmount) * 0.10" />
   
</taxAmount1>
    <taxAmount2></taxAmount2>
    <taxAmount3></taxAmount3>
    <taxAmount4></taxAmount4>
  </out>
</xsl:template>
</xsl:transform>


Example: Tax formula collecting 5% for United States and 6% for New York.

<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
  <xsl:variable name="amount" select="((in/salesOrder/effectiveSalesOrderDetail/price * in/salesOrder/effectiveSalesOrderDetail/quantity) - in/salesOrder/effectiveSalesOrderDetail/discountAmount)" />
  <out>
    <taxAmount1><xsl:if test="in/salesOrder/billingCountryCode = 'US'"><xsl:value-of select="$amount * 0.05" /></xsl:if></taxAmount1>
    <taxAmount2><xsl:if test="in/salesOrder/billingSubdivisionCode = 'US-NY'"><xsl:value-of select="$amount * 0.06" /></xsl:if></taxAmount2>
    <taxAmount3></taxAmount3>
    <taxAmount4></taxAmount4>
  </out>
</xsl:template>
</xsl:transform>


Shipping Methods

If your product requires item to be shipped, you can configure available shipping methods and cost from the Configuration > Shipping menu. Click Add New... and give it a name (e.g. "Ground shipping") to create a new shipping method. You can assign a Tax Class if this shipping method is taxable. 

The availability formula uses XML transform to determine whether this shipping method is available for selection during checkout. The expected output should return "true" to indicate this shipping method is available for selection under the input conditions, otherwise "false" if disallowed. To learn more about writing XSL formula, please read the XSL Transform section.

Sample Input Sample Expected Output
<in>
  <salesOrder>
    <orderDate>2010-04-29 10:15:01</orderDate>
    <shippingCountryCode>US</shippingCountryCode>
    <shippingCountryName>United States</shippingCountryName>
    <shippingSubdivisionCode>US-AL</shippingSubdivisionCode>
    <shippingSubdivisionName>Alabama</shippingSubdivisionName>
  </salesOrder>
</in>
<out>
  <allowed>true</allowed>
</out>

Example: Availability formula allowing ground shipping to anywhere in the United States except Hawaii.

<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
    <out>
      <allowed>
        <xsl:choose>
          <xsl:when test="in/salesOrder/shippingCountryCode = 'US' and in/salesOrder/shippingSubdivisionCode != 'US-HI'">true</xsl:when>
          <xsl:otherwise>false</xsl:otherwise>
        </xsl:choose>
      </allowed>
    </out>
  </xsl:template>
</xsl:transform>


The rate formula also uses XML transform to calculate the shipping charges. The expected output should return the calculated shipping amount to charge. To learn more about writing XSL formula, please read the XSL Transform section.

Sample Input Sample Expected Output
<in>
  <salesOrder>
    <orderDate>0001-01-01 12:00:00</orderDate>
    <subTotalAmount>-9.5000</subTotalAmount>
    <shippingCountryCode>US</shippingCountryCode>
    <shippingSubdivisionCode>US-AL</shippingSubdivisionCode>
    <shippingPostalCode>J4Z 0C9</shippingPostalCode>
    <salesOrderDetails>
      <salesOrderDetail>
        <price>10.000</price>
        <quantity>1</quantity>
        <discountAmount>0</discountAmount>
        <weight>10</weight>
        <depth>10</depth>
        <width>20</width>
        <height>30</height>
        <requireShipping>true</requireShipping>
        <productVariantExtension>
          <data>
            <shippingRate>1.00</shippingRate>
          </data>
        </productVariantExtension>
      </salesOrderDetail>
    </salesOrderDetails>
  </salesOrder>
</in>
<out>
  <shippingAmount>10.00</shippingAmount>
</out>

Example: Rate formula charging $1.00 flat rate to New York and $1.50 elsewhere.

<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
    <out>
      <shippingAmount>
        <xsl:choose>
          <xsl:when test="in/salesOrder/shippingSubdivisionCode = 'US-NY'">1.00</xsl:when>
          <xsl:otherwise>1.50</xsl:otherwise>
        </xsl:choose>
      </shippingAmount>
    </out>
  </xsl:template>
</xsl:transform>


Example: Rate formula charging $0.10 per kilogram of weight plus $1.00 base rate.

<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
  <out>
    <shippingAmount>
        <xsl:variable name="shippingAmount">
          <xsl:sequence select="sum(in/salesOrder/salesOrderDetails/salesOrderDetail/(quantity * weight)) * 0.10" />
        </xsl:variable>
        <xsl:value-of select="$shippingAmount + 1.00" />
    </shippingAmount>
  </out>
</xsl:template>
</xsl:transform>


Display Templates

The look-and-feel of public facing modules can be customized per portal from the Configuration > Templates menu. For example, you can customize the look-and-feel of the Product Detail module allowing you to change the layout, color, font, css style and even add text and images. You can also hide dynamic items by adding the "Visible="false"" attribute to the <asp:Control> tags (e.g. Adding Visible="false" to the label tag <asp:Label ID="SavingsValueLabel" runat="server" CssClass="NormalRed" Visible="false"> will hide the savings label from displaying to the user.)

Start by selecting "Create New Template" in the radio button. Then choose the module you wish to customize. You now need to choose a base Display Template as a starting point (e.g. "Standard1") and give your new custom template a meaningful name. Make the HTML changes needed to your new template and click Save Template. Your new custom template is now ready to be used. For example, if you created a new custom template for the Product Detail module, you can configure your individual product to use this new custom template instead of the default template.

Because you have full HTML control over your custom templates, please note that custom templates may become broken if you accidentally delete dynamic controls or as result of incompatibility with new software version upgrades. If such a case happens, you simply need to recreate your custom template. The base templates, on the other hand, can never be edited and are safe from user changes.

Categories

Categories allow you to group the products for sale making it easier for your users to browse your shopping cart. Revindex Storefront support unlimited number of multi-level categories. Individual product can be assigned to one or multiple categories. You can add new categories from the Catalog > Categories menu. Click Add New... to create a new category and give it a name. Select if this new category has a parent category to create a multi-level category tree. Click Save Category when done.

Distributors

If you source your products from distributors, you can keep track of them by creating a distributor entry in the system from the Catalog > Distributors menu. Click Add New... and give it a name. Click Save Distributor when done. You can now assign this new distributor to your indiviual products.

Manufacturers

You can keep track of manufacturers of your product by creating a manufacturer entry in the system from the Catalog > Manufacturers menu. Click Add New... and give it a name. Click Save Manufacturer when done. You can now assign this new manufacturer to your indiviual products.

Product Management

Add new products from the Catalog > Products menu. Click Add New... and fill the required information. Variants are variations of products. For example, if you sell the DVD movie product "Titanic", you may also it in video casette format.  In most cases, you will only have one variant per product


Orders


Recurring Orders


- Orders
- Recurring Orders
- Public Categories
- Public Product List
- Public Product Detail
- Public Cart
- Public Checkout
- Public COnfirmation
- Public Manage Address
- Public Manage Payment
- Public Manage Orders
- Public Manage Product Download
- Default control in multiple control scenario


Uninstallation

Make sure to perform a complete backup of your system before performing the following steps.

1. Go to Host > Extensions and uninstall "RevindexStorefront". It's recommended to keep files on the system by leaving the "Delete Files" checkbox unchecked.

2. Go to Host > Schedule and remove "RevindexStorefront.SalesOrderScheduler" item.

3. It's not necessary to delete module files. Leaving module files on the system will not consume memory or CPU when unused. Deleting library files may affect other modules that rely on any shared assemblies. The following files may be deleted if absolutely necessary: 

bin\Revindex.*.dll
DesktopModules\Revindex.Dnn.RevindexStorefront\*




Shopping Cart Flow

The typical checkout flow consists of the following steps. The flow determines how and when various price, discount, shipping and tax calculations are performed base on the available data collected from the user (e.g. Shipping cost can only be calculated after user supplies his shipping address during checkout. Similarly, taxes can only be calculated after user supplies his billing address).

System generates category items.
Customer selects category.
System generates list of available products.
Customer views product list and select product of interest.
System generates product detail, calculates price, apply any promotion and verifies product availability.
Customer views product detail and adds product to cart.
System verifies order and approximates sub-total before shipping cost and taxes.
Customer proceeds to checkout.
System prompts user to login or register, if user is not already logged in.
System determines the available shipping methods.
Customer provides billing info, shipping info and coupons.
System verifies order, apply discounts, shipping cost and taxes before calculating final total.
Customer reviews order and completes payment.
System generates confirmation details and sends out notification.
Customer views the confirmation page and receives receipt

XSL Transform

Every business has its own set of unique business rules, which gives its competitive edge and allow it to comply with regulations. For example, you may have a business rule that gives a $10 discount to repeat customers who purchased over $50 worth of products or your ground shipping method in the United States should never ship to Hawaii.

Revindex Storefront employs powerful XSL transform to apply dynamic business rules and calculate the resulting values. XSL (Extensible Stylesheet Language) is the industry standard XML transform language and can be found in different DotNetNuke modules such as the News Feed module and throughout the Internet. Although not necessary to operate the Revindex Storefront, understanding the basics of XSL will open endless possibility to describe your most complicated business rules needed to run your business. To understand XSL, you must first understand XML (Extensible Markup Language). Think of XSL as the business rule that consumes and outputs the XML data.

1. XML Input Data
>>>
2. XSL Business Rule
>>>
3. XML Output Data

You're probably familiar with XML if you heard of HTML, the language used to describe Web pages that you see on your Web browser. XML, like HTML, is made up of elements contained in open and close right-angle brackets (e.g. <element attribute="Some value">Some value</element>). Computer is able to interpret the tags into useful value. XML language has a few simple rules:

1. XML is case-sensitive.
2. All elements must be properly closed. (e.g. <myTag>1.00</myTag> or use the short form <myTag /> if no value is enclosed)
3. All elements must be properly nested. (e.g. <a><b>1.00</b></a> is correct. <a><b>1.00</a></b> is wrong.)
4. Comments use the special open and close tags and is ignored by the computer (e.g. <!-- this is some comment -->)
5. Reserved characters must be encoded when used as value (e.g <myTag>John &amp; Jane</myTag>)

Reserved Characters Encoded Characters
< &lt;
> &gt;
& &amp;
' &apos;
" &quot;

The structure of XSL looks like XML. It uses open and close right-angle brackets and follows the same syntax as XML. In addition, it has built-in special purpose elements and functions that can manipulate XML data. The following example shows a sample XML input with a $75 sales order. The XSL business rule has an IF condition that prints the $10 discount if the amount is greater than $50.

XML Input XSL Business Rule Transform XML Output
<in>
  <salesOrder>
    <totalAmount>75.00</totalAmount>
  </salesOrder>
</in>

<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

<xsl:template match="/">
  <out>
    <discountAmount><xsl:if test="in/salesOrder/totalAmount &gt; 50">-10.00</xsl:if></discountAmount>
  </out>
</xsl:template>
</xsl:transform>

<out>
  <discountAmount>-10.00</discountAmount>
</out>

To write XSL, start with how you expect the XML output to be. In the previous example, you would write the <out> and <discountAmount> open and close tags as you see them. Add to the header and footer the standard <xsl:transform> and <xsl:template> open and close tags respectively. These tags tell the computer that you're writing XSL and match up with start of the XML input data. Finally, add the <xsl:if> condition and check for the $50 amount. Here, the "in/salesOrder/totalAmount" is used to navigate and select the XML input data.

The common XSL special purpose elements for transforming XML data are listed below.

XSL Elements Description
<xsl:variable name="variable_name" select="expression" /> Used to hold the value of an expression in a variable that can be referenced later using $variable_name.
<xsl:value-of select="expression" /> Used to select and print a value from XML input.
<xsl:if test="expression">value</xsl:if> Only print the value if condition succeeds.
<xsl:choose>
  <xsl:when test="expression">value</xsl:when>
  <xsl:otherwise>value</xsl:otherwise>
</xsl:choose>
Print first value if condition succeeds otherwise print next value.
<xsl:for-each select="expression">value</xsl:for-each> Loop each occurence of the expression and print the value.

The XSL expressions can contain these operators.

XSL Operators Description Example Result
+ Addition. 1 + 2 3
- Subtraction. 3 - 1 2
* Multiplication. 2 * 6 12
div Division. 6 div 2 3
= Test for equality. amount = 1.00 True if amount is 1.00
False if amount is 1.10
!= Test for not equal. amount != 1.10 True if amount is 1.00
False if amount is 1.10
< Less than. amount < 1.10 True if amount is 1.00
False if amount is 1.10
<= Less than or equal. amount <= 1.00 True if amount is 1.00
False if amount is 1.10
> Greater than. amount > 1.00 True if amount is 1.10
False if amount is 1.00
>= Greater than or equal. amount >= 1.00 True if amount is 1.00
False if amount is 0.90
or Conditional or. amount = 1.00 or amount = 1.10 True if amount is 1.00
False if amount is 1.20
and Conditional and. amount > 1.00 and amount < 1.10 True if amount is 1.05
False if amount is 0.90

XSL also provides hundreds of functions you can use to manipulate the data, such as rounding a decimal number, etc. The common functions are listed below. To see a full list of functions, please see http://www.w3schools.com/xpath/xpath_functions.asp

XSL Functions Description
ceiling(num) Returns the smallest integer number that is greater than the number argument.
floor(num) Returns the largest integer number that is smaller than the number argument.
round(num) Round the number argument to the nearest integer number.
concat(string, string, ..., sep) Returns a string by concatenating with the separator argument.
substring(string, start, length) Returns the sub-string from the start position to the specified length. Index of the first character is 1. If length is omitted it returns the substring from the start position to the end.
string-length(string) Returns the length of the string argument.
upper-case(string) Returns the string in all upper case.
lower-case(string) Returns the string in all lower case.
contains(string1, string1) Returns true if string1 contains string2, otherwise false.
starts-with(string1, string2) Returns true if string1 starts with string2, otherwise false.
ends-with(string1, string2) Returns true if string1 ends with string2, otherwise false.
matches(string, pattern) Returns true if the string argument matches the pattern, otherwise false.
replace(string, pattern, replace) Returns a string that is created by replacing the given pattern with the replace argument.
not(arg) Returns true if the boolean value is false, and false if the boolean value is true.
count((item, item, ...)) Returns the count of nodes.
avg((arg, arg,...)) Returns the average of the argument values.
max((arg, arg,...)) Returns the argument that is greater than the others.
min((arg, arg, ...)) Returns the argument that is less than the others.
sum(arg, arg, ...) Returns the sum of the numeric value of each node in the specified node-set.

To learn more about XML, please see http://www.w3schools.com/xml/default.asp and to learn more about XSL, please see http://www.w3schools.com/xsl/. You'll also find more help and example of XSL in the Revindex Forum and Support pages.




Country, state symbols??