[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Match values? (sorry so big)

Subject: Re: Match values? (sorry so big)
From: RShonk@xxxxxxxxxxxxx
Date: Mon, 23 Sep 2002 14:11:16 -0400
power mine winnipeg



> I can't see your real intention, but mybe my suggestions can help. While
> I think the approach should be changed, I can't really improve it, only
> more or less fix your code.

> Hmm, hope this helps a bit.

> Regards,

> Joerg

I thought my original explanation was a little confusing (ok very
confusing).
I got things working as I wanted after changing the xml file tags and
adding attributes.
Here is what I ended up with, what other approach would you have taken?

Also is it more efficient to declare billto as a string and pass as a
parameter and declare
the document in the apply-templates select, like below. Or to declare
billto as a document
initially and pass the node set as the parameter.

Thanks,
Rich

========================= mergeXML.xsl ===============================
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>

<xsl:template match="/invoice-xml-files">
    <xsl:variable name="invhead" select="document(@invoice-header)"/>
    <xsl:variable name="billto" select="@bill-to"/>
    <html>
        <head>
            <title>
                This is driving me out of my mind!!!!
            </title>
        </head>
        <body>
            <xsl:apply-templates select="$invhead/INVOICES/INVOICE">
              <xsl:with-param name="btname" select="$billto"/>
            </xsl:apply-templates>
         </body>
    </html>
</xsl:template>

<xsl:template match="INVOICES/INVOICE">
    <xsl:param name="btname"/>
    <hr/>
    <xsl:variable name="acct" select="@account"/>
    <xsl:variable name="shipid" select="@id"/>
    <h3>INVOICE HEADER RECORD</h3>
    <xsl:apply-templates
         select="document($btname)/TRANSACTION_PARTIES/TRANSACTION_PARTY
[@account=$acct and type='BILL_TO']"/>
    <xsl:apply-templates/>
</xsl:template>

<!-- Invoice header templates go here -->

<xsl:template match="TRANSACTION_PARTY">
    <xsl:text>Bill To:</xsl:text><br/>
    <xsl:value-of select="NAME"/><br/>
    <xsl:value-of select="ADDRESS1"/><br/>
    <xsl:value-of select="ADDRESS2"/><br/>
    <xsl:value-of select="CITY"/>
    <xsl:text>, </xsl:text>
    <xsl:value-of select="STATE"/>
    <xsl:text>  </xsl:text>
    <xsl:value-of select="ZIPCODE"/><br/>
</xsl:template>

</xsl:stylesheet>

========================== mergeXML.xsl
===========================================

========================= INVHEAD.XML =============================
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<INVOICES>
   <INVOICE id="1067" account="738600">
      <INVOICE_NBR>52160672</INVOICE_NBR>
      <INVOICE_DATE>1/10/2000 0:0:0</INVOICE_DATE>
      <ORDER_NBR>473-70363</ORDER_NBR>
      <SHOP_REPORT_NBR>MOS    216</SHOP_REPORT_NBR>
      <NAME>POWER &amp; MINE SUPPLY CO. LTD.</NAME>
      <ADDRESS1>961 SHERWIN ROAD, UNIT B-01</ADDRESS1>
      <CITY>WINNIPEG</CITY>
      <STATE>MB</STATE>
      <ZIPCODE>R3H 0T8</ZIPCODE>
      <COUNTRY>CA</COUNTRY>
      <CUSTOMER_ORDER_NBR>PO60722</CUSTOMER_ORDER_NBR>
      <DESTCODE>801</DESTCODE>
      <TERMS>89</TERMS>
      <MULTIPLIER>0</MULTIPLIER>
      <DATE_SHIPPED>1/5/2000 0:0:0</DATE_SHIPPED>
      <SHIPPED_VIA>UPS</SHIPPED_VIA>
      <SHIPPED_FROM>MOOSIC</SHIPPED_FROM>
      <FREIGHT>0.59</FREIGHT>
      <TOTAL>19.73</TOTAL>
   </INVOICE>
</INVOICES>
========================= INVHEAD.XML =============================

========================= invbill.xml =============================
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<TRANSACTION_PARTIES>
   <TRANSACTION_PARTY account="738600" type="BILL_TO">
      <NAME>POWER &amp; MINE SUPPLY CO.</NAME>
      <ADDRESS1>ATTN: ACCOUNTS PAYABLE</ADDRESS1>
      <ADDRESS2>UNIT B-01, 961 SHERWIN RD.</ADDRESS2>
      <CITY>WINNIPEG,CANADA</CITY>
      <STATE>MB</STATE>
      <ZIPCODE>R3H OT8</ZIPCODE>
      <COUNTRY>CA</COUNTRY>
   </TRANSACTION_PARTY>
   <TRANSACTION_PARTY account="738625" type="BILL_TO">
      <NAME>POWER &amp; MINE SUPPLY CO.</NAME>
      <ADDRESS1>ATTN: ACCOUNTS PAYABLE</ADDRESS1>
      <ADDRESS2>UNIT B-01, 961 SHERWIN RD.</ADDRESS2>
      <CITY>WINNIPEG</CITY>
      <STATE>MB</STATE>
      <ZIPCODE>R3H 0T8</ZIPCODE>
      <COUNTRY>CA</COUNTRY>
   </TRANSACTION_PARTY>
</TRANSACTION_PARTIES>
========================= invbill.xml =============================

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.