Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating Multiple Outputs with XSL/XML?

    Forgive me if I worded the title incorrectly, I am still learning the basics of xml/xsl and had a few questions about a project I am working on.

    I have created a xml template I am using with some shipping software to produce a invoice and label. On the invoice I need barcodes for our items, I have figured out how to display the barcodes, but when I have an order with multiple items, it just duplicates the first output barcode.

    Here is the code I am using, again forgive me if it's horribly formatted.

    Code:
    <xsl:for-each select="$order/Item/SKU"> 
                <table border="0" align="center">
                 <tr>  
                <td><center><font style="font-family:Free 3 of 9 Extended; font-size:24pt;  font-weight:normal;">*<xsl:value-of select="$order/Item/SKU" />*</font></center></td>
                <td><center><font style="font-family:; font-size:12pt; font-weight:normal;"><xsl:value-of select="$order/Item/Code" /></font></center></td>
                </tr></table></xsl:for-each>
    As you can see right now it outputs a barcode and then a text version of our SKU. The software I am using pulls from the $order fields, how would I go about pulling multiple items and outputting them and not duplicating them?

    Thank you in advance for any help!!

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,237
    Thanks
    12
    Thanked 340 Times in 336 Posts
    if $order is supposed to be a (PHP) variable, that won’t work.

    inside the for-each loop you can access the currently processed element by . (i.e. for-each opens a new scope)
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •