Subject: Re: [xsl] selecting multiple elements From: Christopher Hansen <chansen1@xxxxxxxxx> Date: Mon, 6 Dec 2004 13:47:11 -0500 |
David, In my source, you will notice I have 2 xml files. Transactions.xml (as noted previously) and itemsets.xml which looks something like what is shown directly below. Essentially, im trying to match the items from each XML document together, and send out coupons for these items in one email. However, I cant get more than one item into each email. It sends one email per item right now. Confused on how to accomplish this. <frequent_item_sets> <set id="1" coupon="50 cents"> <item>Milk</item> <item>Butter</item> <item>Eggs</item> </set> <set id="2" coupon="75 cents"> <item>Hot Pockets</item> <item>Mini Pizza Bagels</item> <item>SuperPretzel</item> <item>Popcorn Shrimps</item> </set> .... --------------------------------- <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:myJava="http://xml.apache.org/xslt/java" exclude-result-prefixes="myJava" version="1.0"> <xsl:param name="itemsets" select="document('itemsets.xml')"/> <xsl:param name="transactions" select="document('transactions.xml')"/> <xsl:output method="html"/> <xsl:template match="/"> <xsl:for-each select="$transactions//transaction/items/item" > <xsl:variable name="thePerson" select="../../customer/name"/> <xsl:variable name="email" select="../../customer/email"/> <xsl:variable name="theItem" select="." /> <xsl:if test="$theItem= $itemsets//item"> <xsl:for-each select="$itemsets/frequent_item_sets//set" > <xsl:if test ="$theItem=item"> <xsl:variable name="msg" select='concat($theItem,$thePerson)'/> <xsl:value-of select="myJava:myMail.send($email,'test@xxxxxx','Coupon!!!', $msg)" /> </p> </xsl:if> </xsl:for-each> </xsl:if> </xsl:for-each> On Mon, 6 Dec 2004 18:10:27 GMT, David Carlisle <davidc@xxxxxxxxx> wrote: > > <xsl:for-each select="$transactions/transactions//transaction/items" > ^^ > it's very inefficient to have // here but without > seeing your source can't suggest anything else. > perhaps just / ? > > <xsl:variable name="thePerson" select="../customer/name"/> > <xsl:variable name="email" select="../customer/email"/> > <xsl:variable name="msg" select="item"/> > > David > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] selecting multiple elemen, David Carlisle | Thread | Re: [xsl] selecting multiple elemen, David Carlisle |
Re: [xsl] grouping and sum, dmitrik | Date | RE: [xsl] FW: Newbie question, David at roamware |
Month |