#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    XML Transformation using XSL


    Hi ,
    I want to transform a XML from one structure to XML of another structure using XSL.

    From
    <Sample>
    <Order>1</Order>
    <Date>1</Date>
    <Desc>Router</Desc>
    <Qty>1</Qty>
    <Desc>Equip</Desc>
    <Qty>2</Qty>
    <Desc>Setup-Box</Desc>
    <Qty>3</Qty>
    <Sample>

    To
    <OrderDtls>
    <OrderNumber>1</OrderNumber>
    <DueDate></DueDate>
    <BILLING_CPE>
    <Description>Router</Description>
    <Quantity>Router</Quantity>
    </BILLING_CPE>
    <BILLING_CPE>
    <Description>Equip</Description>
    <Quantity>Equip</Quantity>
    </BILLING_CPE>
    <BILLING_CPE>
    <Description>Setup-Box</Description>
    <Quantity>Setup-Box</Quantity>
    </BILLING_CPE>
    </OrderDtls>

    I am having problem with putting the Desc & Qty from first xml under a new complex type Billing_cpe.

    <BILLING_CPE>
    <xsl:for-each select="Sample/Desc">
    <Description>
    <xsl:value-of select="."/></Description>
    <Quantity><xsl:value-of select="//Sample/Qty"/></Quantity>
    </xsl:for-each>
    </BILLING_CPE>

    This doesn't work .

    Prints

    <BILLING_CPE>
    <Description>Router</Description>
    <Quantity>1</Quantity>
    <Description>Equip</Description>
    <Quantity>1</Quantity>
    <Description>Setup-Box</Description>
    <Quantity>1</Quantity>
    </BILLING_CPE>


    Can someone help me please on how to do the conversion using XSL
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,183
    Rep Power
    9398
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    42
    Rep Power
    3
    I am having an XML like below,

    1. <SECT1><TITLE>Title1</TITLE><PARA>Line1<BR/>Line2<BR/>Line3<BR/>Line4<BR/>Line5</PARA></SECT1

    >

    1.

IMN logo majestic logo threadwatch logo seochat tools logo