CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: XSLT question

  1. #1
    Join Date
    Aug 2009
    Posts
    3

    XSLT question

    <?xml version="1.0" encoding="UTF-8"?>
    <OMDefault xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <PrintDollarsAndCents>X</PrintDollarsAndCents>
    <MailAddrLine1>Add1</MailAddrLine1>
    <MailAddrLine2>Add2</MailAddrLine2>
    </OMDefault>

    I would like to have an XSLT to transform the XML to this

    <?xml version="1.0" encoding="UTF-8"?>
    <OMDefault xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <PrintDollarsAndCents>Y</PrintDollarsAndCents>
    <MailAddrLine1>Add1</MailAddrLine1>
    <MailAddrLine2>Add2</MailAddrLine2>
    </OMDefault>

    Please notice the 'X' gets transformed to 'Y' if the attribute is PrintDollarsAndCents and its value is 'X' Could someone please help me with this? As I am very new to this XSLT thing.

    Thank you in advance.
    Last edited by trandd; July 9th, 2013 at 07:41 PM.

  2. #2
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: XSLT question

    there are no attributes in your xml, so I'm not sure what you're getting at.

    other than that, it seems simple enough, make an XSLT to copy all nodes as is, and copy the tag you want by converting the contents in the way you want it.

    From a tech pov, you don't even need a transform. open the xml, change the contents of that node, save the xml.
    the point about transforms is that you "change" the structure of the xml which you aren't even doing here.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured