xsl-list
[Top] [All Lists]

[xsl] Looping within XSL

2006-03-16 16:12:19
Hello,

I am trying to generate xml file which will looks like this

<RPSL_BATCH>
<RPSL_PTNR ? />
...
<RPSL_PTNR ? />
</RPSL_BATCH>

where RPSL_PTNR is as follows

<RPSL_PTNR
ptnr_id="PTNR1"
ptnr_type="SHIP_TO_PARTNER"
sub_org="100"
name_1="NAME"
address_1="ADD1"
address_2="ADD2"
address_3="ADD3"
address_4="ADD4"
address_5="ADD5"
city="CITY"
state_name="STATE"
state_code="STATE_CODE"
postal_code="POSTAL"
ctry_name="CTRY"
ctry_code="CTRY_CODE"
decision=?Y?
rpl_ind=?C?
epci_ind=?Y?
antiboycott_ind=?Y?
usembargo_ind=?Y?
unembargo_ind=?Y?
euembargo_ind=?Y?
proscribed_ind=?Y?
user_varchar1="TRANSACTION_ID"
user_varchar2="GEOGRAPHICAL_LOCATION"
user_varchar3="TIME_SUBMITTED"/>

Basically I need to have one RPSL_PTNR for say ship to custoemr and one for
bill to and ione for end user custoemrs etc. I will have those many
RPSL_PTNR repeating in the main batch.

I have come up with the xsl file which looks like

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<!--                        -->
<!-- Template Output is XML -->
<!--                        -->
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"
omit-xml-declaration="yes"/>
<xsl:template match="/">
        <xsl:element name="RPSL_BATCH">
        <xsl:apply-templates select="/ORDER"/>
        <xsl:apply-templates select="/ORDER/PARTNER"/>
        <xsl:for-each select="/ORDER/PARTNER/PARTNER_ROW">
        <xsl:element name="RPSL_PTNR">
            <!--- BEGIN PARTNER -->
            <xsl:attribute name="ptnr_id=">
                <xsl:value-of select="/ORDER/PARTNER/CUSTOMER_NUMBER"/>
            </xsl:attribute>
            <xsl:attribute name="ptnr_type=">
                 <xsl:value-of select="/ORDER/PARTNER/SITE_USE_CODE"/>
            </xsl:attribute>
            <xsl:attribute name="sub_org=">
                 <xsl:value-of select="/ORDER/PARTNER/SUB_ORG"/>
            </xsl:attribute>
            <xsl:attribute name="app_id=">
                 <xsl:value-of select="/ORDER/PARTNER/APP_ID"/>
            </xsl:attribute>
            <xsl:attribute name="name_1=">
        <xsl:value-of select="/ORDER/PARTNER/CUSTOMER_NAME"/>
            </xsl:attribute>
                <xsl:attribute name="address_1=">
        <xsl:value-of select="/ORDER/PARTNER/ADDRESS_1"/>
        </xsl:attribute>
        <xsl:attribute name="address_2=">
    <xsl:value-of select="/ORDER/PARTNER/ADDRESS_2"/>
        </xsl:attribute>
        <xsl:attribute name="address_3=">
    <xsl:value-of select="/ORDER/PARTNER/ADDRESS_3"/>
        </xsl:attribute>
        <xsl:attribute name="address_4=">
    <xsl:value-of select="/ORDER/PARTNER/ADDRESS_4"/>
        </xsl:attribute>
        <xsl:attribute name="address_5=">
    <xsl:value-of select="/ORDER/PARTNER/ADDRESS_5"/>
        </xsl:attribute>
     <xsl:attribute name="city=">
    <xsl:value-of select="/ORDER/PARTNER/CITY"/>
        </xsl:attribute>
        <xsl:attribute name="state_name=">
    <xsl:value-of select="/ORDER/PARTNER/STATE_NAME"/>
        </xsl:attribute>
        <xsl:attribute name="state_code=">
    <xsl:value-of select="/ORDER/PARTNER/STATE_CODE"/>
        </xsl:attribute>
        <xsl:attribute name="postal_code=">
    <xsl:value-of select="/ORDER/PARTNER/POSTAL_CODE"/>
        </xsl:attribute>
        <xsl:attribute name="ctry_name=">
    <xsl:value-of select="/ORDER/PARTNER/CTRY_NAME"/>
        </xsl:attribute>
        <xsl:attribute name="ctry_code=">
    <xsl:value-of select="/ORDER/PARTNER/CTRY_CODE"/>
        </xsl:attribute>
        <xsl:attribute name="created_by=">
    <xsl:value-of select="/ORDER/PARTNER/CREATED_BY"/>
        </xsl:attribute>
        <xsl:attribute name="request_url=">
    <xsl:value-of select="/ORDER/PARTNER/REQUEST_URL"/>
        </xsl:attribute>
        <xsl:attribute name="use_cached_result=">
    <xsl:value-of select="/ORDER/PARTNER/USER_CACHED_RESULT"/>
        </xsl:attribute>
        <xsl:attribute name="persist=">
    <xsl:value-of select="/ORDER/PARTNER/PERSIST"/>
        </xsl:attribute>
        <xsl:attribute name="user_varchar1=">
    <xsl:value-of select="./ORDER/ORDER_NUMBER"/>
        </xsl:attribute>
        <xsl:attribute name="user_varchar2=">
    <xsl:value-of select="/ORDER/PARTNER/SITE_USE_ID"/>
        </xsl:attribute>
        <xsl:attribute name="user_varchar3=">
    <xsl:value-of select="/ORDER/PARTNER/USER"/>
        </xsl:attribute>
</xsl:element>
  </xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>



What am I doing wrong here. I get error saying not all variables bound.

I am using oralce utl_http to create the XML file.

Thanks,
Manisha



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>