Need help on xslt transformation

Hi ,
I am working on a xslt transformation and  I am finding it difficult to implement the transformation. The scenario is as below.
Input format :-
A
B
B
B
4
5
A
B
B
A
B
B
B
Output format :-
A
B
B
B (since after A there were 3 B’s before the next A)
A
B
B(since after A there were two B’s before the next A)
A
B
B
B
I don't need type 4,5 records in the output xml,output should have repetition of (A followed by B’s(till the next occurrences of A)).
if some one encountered a similar transformation kindly let me know.

Hi,
You can use "Call" and "Apply" template.
1st thing to do:
e.g.
<xsl:template name="Check_Decimal">
    <xsl:param name="Xpath"/>
    <xsl:choose>
      <xsl:when test="($Xpath) and ($Xpath)!='4'">
        <xsl:value-of select="$Xpath"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="' ' '"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
            <xml_Target_Element_1>
              <xsl:call-template name="Check_Decimal">
                <xsl:with-param name="Xpath"
                                select="/x/y/z/xml_Target_Element_1"/>
              </xsl:call-template>
            </xml_Target_Element_1>
This means, it will display the value in xpath if value is not equal to 4. And if it is equal to 4, it displays nothing.
2nd thing to do:
Apply for-each to xpath till the String element reaches to "A".
Regards,
Richa

Similar Messages

  • Need help in XSLT transformation

    Hi,
    I need to transform below input XML to output XML. Can you please provide any ideas for this
    Input XML :
    <?xml version="1.0" encoding="UTF-8" ?>
    <GenericCollection ParamValue="ParamValue1" xmlns="http://www.example.org">
    <Generic>
    <store>Store1</store>
    <metricName>Metric1</metricName>
    <metricValue>1</metricValue>
    </Generic>
    <Generic>
    <store>Store1</store>
    <metricName>Metric2</metricName>
    <metricValue>1</metricValue>
    </Generic>
    <Generic>
    <store>Store2</store>
    <metricName>Metric1</metricName>
    <metricValue>1</metricValue>
    </Generic>
    <Generic>
    <store>Store2</store>
    <metricName>Metric1</metricName>
    <metricValue>2</metricValue>
    </Generic>
    <Generic>
    <store>Store2</store>
    <metricName>Metric2</metricName>
    <metricValue>1</metricValue>
    </Generic>
    <Generic>
    <store>Store3</store>
    <metricName>Metric1</metricName>
    <metricValue>1</metricValue>
    </Generic>
    <Generic>
    <store>Store3</store>
    <metricName>Metric1</metricName>
    <metricValue>2</metricValue>
    </Generic>
    </GenericCollection>
    Output XML :
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <ns4:EnterpriseDocument>
    <ns4:DataSet>
    <ns4:Dimension ref_name="bu_code" value="Store1">
    <ns4:Metric ref_name="Metric1">
    <ns4:Data value="1"/>
    </ns4:Metric>
    <ns4:Metric ref_name="Metric2">
    <ns4:Data value="1"/>
    </ns4:Metric>
    </ns4:Dimension>
    <ns4:Dimension ref_name="bu_code" value="Store2">
    <ns4:Metric ref_name="Metric1">
    <ns4:Data value="1"/>
    <ns4:Data value="2"/>
    </ns4:Metric>
    <ns4:Metric ref_name="Metric2">
    <ns4:Data value="1"/>
    </ns4:Metric>
    </ns4:Dimension>
    <ns4:Dimension ref_name="bu_code" value="Store3">
    <ns4:Metric ref_name="Metric1">
    <ns4:Data value="1"/>
    <ns4:Data value="2"/>
    </ns4:Metric>
    </ns4:Dimension>
    </ns4:DataSet>
    </ns4:EnterpriseDocument>
    Thanks,
    Ramesh

    Hello Ramesh,
    Nice puzzle
    For this you need a transformation with XSLT 2.0. Use a two level grouping. First group on the store elements and the second on the metricName elements.
    Transformation looks like this:
    <?xml version="1.0"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:template match="/">
             <EnterpriseDocument>
                 <DataSet>
                     <!-- First group on the store elements
                          Each store will be grouped based on the element value
                     -->
                     <xsl:for-each-group select="/*[local-name() = 'GenericCollection']/*[local-name() = 'Generic']" group-by="./*[local-name() = 'store']">
                         <!-- For each store a Dimension element is needed -->
                         <Dimension ref_name="bu_code" value="{./*[local-name() = 'store']}">
                             <!-- Within a Dimension we need to group by metricName -->
                             <xsl:for-each-group select="current-group()" group-by="./*[local-name() = 'metricName']">
                                 <Metric ref_name="{./*[local-name() = 'metricName']}">
                                     <!-- Iterate over the metricName nodes and create a Data element -->
                                     <xsl:for-each select="current-group()/*[local-name() = 'metricValue']">
                                         <Data value="{.}"/>
                                     </xsl:for-each>
                                 </Metric>
                             </xsl:for-each-group>
                         </Dimension>
                     </xsl:for-each-group>
                 </DataSet>
             </EnterpriseDocument>
         </xsl:template>
    </xsl:stylesheet>
    Good luck!
    Regards,
    Melvin

  • Need help with XML transformation

    I am not sure this is the right place for this. But i will try it here. I am very troubled with my XSLT. Trying to transform a text Coupon which has the following html for it. So,
    _1. INPUT is:_
    <html>
    <head>
    </head>
    <body>
    <p>
    This coupon is for a good guy whose first name is :
    </p>
    <p>
    </p>
    <p align="center">
    Sadd
    </p>
    <p align="center">
    </p>
    <p align="right">
    <b>also</b> whose <var>full_name</var> is Sadd Hossain
    </p>
    <p align="left">
    </p>
    <p align="left">
    He is a <font size="3">software </font><font size="4">engineer for</font><font size="5">
    S&H</font>
    </p>
    </body>
    </html>
    *2. output needed  is:*
    <?xml version="1.0" encoding="UTF-8"?>
    <POSMESSAGE>
    <TextMSG >
    This coupon is for a good guy whose first name is :
    </TextMSG>
    <TextMSG >
    </TextMSG>
    <TextMSG align="center">
    <emph>SADD</emph>
    </TextMSG>
    <TextMSG >
    </TextMSG>
    <TextMSG align="right" >
    also whose full_name is Sadd Hossain
    </TextMSG>
    <TextMSG>
    </TextMSG>
    <TextMSG align="left" >
    He is a software engineer
    for S&H
    </TextMSG>
    </POSMESSAGE>
    *3. XSLT for this*
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml"/>
    <xsl:template match="body">
    <POSMESSAGE>
    <xsl:for-each select="p">
    <TextMSG>
    <!--xsl:if test="not[@align='']"-->
    <xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>
    <!--/xsl:if-->
    <xsl:attribute name="font"><xsl:value-of select="@size"/></xsl:attribute>
    <xsl:value-of select="."/>
    </TextMSG>
    <xsl:for-each select="b">
    <emph>
    <xsl:value-of select="."/>
    </emph>
    </xsl:for-each>
    </xsl:for-each>
    </POSMESSAGE>
    </xsl:template>
    </xsl:stylesheet>
    *4: the above xslt generating this output*
    <?xml version="1.0" encoding="UTF-8"?>
    <POSMESSAGE><TextMSG align="" font="">
    This coupon is for a good guy whose first name is :
    </TextMSG><TextMSG align="" font="">
    </TextMSG><TextMSG align="center" font="">
    SADD
    </TextMSG><TextMSG align="center" font="">
    </TextMSG><TextMSG align="right" font="">
    also whose full_name is Sadd Hossain
    </TextMSG><TextMSG align="left" font="">
    </TextMSG><TextMSG align="left" font="">
    He is a software engineer
    for S&H
    </
    *5: Need help with this. what should my xslt look like to get the desired output???????????????*
    any help or direction will be very much appreciated. Thank you_

    I have below suggestions:
    1. Please use code option given in message editor toolbar for posting any formatted content like XML, Java code snippet etc.
    2. replace & in your source XML with _& a m p ;_ (Without spaces, I have put spaces to make it visible here).
    3. I have modified your XSLT according output XML you have given. I am not sure what you want to do with some elements like <b>, <font>, <var> etc. change below XSLT as you require for these elements.
    Modified XSLT:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
            <xsl:output method="xml"/>
         <xsl:template match="body">
              <POSMESSAGE>
                   <xsl:for-each select="p">
                        <TextMSG>
                             <xsl:if test=". != ''">
                                  <xsl:for-each select="@align">
                                       <xsl:attribute name="align">
                                            <xsl:value-of select="."></xsl:value-of>
                                       </xsl:attribute>
                                  </xsl:for-each>
                                  <xsl:value-of select="."/>
                             </xsl:if>
                        </TextMSG>
                   </xsl:for-each>
              </POSMESSAGE>
         </xsl:template>
    </xsl:stylesheet>
    OUTPUT:
    <?xml version="1.0"?>
    <POSMESSAGE>
         <TextMSG>This coupon is for a good guy whose first name is :</TextMSG>
         <TextMSG/>
         <TextMSG align="center">Sadd</TextMSG>
         <TextMSG/>
         <TextMSG align="right">alsowhose full_name is Sadd Hossain</TextMSG>
         <TextMSG/>
         <TextMSG align="left">He is a softwareengineer forS&H</TextMSG>
    </POSMESSAGE>

  • Need help in message transformation.

    I need help to resolve following error during message transformation.
    ........ BaseRuntimeException: RuntimeException in Message-Mapping transformation: Cannot produce target element /ns0:BankCheckRecon_Request_MT/Header. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd at com.sap.aii.mappingtool.tf3.AMappingProgram.start.............
    <b>Note –</b> Message Map and Interface map are working correctly when tested separately in the Repository.
    <b>Mapping Rules:</b>
    /ns0:BankCheckRecon_Request_MT=/ns0:ComericaCheckRecon_Request_MT=
    /ns0:BankCheckRecon_Request_MT/Header=/ns0:ComericaCheckRecon_Request_MT/Header=
    /ns0:BankCheckRecon_Request_MT/Header/RecordID=const()
    /ns0:BankCheckRecon_Request_MT/Header/HdrNumber=const()
    /ns0:BankCheckRecon_Request_MT/Header/SenderBank=const()
    /ns0:BankCheckRecon_Request_MT/Header/ReceiverBank=const()
    /ns0:BankCheckRecon_Request_MT/Header/AcctNumber=/ns0:ComericaCheckRecon_Request_MT/Header/AcctNumber=
    /ns0:BankCheckRecon_Request_MT/Header/PymtType=const()
    /ns0:BankCheckRecon_Request_MT/Header/TapeDate=const()
    /ns0:BankCheckRecon_Request_MT/Header/ISOCurr=const()
    /ns0:BankCheckRecon_Request_MT/Item=ifWithoutElse(stringEquals(/ns0:ComericaCheckRecon_Request_MT/Detail/RecordID=, const()), /ns0:ComericaCheckRecon_Request_MT/Detail=)
    /ns0:BankCheckRecon_Request_MT/Item/RecordID=const()
    /ns0:BankCheckRecon_Request_MT/Item/ValueDate=currentDate()
    /ns0:BankCheckRecon_Request_MT/Item/ChkNumber=/ns0:ComericaCheckRecon_Request_MT/Detail/ChkNumber=
    /ns0:BankCheckRecon_Request_MT/Item/ChkAmount=/ns0:ComericaCheckRecon_Request_MT/Detail/ChkAmount=
    /ns0:BankCheckRecon_Request_MT/Item/ReceiverBank=const()
    /ns0:BankCheckRecon_Request_MT/Item/AcctNumber=const()
    /ns0:BankCheckRecon_Request_MT/Item/EncashDate=TransformDate(/ns0:ComericaCheckRecon_Request_MT/Detail/ChkPaidDate=)
    /ns0:BankCheckRecon_Request_MT/Item/TransCode=const()
    /ns0:BankCheckRecon_Request_MT/Item/AcctNumber_1=/ns0:ComericaCheckRecon_Request_MT/Detail/AcctNumber=
    <b>Test Data -</b>
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:ComericaCheckRecon_Request_MT xmlns:ns0="http://mazdausa.com/sapr3/fi/transdata/bankcheckrecon">
       <Header>
          <AcctNumber>2176975528</AcctNumber>
          <Filler1> </Filler1>
          <ReconDate>123105</ReconDate>
          <Filler2> </Filler2>
          <RecordID>H</RecordID>
          <Filler3> </Filler3>
       </Header>
       <Detail>
          <AcctNumber>2176975528</AcctNumber>
          <Filler1> </Filler1>
          <ChkNumber>0000200001</ChkNumber>
          <Filler2> </Filler2>
          <ChkPaidDate>121905</ChkPaidDate>
          <Filler3> </Filler3>
          <ChkAmount>0001020000</ChkAmount>
          <RecordID>D</RecordID>
          <Filler4> </Filler4>
       </Detail>
       <Detail>
          <AcctNumber>2176975528</AcctNumber>
          <Filler1> </Filler1>
          <ChkNumber>0000200002</ChkNumber>
          <Filler2> </Filler2>
          <ChkPaidDate>121405</ChkPaidDate>
          <Filler3> </Filler3>
          <ChkAmount>0164840000</ChkAmount>
          <RecordID>D</RecordID>
          <Filler4> </Filler4>
       </Detail>
       <Trailer>
          <AcctNumber>2176975528</AcctNumber>
          <Filler1> </Filler1>
          <ChksCount>0000000493</ChksCount>
          <Filler2> </Filler2>
          <TotalAmount>0766945400</TotalAmount>
          <Filler3> </Filler3>
          <RecordID>T</RecordID>
          <Filler4> </Filler4>
       </Trailer>
    </ns0:ComericaCheckRecon_Request_MT>
    Thanks
    Rajesh

    Thanks Mohan for your quick response. I am working with File Adapter and here are <b>Message Structures:</b>
    ComericaCheckRecon_Request_MT     
    Header     
    AcctNumber     10
    Filler1     1
    ReconDate     6
    Filler2     22
    RecordID     1
    Filler3     40
    Detail     
    AcctNumber     10
    Filler1     1
    ChkNumber     10
    Filler2     1
    ChkPaidDate     6
    Filler3     1
    ChkAmount     10
    RecordID     1
    Filler4     40
    Trailer     
    AcctNumber     10
    Filler1     1
    ChksCount     10
    Filler2     1
    TotalAmount     10
    Filler3     7
    RecordID     1
    Filler4     40
    BankCheckRecon_Request_MT     
    Header     
    RecordID     1
    HdrNumber     3
    SenderBank     15
    ReceiverBank     15
    AcctNumber     18
    PymtType     3
    TapeDate     8
    ISOCurr     3
    Item     
    RecordID     1
    ValueDate     8
    ChkNumber     13
    ChkAmount     11
    ReceiverBank     15
    AcctNumber     10
    EncashDate     8
    TransCode     3
    AcctNumber     18

  • Help on xslt transformation

    Hi,
    I am working on a xslt transformation and  I am finding it difficult to implement the transformation. The scenario is as below.
    Input format :-
    A
    B
    B
    B
    4
    5
    A
    B
    B
    A
    B
    B
    B
    Output format :-
    A
    B
    B
    B (since after A there were 3 B’s before the next A)
    A
    B
    B(since after A there were two B’s before the next A)
    A
    B
    B
    B
    So basically I am not interested in 4,5 type records the output should have repetition of (A followed by B’s(till the next occurance of A)).
    if some has done any similar kind of transformation ,kindly let me know

    the pusedo code I am thinking for the above transformation is as below
    for-each of A
         do mappings using A's elements values
         Flag=Run
         For-each of B
              if flag!=stop
                    do B's mapping using B's elements values
                    if  next node is A
                    Flag=Stop
    But I came to know that varaibles once initilaised cannot be changed or modified .Also in the above approach in the second iteration of A when I say for-each of B ,xslt will start again from the first occurrence of B in the whole file and not from the B which is following the second A's occurence
    i am wondering if can this can be achieved in xslt or shoud we consider using only java?

  • Need help in XSLT

    Hi all, I am working on xslt for the xml document which is similar to this :-
    <?xml version="1.0" encoding="UTF-8"?>
         <soapenv:Envelope      xmlns:soapenv="peopledirectory">
         *<soapenv:Header/>*
         <soap-env:Body      xmlns:soap-env="propleaccess">
         <medi:MEDI_DEV_OSB_POCOutputCollection      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:medi="http://xmlns.oracle.com/pcbpel/adapter/db/MEDI_DEV_OSB_POC">
    <medi:MEDI_DEV_OSB_POCOutput>
         <medi:STUDYID>123</medi:STUDYID>
         <medi:DOMAIN>CTS</medi:DOMAIN>
    </medi:MEDI_DEV_OSB_POCOutput>
    <medi:MEDI_DEV_OSB_POCOutput>
         <medi:STUDYID>123</medi:STUDYID>
         <medi:DOMAIN>CTS</medi:DOMAIN>
    </medi:MEDI_DEV_OSB_POCOutput>
         </medi:MEDI_DEV_OSB_POCOutputCollection>
         </soap-env:Body>
         </soapenv:Envelope>
    In the above xml if you observe the part in Bold it is an element which is closed inside the envelope with no matter in it.. I wonder how to go beyond this <Header/> element using
    xpath so as to select it in the template tag. I need the result xml should be somethiing like the below :-
    <?xml version="1.0" encoding="UTF-8"?>
         <soapenv:Envelope      xmlns:soapenv="peopledirectory">
         <soapenv:Header/>
         <soap-env:Body      xmlns:soap-env="propleaccess">
         <medi:MEDI_DEV_OSB_POCOutputCollection      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:medi="http://xmlns.oracle.com/pcbpel/adapter/db/MEDI_DEV_OSB_POC">
    <medi:MEDI_DEV_OSB_POCOutput>
    <NewElement1 name = STUDENTID value = 123/>
    <NewElement2 name = DOMAIN value = CTS/>
    </medi:MEDI_DEV_OSB_POCOutput>
    Something like this...
    To achieve this I wrote the below xslt
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:soapenv="peopledirectory" xmlns:soap-env="propleaccess          xmlns:medi="http://xmlns.oracle.com/pcbpel/adapter/db/MEDI_DEV_OSB_POC">
    <xsl:output method = "xml" intend = "yes"/>
    <xsl:template match = "soapenv:Envelope/soapenv:Header"></xsl:template>
    <xsl:template match = "soapenv:Envelope/soap-env:Body/medi:MEDI_DEV_OSB_POCOutputCollection/medi:MEDI_DEV_OSB_POCOutput" >
         <xsl:for-each select="medi:MEDI_DEV_OSB_POCOutput/medi:STUDYID">
         <xsl:element name="Name">
         <xsl:value-of select="medi:STUDYID"></xsl:value-of>
         </xsl:element>
         </xsl:for-each>
         </xsl:template>
    </xsl:stylesheet>
    Using this xslt I am not getting the result xml as how I needed. I am getting just the text values of nodes in my result xml. Kindly help me on this.
    Thanks,
    Phanindra.

    If by NewElement1, NewElement2... you mean NewElement literally (replaced by whatever real name you choose) whereas 1,2,... have no generic meaning, you can do this.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:soapenv="peopledirectory"
        xmlns:soap-env="propleaccess"
        xmlns:medi="http://xmlns.oracle.com/pcbpel/adapter/db/MEDI_DEV_OSB_POC">
    <xsl:output method = "xml" indent="yes"/>
    <xsl:strip-space elements="*" />
    <xsl:template match="*|@*|text()|processing-instruction()|comment()">
        <xsl:copy>
            <xsl:apply-templates select="*|@*|text()|processing-instruction()|comment()" />
        </xsl:copy>
    </xsl:template>
    <xsl:template match = "medi:MEDI_DEV_OSB_POCOutput" >
        <xsl:copy>
            <xsl:for-each select="*">
                <NewElement name="{local-name()}" value="{normalize-space()}" />
            </xsl:for-each>
        </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>If you attach generic meaning to 1,2,... you can replace the corresponding template by this.
    <xsl:template match = "medi:MEDI_DEV_OSB_POCOutput" >
        <xsl:copy>
            <xsl:for-each select="*">
                <xsl:element name="{concat('NewElement',position())}">
                    <xsl:attribute name="name">
                        <xsl:value-of select="local-name()" />
                    </xsl:attribute>
                    <xsl:attribute name="value">
                        <xsl:value-of select="normalize-space()" />
                    </xsl:attribute>
                </xsl:element>
            </xsl:for-each>
        </xsl:copy>
    </xsl:template>I go for these details just because some technique used might help you one-day in other contexts.
    Edited by: tsuji on Feb 15, 2012 2:26 AM Essential correction made to the 2nd template.

  • Need Help with XSLT Mapping....

    My scenario is synchronous scenario. SAP(Proxy) to XI to WebServer(SOAP)
    The response is coming back in asingle ANY field and so I guess I need XSLT Mapping to map it to the response message going  backto SAP.
    The response sent by webserver is of the structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <GetStudentsExResponse xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/LMSWebSvc/LMS_Interface">
       <GetStudentsExResult>
          <Courses xmlns="">
             <Warnings/>
             <Course CourseName="Requal RWT with Instructional Blocks TEST" CourseId="1325">
                <Student LastName="LMSTest" FirstName="A" SSN="112345678" LoginID="lms123456a" CompanyName="LMS Test" CourseStatus="P" CourseStatusDate="03/14/2007 09:24:36" CourseScore="90">
                   <Lesson LessonCode="1915" LessonName="RWT Part 1"/>
                   <Lesson LessonCode="1916" LessonName="RWT Part 2"/>
                   <Lesson LessonCode="1917" LessonName="RWT Requal Exam" LessonStatus="p" LessonStatusDate="03/14/2007 09:24:36" LessonScore="90" ProctorID="1" ProctorName="Account Default">
                      <ExamInteractions QuesNum="17758" StudentResp="D" CorrectResp="D" Judged="c"/>
                      <ExamInteractions QuesNum="17769" StudentResp="B" CorrectResp="C" Judged="w"/>
                      <ExamInteractions QuesNum="8465" StudentResp="A" CorrectResp="A" Judged="c"/>
                      <ExamInteractions QuesNum="8471" StudentResp="A" CorrectResp="A" Judged="c"/>
                      <ExamInteractions QuesNum="8496" StudentResp="C" CorrectResp="C" Judged="c"/>
                      </Lesson>
                </Student>          
             </Course>
          </Courses>
       </GetStudentsExResult>
    </GetStudentsExResponse>
    The Structure that I need to map this to is:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Course_Response_MT xmlns:ns0="urn:sce-com:xi:fi:goyala">
       <GetStudentsExResponse>
          <GetStudentsExResult>
             <Courses>
                <Course>
                   <CourseName/>
                   <CourseID/>
                   <Student>
                      <LastName/>
                      <FirstName/>
                      <SSN/>
                      <LoginID/>
                      <CourseStatus/>
                      <CourseStatusDate/>
                      <CourseScore/>
                      <Lesson>
                         <LessonCode/>
                         <LessonName/>
                         <LessonStatus/>
                         <LessonStatusDate/>
                         <ExamInteractions>
                            <QuesNum/>
                            <StudentResp/>
                            <CorrectResp/>
                            <Judged/>
                         </ExamInteractions>
                      </Lesson>
                   </Student>
                </Course>
             </Courses>
          </GetStudentsExResult>
       </GetStudentsExResponse>
    </ns0:Course_Response_MT>
    and  the xslt mapping that I have written for this is:
    <?xml version='1.0' encoding='utf-8' ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:sce-com:xi:fi:goyala" xmlns:DateUtils="com.sce.hcm.xi.util.DateUtils">
         <xsl:template match="/">
              <a:Course_Response_MT>
                   <GetStudentsExResponse>
                        <GetStudentsExResult>
                             <Courses>
                                  <CourseName>
                                       <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course[@CourseName]"/>
                                       <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course[@CourseID]"/>
                                       <Student>
                                            <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student[@LastName]"/>
                                            <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student[@FirstName]"/>
                                            <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student[@SSN]"/>
                                            <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student[@LoginID]"/>
                                            <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student[@CourseStatus]"/>
                                            <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student[@CourseStatusDate]"/>
                                            <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student[@CourseScore]"/>
                                            <Lesson>
                                                 <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson[@LessonCode]"/>
                                                 <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson[@LessonName]"/>
                                                 <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson[@LessonStatus]"/>
                                                 <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson[@LessonStatusDate]"/>
                                                 <ExamInteractions>
                                                             <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/ExamInteractions[@QuesNum]"/>
                                                             <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/ExamInteractions[@StudentResp]"/>
                                                             <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/ExamInteractions[@CorrectResp]"/>
                                                                   <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/ExamInteractions[@Judged]"/>
                                                 </ExamInteractions>
                                            </Lesson>
                                       </Student>                                   
                                  </CourseName>
                             </Courses>
                        </GetStudentsExResult>
                   </GetStudentsExResponse>                                        
              </a:Course_Response_MT>
         </xsl:template>
    </xsl:stylesheet>
    But This mapping is not working...  I am getting errors...
    Pls advice, this is urgent..
    Regards,
    XIer
    Edited by: XIer on Apr 25, 2008 12:23 PM
    Edited by: XIer on Apr 25, 2008 12:37 PM
    Edited by: XIer on Apr 25, 2008 12:37 PM

    Hi All,
              I have now modified my XSLT Mapping as :
    <?xml version='1.0' encoding='utf-8' ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:sce-com:xi:fi:goyala" xmlns:DateUtils="com.sce.hcm.xi.util.DateUtils">
         <xsl:template match="/">
              <a:Course_Response_MT>
                   <GetStudentsExResponse>
                   <xsl:value-of select="a:GetStudentsExResponse"/>
                        <GetStudentsExResult>
                        <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult"/>
                             <Courses>
                             <xsl:for-each select="a:GetStudentsExResponse/GetStudentsExResult/Courses">
                                  <Course>
                                   <CourseName>
                                       <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/@CourseName"/>
                                       </CourseName>
                                       <CourseID>
                                       <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/@CourseID"/>
                                       </CourseID>
                                       <xsl:for-each select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student">
                                       <Student>
                                       <LastName>
                                            <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/@LastName"/></LastName>
                                       <FirstName>     <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/@FirstName"/></FirstName>
                                            <SSN><xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/@SSN"/></SSN>
                                            <LoginID><xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/@LoginID"/></LoginID>
                                            <CourseStatus><xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/@CourseStatus"/></CourseStatus>
                                            <CourseStatusDate><xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/@CourseStatusDate"/></CourseStatusDate>
                                            <CourseScore><xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/@CourseScore"/></CourseScore>
                                            <xsl:for-each select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson">
                                            <Lesson>
                                                 <LessonCode><xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/@LessonCode"/></LessonCode>
                                                 <LessonName><xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/@LessonName"/></LessonName>
                                                 <LessonStatus><xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/@LessonStatus"/></LessonStatus>
                                                 <LessonStatusDate><xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/@LessonStatusDate"/></LessonStatusDate>
                                                 <ExamInteractions>
                                                      <QuesNum>       <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/ExamInteractions/@QuesNum"/></QuesNum>
                                                      <StudentResp>       <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/ExamInteractions/@StudentResp"/></StudentResp>
                                                      <CorrectResp>       <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/ExamInteractions/@CorrectResp"/></CorrectResp>
                                                         <Judged>          <xsl:value-of select="a:GetStudentsExResponse/GetStudentsExResult/Courses/Course/Student/Lesson/ExamInteractions/@Judged"/></Judged>
                                                 </ExamInteractions>
                                            </Lesson>
                                            </xsl:for-each>
                                       </Student>                                   
                                  </xsl:for-each>
                                  </Course>
                                  </xsl:for-each>
                             </Courses>
                        </GetStudentsExResult>
                   </GetStudentsExResponse>                                        
              </a:Course_Response_MT>
         </xsl:template>
    </xsl:stylesheet>     
    However when i execute this mapping in IR, I get empty tags at the target side:
    <?xml version="1.0" encoding="UTF-8"?>
    <a:Course_Response_MT xmlns:a="urn:sce-com:xi:fi:goyala"><GetStudentsExResponse><GetStudentsExResult><Courses/></GetStudentsExResult></GetStudentsExResponse></a:Course_Response_MT>
    Please Advice....
    Regards,
    XIer

  • Need help in XSL transformation

    Hi, I have a requirement where a message is recieved on the BPEL service. The message is basically a list of 200 or less productids.
    The requirement is to break the incoming message into smaller messages having a list of 50 productids each and then depending on the number of smaller messages call in parrallel a Proxy service in OSB.
    I am not sure how to write an XSL transfor which could split the message into smaller messages.
    I would highly appreciate if somebody could help or give any pointers.

    Hi,
    By passing parameters you can solve your problem.
    write an xsd like below.
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:p="http://schemas.oracle.com/service/bpel/common"
    xmlns="http://schemas.oracle.com/service/bpel/common"
    targetNamespace="http://schemas.oracle.com/service/bpel/common"
    elementFormDefault="qualified">
    <xsd:element name="parameters">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="item" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="name" type="xsd:string"/>
    <xsd:element name="value" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    create an element say pramsVar of type parameters (Root element in above xsd)
    Now take an assign activity and in copy select XML fragmentand do like below
    In From
    <parameters xmlns="http://schemas.oracle.com/service/bpel/common">
    <item>
    <name>beginIndex</name>
    <value/>
    </item>
    <item>
    <name>endIndex</name>
    <value/>
    </item>
    </parameters>
    assgn the above to paramsVar.
    Now assign proper values to begin and endIndexes (In your case 0 and 50)
    Now pass paramsVar to XSLT and create two paramters in XSLT say beginIndex and endIndex
    You need to use position function in XSLT like below
    *<xsl:if test="(position() > $beginIndex ) and (position() <= $endIndex)">*
    In BPEL you need to increment the beginIndex and EndIndex in a while loop till you reached the last record(In your case 4 times bcoz 200 recs)
    Regards
    PavanKumar.M

  • Need help in XSLT Mapping.

    Hello All,
    We created mapping between Orders IDOC structure, here we are using XSLT Mapping.
    problem is in IDOC structure new Z segment is added after that we have modified the mapping and tested in stylus studio and it was working fine.............but when we tested the interface end to end....the Z segment are not coming.
    we have updated the IDOC meta data in IDX2 .......when we hard code the Z segment values and run the mapping in interface mapping we can see proper result.
    Please give me inputs on this.
    Regards,
    chinna

    hi channa,
    go through the below link..for small ref...
    http://help.sap.com/saphelp_sm32/helpdata/en/6a/e6194119d8f323e10000000a155106/content.htm
    regards,
    kesava

  • Need help in Bpel transformation

    Hi
    I am reading the xml data file through partnerlink , the receive activity is dispalying the xml record.
    I want to transform that data into target xsd.The transform activity is not getting assigned.
    Regards
    mki

    Hmmm.... That seems odd...
    You should drop a transform activity after your receive, double click and open, the drop down on the left you should choose the output variable from the receive activity, and the right side you should select the target xsd schema.
    Then on the bottom either select automapper or create mapping manually, both will open the xslt UI.

  • Need help with XML TRANSFORMATION dump

    HI Experts ,
    I want to parse this XML file to abap internal table ,i use the ST below and i get  dump .
    The file is like that :
    <Containers>
         <Container workitemid="0000001" IsParent="X">
              <Element name="__INITIATO" value="U295"/>
              <Element name="_W_PRITY" value="5"/>
              <Element name="_F_VERSION" value="0000"/>
    </Container>
    <Container workitemid="0000001">
              <Element name="EXTENDED" value="X"/>
              <Element name="NOTE_REFERENCE" value=""/>
         </Container>
    </Containers>
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_ST_MATCH_ELEMENT', was not caught
    and
    therefore caused a runtime error.
    The reason for the exception is:
    XML matching error
    Expected was element-end: "Containers" [ ] Read was element-start: "Container"
    this is the ciode that i put on the call transformation
    <Containers>
        <Container>
            <tt:loop name="a" ref=".XML_TAB">
            <Element >
              <tt:attribute name="name" value-ref="$a.name"/>
              <tt:attribute name="value" value-ref="$a.value"/>
              </Element>
              </tt:loop>
            </Container>
        </Containers> ->**the dump in the debugger is here .**
      </tt:template>
    </tt:transform>
    the dump is because i don't refer to the </Container> in the middle
    and when i try to add the tag container in the middle i get warning during complition
    any idea please im stuck
    Best Regards
    Chris
    Edited by: Chris Teb on Aug 14, 2009 6:25 PM

    I guess you'll better understand with the solution I found:
    Simple transformation:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="XML_TAB"/>
      <tt:template>
        <Containers>
          <tt:loop name="b" ref=".XML_TAB">
            <Container>
              <tt:loop name="a" ref="$b.T_DATA">
                <Element>
                  <tt:attribute name="name" value-ref="$a.name"/>
                  <tt:attribute name="value" value-ref="$a.value"/>
                </Element>
              </tt:loop>
            </Container>
          </tt:loop>
        </Containers>
      </tt:template>
    </tt:transform>
    Program :
    data itab1 type string.
    concatenate '<Containers>'
    '       <Container workitemid="0000001" IsParent="X">'
    '   <Element name="__INITIATO" value="U295"/>'
    '   <Element name="_W_PRITY" value="5"/>'
    '   <Element name="_F_VERSION" value="0000"/>'
    '</Container>'
    '<Container workitemid="0000001">'
    '   <Element name="EXTENDED" value="X"/>'
    '   <Element name="NOTE_REFERENCE" value=""/>'
    '       </Container>'
    '</Containers>'
    into itab1.
    TYPES: BEGIN OF ty_data,
         name TYPE string,
         value TYPE string,
    END OF ty_data.
    DATA: lt_data TYPE TABLE OF ty_data.
    TYPES: BEGIN OF ty_data2,
         workitemid TYPE n LENGTH 7,
         isparent   TYPE flag,
         t_data     TYPE TABLE OF ty_data WITH DEFAULT KEY,
    END OF ty_data2.
    DATA: lt_data2 TYPE TABLE OF ty_data2.
    DATA lo_st_error TYPE REF TO cx_st_error.
    DATA message TYPE string.
    TRY.
    CALL TRANSFORMATION zext_file
            SOURCE XML itab1
            RESULT xml_tab = lt_data2.
      CATCH cx_sy_conversion_data_loss .
    * do something
      CATCH cx_st_error INTO lo_st_error.
        message = lo_st_error->get_text( ).
        WRITE:/ message .
    ENDTRY.
    By the way, I don't know what ITAB1 is in your case, it was more simple in my case to define it as a string. Anyway, if it's something else, it should work the same.

  • Error when applying a XSLT transformation: No valid XSLT pro

    Dear All,
    I am getting following error when opening the "General Supplier Data" from Pre-Select Supplier.
    Error Message: "Error message: Error when applying a XSLT transformation: No valid XSLT program supplied"
    I have already read the related threads on SDN and checked the SAP Note 883896 and others. Even tried running the program UXS_DEL_NAVIGATION_NODE and UXS_ADD_MISSING_XSLT_NAME. But not able to solve the issue.
    Kindly Help.
    Regards,
    Sagar

    Hi Masa,
    Thanks for reply. I have checked this note. As note suggests, S_DEVELOP auth object is assigned to the user. and it has value *.
    Do I need to check anything else?
    Regards,
    Sagar

  • BI Admin Tool and XSLT transformation for XML data source - How it works ?

    Hello,
    There is a possibility to import data from XML data source using BI Admin Tool.
    In the import window we can point XSLT file. What is the purpose of that XSLT field?
    Why I am asking ?
    I thought it is smth like XSLT processor, but simply it doesnt work.
    What I did:
    - I pointed XML data source file
    - I pointed XSLT transformation file
    - Click OK, and still get the message that the XML file structure is not supported
    After that I transformed that XML file with some desktop XSLT processor using the same XSLT file, and I tried to connect that file directly using BI Admin tool.Then it works. So it means that the transformation is ok.
    So basically one question comes to my mind in that situation:
    What is the purpose of XSLT field in BI Admin Tool when it comes to XML data source ?
    (it doesnt look like XSLT processor)
    Greetings
    /Michal

    Hi Mariano
    Why you need to use XSLT for transforming XML file into ABAP table
    Code is a part of some ABAP report. Looks like it is reading a file from file system and updating table after transformation
    If you have requirement like you need to read XML file and then insert the data into a SAP table
    You can use
    File to RFC
    File to Proxy scenario using SAP PI.
    Please provide more inputs on requirement to help
    Thanks
    Gaurav

  • XSLT transformation for XML to ABAP internal table

    Hi, can anyone please tell me how it should be the xslt tranformation to conver this xml
    <Embargos_ARBA_DOC>
         <ns:Embargos_ARBA_MT
              xmlns:ns="un:swissmedical:sap:proxy:embargos_arba:file">
              <Embargos_ARBA_MT>
                   <FECHA>20081101</FECHA>
                   <CUIT>50000002124</CUIT>
                   <MONTO>0000013794090</MONTO>
                   <RAZON_SOCIAL>RAUL ARMANDO CUNQUEIRO S.A.C.I.</RAZON_SOCIAL>
              </Embargos_ARBA_MT>
              <Embargos_ARBA_MT>
                   <FECHA>20081101</FECHA>
                   <CUIT>55000001456</CUIT>
                   <MONTO>0000001144410</MONTO>
                   <RAZON_SOCIAL>PARODI ESTEBAN ARMANDO</RAZON_SOCIAL>
              </Embargos_ARBA_MT>
         </ns:Embargos_ARBA_MT>
    </Embargos_ARBA_DOC>
    to this abap Table....
      DATA: BEGIN OF i_embargos_arba_doc occurs 0,
              fecha TYPE d,
              cuit TYPE char11,
              monto TYPE char13,
              razon_social(120),
            END OF i_embargos_arba_mt.
    so i can transform it with this sentence
          CALL TRANSFORMATION ('embargos_transformation')
            SOURCE XML source
            RESULT Embargos_ARBA_DOC = embargos.
    pls i need help because i am unable to create this xslt transformation...
    I will give the highest rewards points to the one who can help me.
    thanks!
    mariano

    Hi Mariano
    Why you need to use XSLT for transforming XML file into ABAP table
    Code is a part of some ABAP report. Looks like it is reading a file from file system and updating table after transformation
    If you have requirement like you need to read XML file and then insert the data into a SAP table
    You can use
    File to RFC
    File to Proxy scenario using SAP PI.
    Please provide more inputs on requirement to help
    Thanks
    Gaurav

  • XSLT Transformation

    Hi,
    I am trying to upload one xml file and filling an internal table with the content and a XSLT transformation. After uploading the file and make the first transformation i obtein one string with all the fields without tags and separated by #. so when i try to call transformation for filling the internal table i obtein the exception cx_xslt_exception with the message 'No valid source context supplied'.
    I would like to know if i am having poroblems with unicode characters. Is there any example made in sap that i can test or does anybody have had any similar problem?.
    My string
    <?xml version="1.0" encoding="utf-16"?>#######S####L####08##2######
    Thanks in advance
    regards

    Hi Verma,
    You're not transforming anything from your input to the output shown. You're actually constructing a new Output. I don't see anything being transformed from input to output.
    Anyway, if you need a XSLT to be used to get the above Output in map, following XSLT shall help you:
    <?xml version="1.0" encoding="UTF-16"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0" version="1.0" xmlns:s0="http://xmlns.service/1" xmlns:ns1="http://xmlns.types/1.0" xmlns:ns0="http://xmlns.OutService/2">
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
    <xsl:template match="/">
    <xsl:apply-templates select="/s0:Request" />
    </xsl:template>
    <xsl:template match="/s0:Request">
    <Output xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://xmlns.OutService/2">
    <outContext xmlns:ns0="http://xmlns.OutService/2" xsi:type="ns0:ReferenceContext" xmlns="http://xmlns.types/1.0" />
    </Output>
    </xsl:template>
    </xsl:stylesheet>
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

Maybe you are looking for

  • Usb device not recognised by windows 7 on hp pavillion dv5094ea

    Im having problems since ive updated my HP dv5094ea from windows xp up to windows 7, Since the upgrade my usb ports arent functioning, i keep getting an error bubble saying "Usb device not recognised" - device has malfunctioned ive tried several trou

  • Key Field Value for File Adapter Sender Wildcard

    Hello everybody, is there a way to use a wildcard for the property of NamA.keyFieldValue in the cc for a Fils Sender????, here's an example why, I need to take some Files via PI 7.0 and my key filed can change according to the file an example is that

  • Macbook Pro appears to be warped

    Hi there, The support webpage is very hard to navagate, firstly. Secondly the authorised support people in New Zealand, Rennassiance LTD's email doesnt work for me, mailer deamon just sends all my mail back to me. I bought a new Macbook Pro 17" from

  • Resolution of Superimposed Pictures

    I don't know why or how it happened, but I decided to try something on my own. Because I knew that the original picture was there, I "duplicated" it. Once I duplicated the original, I was able to "trash" the picture and the one superimposed. If anyon

  • Unable retrieve image from database

    Hi, I'm using Mysql-database with blob column. I'm trying to show one image on the page. Now I only get red cross, not image. I followed advices by jprazak:http://swforum.sun.com/jive/thread.jspa?threadID=47085&tstart=0 I changed code for my purpose.