[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Looping within XSL


Subject: [xsl] Looping within XSL
From: "Manisha Gore" <manishakulkarni@xxxxxxxxxxx>
Date: Thu, 16 Mar 2006 15:11:53 -0800

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


Current Thread
Keywords