[Home] [By Thread] [By Date] [Recent Entries]
Hello,
I am new to XSLT technology and being thrown to develop something real quick. I need to come up with xslt stylesheet format which will generate XML file in format below. Basically the output format does not have tags. can someone help me come up with xslt fiel format for the same? The values which are in quotation marks are going to be fed by database. <RPSL_PTNR ptnr_id="31942" ptnr_type="SHIP_TO" sub_org="NGEN" app_id="TPRPL_100" name_1="Unisys Corp." address_1="350 SOUTH 5TH" address_2="ROOM 127" address_3="" address_4="" address_5="" city="MINNEAPOLIS" state_name="MN" state_code="MN" postal_code="55415" ctry_name="United States" ctry_code="US" created_by="JBRYANT" request_url="https://testxmlfulfill.networkgeneral.com/normal/oraapps/dev/ReceiveVastraXML" use_cached_result="FALSE" persist="TRUE" user_varchar1="2009794" user_varchar2="125685" user_varchar3=""/>
<?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_PTNR"> <!--- BEGIN PARTNER --> <xsl:attribute name="ptnr_id="> <xsl:value-of select="/ORDER/CUSTOERM_NUMBER"/> </xsl:attribute> <xsl:attribute name="ptnr_type="> <xsl:value-of select="/ORDER/SITE_USE"/> </xsl:attribute> <xsl:attribute name="sub_org="> <xsl:value-of select="/ORDER/SUB_ORG"/> </xsl:attribute> <xsl:attribute name="app_id="> <xsl:value-of select="/ORDER/APP_ID"/> </xsl:attribute> <xsl:attribute name="name_1="> <xsl:value-of select="/ORDER/CUST_NAME"/> </xsl:attribute> <xsl:attribute name="address_1="> <xsl:value-of select="/ORDER/ADDRESS_1"/> </xsl:attribute> <xsl:attribute name="address_2="> <xsl:value-of select="/ORDER/ADDRESS_2"/> </xsl:attribute> <xsl:attribute name="address_3="> <xsl:value-of select="/ORDER/ADDRESS_3"/> </xsl:attribute> <xsl:attribute name="address_4="> <xsl:value-of select="/ORDER/ADDRESS_4"/> </xsl:attribute> <xsl:attribute name="address_5="> <xsl:value-of select="/ORDER/ADDRESS_5"/> </xsl:attribute> <xsl:attribute name="city="> <xsl:value-of select="/ORDER/CITY"/> </xsl:attribute> <xsl:attribute name="state_name="> <xsl:value-of select="/ORDER/STATE_NAME"/> </xsl:attribute> <xsl:attribute name="state_code="> <xsl:value-of select="/ORDER/STATE_CODE"/> </xsl:attribute> <xsl:attribute name="postal_code="> <xsl:value-of select="/ORDER/POSTAL_CODE"/> </xsl:attribute> <xsl:attribute name="ctry_name="> <xsl:value-of select="/ORDER/CTRY_NAME"/> </xsl:attribute> <xsl:attribute name="ctry_code="> <xsl:value-of select="/ORDER/CTRY_CODE"/> </xsl:attribute> <xsl:attribute name="created_by="> <xsl:value-of select="/ORDER/CREATED_BY"/> </xsl:attribute> <xsl:attribute name="request_url="> <xsl:value-of select="/ORDER/REQUEST_URL"/> </xsl:attribute> <xsl:attribute name="use_cached_result="> <xsl:value-of select="/ORDER/USE_CACHED_RESULT"/> </xsl:attribute> <xsl:attribute name="persist="> <xsl:value-of select="/ORDER/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/SITE_USE_ID"/> </xsl:attribute> <xsl:attribute name="user_varchar3="> <xsl:value-of select="/ORDER/USER"/> </xsl:attribute> </xsl:element> </xsl:template> </xsl:stylesheet> All help appreciated. Thanks in advance. Manisha
|

Cart



