xsl-list
[Top] [All Lists]

RE: SQL SELECT statement in XSLT!!!!!!!!!!!!

2003-08-08 00:22:23
hi,
This is the source xml file:

<?xml version="1.0" encoding="utf-8" ?>
<BBSD_CUST_ACCOUNTS>
<mappings Record="1">
 <BRCH_CODE>1</BRCH_CODE>
 <CACC_NUM>TTTT/CACC_NUM>
 <CIRT_CODE>016</CIRT_CODE>
 <CURR_CODE>117</CURR_CODE>
 <CUST_ID>0001</CUST_ID>
 <ECOS_CODE>876</ECOS_CODE>
 <CACC_B_NAME>zzzzzz</CACC_B_NAME>
 <CACC_AVAIL_BAL>1548000</CACC_AVAIL_BAL>
 </mappings>
 <mappings>
 etc...
 </mappings>
 </BBSD_CUST_ACCOUNTS>

This is the relevant XSLT:

<?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:template match="/">
<xsl:element name="WACCOUNTS">
<xsl:for-each select="//BBSD_CUST_ACCOUNTS/mappings">
<xsl:element name='{name()}'>
<CURR_ISO>
<xsl:value-of select="document('BBSC_CURRENCIES.xml')/BBSC_CURRENCIES
                                /mappings/CURR_ISO"/>
</CURR_ISO>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>


I am going to put the select statement here:
select CURR_ISO from BBSC_CURRENCIES where CURR_CODE(in BBSD_CUST_ACCOUNTS)=CURR_CODE(in BBSC_CURRENCIES)

The output should be like this:
<?xml version="1.0" encoding="utf-8" ?>
<WACCOUNTS>
<mappings>
 <CUR_ISO>(VALUE FROM 'THE SELECT' STATEMENT ABOVE)</CUR_ISO>
 </mappings>
<mappings>
etc..
</mappings>
</WACCOUNTS>

Thanks a lot...
Michel

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail


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