|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSLT document() function!!!!
Please try the XSL below --
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
<xsl:variable name="FILE"
select="document('BBSD_CUST_ADDRESSES.xml')"/>
<xsl:template match="/">
<xsl:apply-templates select="BBSD_CUSTOMERS"/>
</xsl:template>
<xsl:template match="BBSD_CUSTOMERS">
<WCUSTOMERS>
<xsl:for-each select="mappings">
<xsl:variable name="rec_no" select="@Record"/>
<mappings>
<EMAIL>
<xsl:value-of
select="$FILE/BBSD_CUST_ADDRESSES/mappings[@Record =
$rec_no]/CADR_E_MAIL_1" />
</EMAIL>
<CUST_NAME>
<xsl:value-of select="CUST_B_NAME"/>
</CUST_NAME>
<CUST_LAST_NAME>
<xsl:value-of select="CUST_S_NAME"/>
</CUST_LAST_NAME>
</mappings>
</xsl:for-each>
</WCUSTOMERS>
</xsl:template>
</xsl:stylesheet>
i have changed the syntax slightly.. If you wish to
use your syntax, you may take idea from this code.
Regards,
Mukul
--- michel geadah <m_ace_g@xxxxxxxxxxx> wrote:
> HI...
> A little question:
> My input xml document (BBSD_CUSTOMERS.xml) is:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <BBSD_CUSTOMERS>
> <mappings Record="1">
> <CUST_B_NAME>AAA</CUST_B_NAME>
> <CUST_S_NAME>AAAA</CUST_S_NAME>
> </mappings>
> <mappings Record="2">
> <CUST_B_NAME>BBB</CUST_B_NAME>
> <CUST_S_NAME>BBBB</CUST_S_NAME>
> </mappings>
> etc..
> </BBSD_CUSTOMERS>
>
> My xslt document (BBSD_CUSTOMERS.xsl) is:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="xml" />
> <xsl:variable name="FILE"
> select="document('BBSD_CUST_ADDRESSES.xml')"/>
> <xsl:template match="/">
> <xsl:element name="WCUSTOMERS">
> <xsl:for-each select="//BBSD_CUSTOMERS/mappings">
> <xsl:element name="{name()}">
>
>
> <EMAIL>
> <xsl:apply-templates
> select="$FILE/BBSD_CUST_ADDRESSES
> /mappings/CADR_E_MAIL_1"/>
> </EMAIL>
>
> <xsl:element name="CUST_NAME">
> <xsl:value-of select="CUST_B_NAME" />
> </xsl:element>
>
> <xsl:element name="CUST_LAST_NAME">
> <xsl:value-of select="CUST_S_NAME" />
> </xsl:element>
> </xsl:element>
> </xsl:for-each>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
>
> The BBSD_CUST_ADDRESSES.xml (xml document that is
> referenced from inside the
> xslt) is:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <BBSD_CUST_ADDRESSES>
> <mappings Record="1">
>
> <CADR_E_MAIL_1>www.youpi@xxxxxxxxx</CADR_E_MAIL_1>
> </mappings>
> <mappings Record="2">
>
> <CADR_E_MAIL_1>www.youpa@xxxxxxxxx</CADR_E_MAIL_1>
> </mappings>
> <mappings Record="3">
> <CADR_E_MAIL_1>www.youpo@xxxxxxxxx</CADR_E_MAIL_1>
> </mappings>
> </BBSD_CUST_ADDRESSES>
>
> My output is:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <WCUSTOMERS>
> <mappings>
>
>
<EMAIL>www.youpi@xxxxxxxxxxxxxxxxxx@y...@xxxxxxxxx</EMAIL>
> <CUST_NAME>AAA</CUST_NAME>
> <CUST_LAST_NAME>AAAA</CUST_LAST_NAME>
> </mappings>
> <mappings>
>
>
<EMAIL>www.youpi@xxxxxxxxxxxxxxxxxx@y...@xxxxxxxxx</EMAIL>
> <CUST_NAME>BBB</CUST_NAME>
> <CUST_LAST_NAME>BBBB</CUST_LAST_NAME>
> </mappings>
> <mappings>
>
>
<EMAIL>www.youpi@xxxxxxxxxxxxxxxxxx@y...@xxxxxxxxx</EMAIL>
> <CUST_NAME>CCC</CUST_NAME>
> <CUST_LAST_NAME>CCCC</CUST_LAST_NAME>
> </mappings>
> </WCUSTOMERS>
>
> How can i modify my xslt to get the following
> output:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <WCUSTOMERS>
> <mappings>
> <EMAIL>www.youpi@xxxxxxxxx</EMAIL>
> <CUST_NAME>AAA</CUST_NAME>
> <CUST_LAST_NAME>AAAA</CUST_LAST_NAME>
> </mappings>
> <mappings>
> <EMAIL>www.youpa@xxxxxxxxx</EMAIL>
> <CUST_NAME>BBB</CUST_NAME>
> <CUST_LAST_NAME>BBBB</CUST_LAST_NAME>
> </mappings>
> <mappings>
> <EMAIL>www.youpo@xxxxxxxxx</EMAIL>
> <CUST_NAME>CCC</CUST_NAME>
> <CUST_LAST_NAME>CCCC</CUST_LAST_NAME>
> </mappings>
> </WCUSTOMERS>
>
> THANKS...
>
>
_________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online
>
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
> XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








