Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mr A 216 posts 278 karma points
    Jun 06, 2012 @ 12:21
    Mr A
    0

    Basic Query about parameters / variables

    Hi ,

    I have never used xslt before , just learning a bit for a project ucommerce which is written in xslt, i am having problems with sending email using xslt macro. Below is the code:

    variables defined:

     <xsl:variable name="orderGuid" select="umbraco.library:RequestQueryString('orderNumber')"/> 

      <xsl:variable name="cart" select="CommerceLibrary:GetPurchaseOrder($orderGuid)"/>

    <table>

          <tr>

            <td><xsl:value-of select="$orderGuid"/></td>

       <td><xsl:value-of select= "$cart/OrderTotal" /></td>

    </tr> </table>

    When the email is send , it shows the orderGuid , but i cant see the order total , though the total is there in the database, just need to know am i writing the correct statement to get thge ordertotal , i also tried $cart/@OrderTotal with no success , any suggestions or assistance will be highly appreciated , thanks

  • Rik Helsen 670 posts 873 karma points
    Jun 06, 2012 @ 13:13
    Rik Helsen
    1

    possibly you can use

    <xsl:copy-ofselect="$cart"/>

    to output what data you have available?

  • Mr A 216 posts 278 karma points
    Jun 06, 2012 @ 13:16
    Mr A
    0

    but whats the correct format of getting the parameters , like the cart have 6-7 values , for instance if i want order total , should i write something like <xsl:copy-of select="$cart/@OrderTotal"/>

  • Mr A 216 posts 278 karma points
    Jun 06, 2012 @ 15:45
    Mr A
    0

    anyone ??

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Jun 06, 2012 @ 19:55
    Chriztian Steinmeier
    0

    Hi Mr. A,

    You're on the right track - what Rik suggested was that you did a copy-of the $cart variable so you can see the XML returned in it - e.g., you''d get something like this:

    <cart>
       <OrderTotal id="GUID">4815162342</OrderTotal>
       <PriceUnit>DKK</PriceUnit>
       ...
    </cart>
    

    So $cart points to the <cart> element, and to get the values out, you use simple "paths" - the simplest blocks of the XPath language:

    <xsl:value-of select="$cart/OrderTotal" />
    
    <xsl:value-of select="$cart/OrderTotal/@id" />
    
    <xsl:value-of select="$cart/PriceUnit" />

    So to get the value of an element, use its name - to get the value of an attribute, use its name prefixed with an at-sign (@).

    (So copy-of gives you the actual elements - value-of gives you the string values)

    /Chriztian 

Please Sign in or register to post replies

Write your reply to:

Draft