[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: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Mon, 23 Sep 2002 22:02:38 +0200
invoice xsl
> 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

Hello Rich,

your stylesheet looks really good. Only some little changes according the variable usage: A variable is more or less useless, if you can't use it multiple times.


========================= mergeXML.xsl ===============================
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"

Really version="2.0"? Only Saxon supports the Working Draft version of XSLT and XPath 2.0.


     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>

<xsl:template match="/invoice-xml-files">
    <xsl:variable name="TA-Parties" select="document(@bill-to)/TRANSACTION_PARTIES/TRANSACTION_PARTY"/>

I suggest to declare the node set once. Look at the further changes.


    <html>
        <head>
            <title>
                This is driving me out of my mind!!!!
            </title>
        </head>
        <body>
            <xsl:apply-templates select="document(@invoice-header)/INVOICES/INVOICE">
              <xsl:with-param name="TA-Parties" select="$TA-Parties"/>
            </xsl:apply-templates>
         </body>
    </html>
</xsl:template>

<xsl:template match="INVOICES/INVOICE">
    <xsl:param name="TA-Parties"/>
    <hr/>
    <h3>INVOICE HEADER RECORD</h3>
    <xsl:apply-templates
         select="$TA-Parties[@account=current()/@account 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 ==========

I hope I did no mistakes.


The next time please send the XML with the question, this solves mostly the confusion.

Regards,

Joerg


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.